Apr 10, 2013

List Logged In MySQL Users using Perl DBI

I saw this question on Stackoverflow.com.  The user wanted to programatically list all users that are connected to MySQL database server.

He was using the SQL statement "show processlist;".  This is a very useful statement which lists all MySQL connections with additional information.

Nov 28, 2012

Nagios XI Displaying Blank Perfdata Graphs

We are using Nagios XI to monitor our IT infrastructure.  We are monitoring over 2000 hosts and 11000 services on a heterogeneous environment.  It was recently noticed that on a few hosts the performance graphs were displayed but had no data, they were blank.  This problem was limited to some graphs for disk monitoring.

Oct 3, 2011

Getting Nagios Parent-child host relationship

Someone posted an interesting question in Nagios XI (customers only) forum whether it is possible to print the parent-child host relationships in a human readable format. 

NagiosQL stores this data in MySQL database server under the table named nagiosql.tbl_lnkHostToHost.  The table has two fields: idMaster and idSlave but the information is stored as host ids.  The Perl script posted here fetches this information, map the host ids to host names and displays the data in comma separated format which can be opened with any CSV reader, preferably Spreadsheet reader to make the data presentable.

I believe the script posted here applies to everyone who is using NagiosQL and not just Nagios XI users.

Aug 29, 2011

Scheduling multiple service checks in Nagios

Just like most Nagios administrators out there I am often required to add multiple hosts in Nagios monitoring which is quite simple task. But it takes a little while, sometimes longer, for Nagios to schedule checks for all the newly added hosts and services.

To make the life easier for us Nagios developers had been kind enough to provide us a command to do this programmatically.

Aug 11, 2011

check_windows_processes.pl - Nagios Plugin to monitor multiple Windows processes

Recently I was required to monitor multiple SQL Server processes on a Windows box. Nagios comes bundled with a very cool utility called check_snmp_process which is the ultimate choice for such requests. Unfortunately, it could monitor only one process at a time, so monitoring five processes would mean five different service check definitions, five different checks at five different intervals. Sounds too much of work, isn't it? Inspired by check_snmp_storage, another ultra-cool utility by the same author, I decided to write my own plugin to monitor multiple Windows processes in one run and came up with check_windows_processes.pl

May 10, 2011

MySQL data fragmentation using Perl

We are using Nagios XI which stores all kind of monitoring data in MySQL databases - nagios and nagiosql.  Due to high activity a lot of tables get fragmented very often.  Inspired by Sean Hull's article on MySQL data fragmentation I decided to automate this job using Perl.

Apr 19, 2011

Parsing Windows INI files using Perl

This is a quick dirty little script that I wrote to parse INI files on Microsoft Windows OS where I wasn't allowed to install Config::IniFiles or a similar module from CPAN.

INI files where data is separated by colon (:) or equal to sign (=) are supported.