In a previous article (IPTables Logging in JSON with NFLOG and ulogd2) we learned how to log certain IPTables rules to JSON log files. Monitoring the logs in real-time on the command line, can also be very useful when debugging either the rules themselves or when analyzing certain issues. Rather than just looking at the…
Tag: Dev
Perl: Create schema backups in PostgreSQL
At my recent job, I was asked to create a backup procedure, which would dump a PostgreSQL schema to a compressed file and which was able to create weekly and daily backups.The backups had to be full backups each time a backup was made and the amount of daily and weekly backups should be defined…
Monitor running processes with Perl
Update: This article is updated thanks to Colin Keith his excellent comment. I was extremely inspired by it Maintaining a large number of servers cannot be done without proper programming skills. Each good system administrator must therefor make sure he knows how to automate his daily works. Although many many programming languages exist, most persons…
Postgresql: Monitor sequence scans with Perl
Not using indexes or huge tables without indexes, can have a very negative impact on the duration of a SQL query. The query planner will decide to make a sequence scan, which means that the query will go through the table sequentially to search for the required data. When this table is only 100 rows…
Postgresql: Monitor unused indexes
Working on large database systems, with many tables and many indexes, it is easy to loose the overview on what is actually being used and what is just consuming unwanted disk space.If indexes are not closely monitored, they could end up using undesired space and moreover, they will consume unnecessary CPU cycles. Statistics about indexes…
Postgresql 9.3: Creating an index on a JSON attribute
Recently I’ve discovered some very interesting new features in the PostgreSQL 9.3 database.First of all, a new data type has been introduced: JSON. Together with this new data type, new functions were also introduced. These new features now simply for instance saving web forms in your Postgresql database. Or actually any kind of dynamic data,…
Datatables and Perl (and a little bit of jQuery)
Recently I’ve stumbled on a pretty cool OpenSource project called ”datatables” (http://datatables.net/), which allows to easily create tables in HTML that can be: sorted searched paginated scroll infinitely themed … And most important: it’s for free! I’ve always wanted to create an infinite scrolling table and now it’s just too easy: And that’s it! Well,…
Google GeoChart, JSON and Perl
The Google API GeoChart Map (https://developers.google.com/chart/interactive/docs/gallery/geochart) is pretty nice widget to generate nice maps based on certain values. It has quite a lot of features and it is very easy to use. Before we look at the Google API for GeoChart, let’s first set up a script which will get data out of a database…
Secure Password Generator in Perl
A secure and very random password generator module written in Perl.It can be used to generate passwords or unique strings which can be used in sorts of operations. The default character set is alpha-numerical based, but can be set to any kind of character list. The complete handling and generating is implemented in a module,…
PostgreSQL 9.2 Master – Slave Monitoring
Nagios plugin script written in Bash to check the master-slave replication in PostgreSQL (tested on PostgreSQL 9.2.4) (executed on the slave). The script will report how many bytes the slave server is behind, and how many seconds ago the last replay of data occurred. The script must be executed as ‘postgres’ user. #!/bin/bash # $Id:…