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…
A simple TCP server written in Perl
The below example is a very simple TCP server script written in Perl, which uses the AnyEvent module.It will create a separate process for each connections and has the ability to return data to the parent process.The below example allows 15 child processes to be created, which results in 15 simultaneous client connections. The script…
OpenSSH 6.2.x and LDAP authentication
Since the release of OpenSSH 6.2, two new configuration parameters have been added: AuthorizedKeysCommand AuthorizedKeysCommandUser These parameters allow to create any kind of authentication method for OpenSSH, including LDAP authentication, and therefore patches like the LPK patch for OpenSSH are not required anymore. The only thing the script needs to do is return either an…
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,…