Installation Tips & Tricks

@20090224
I am walked through a fresh Nagios install on a new CentOS5 Virtual Private Server using the Fedora Quick Install Guide.  I did notice that with my stripped down VPS starting OS, I had to install "make" and "openssl-devel" which were not mentioned in the guide.  Otherwise wi the latest release of nagios and nagios-plugins from http://nagios.org it all went easy as pie.

Addon: nagiosgraph - Lets make pictures!

What it does?

Scripts to parse perfdata and plugin output, store values in rrd databases and render trending graphs

http://nagiosgraph.sourceforge.net/

IMPORTANT - found an issue using certain versions of RRDTOOL.  For "ease", use version 1.2.27 when installing nagiosgraph.

Addon: rrdtool - Lets store the data!

RRDtool is required to get the nagiosgraph Addon working correctly. 

"RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data.  Use it to write your custom monitoring shell scripts or create whole applications using its Perl, Python, Ruby, TCL or PHP bindings." - http://oss.oetiker.ch/rrdtool/

I follwed the instructions outlined in the package.  I did run into one issue since I had to install libart-2.0 from source as well.  Read about the missing libart error/fix here.  Also to avoid an "undefined symbol: art_alloc" issue, I had to install a specific version of libart and you can find out about that undefined art_alloc issue here.

Tip - NRPE on Ubuntu

I usually stick with Fedora/RedHat and CentOS flavors of Linux.  Recently though, I needed to monitor a new Ubuntu test server via Nagios NRPE.  The sources I was using to build and install just did not play nice on first pass.  So I figured for the one off, I would try the easy way.

apt-get install nagios-nrpe-server

Of course it did not install things into the paths I am used to.  So my C&P config file did not work and I had to find where things got dropped.

NRPE Config file: /etc/nagios/nrpe.cfg

Nagios Plugins:  /usr/lib/nagios/plugins/

Init Script:  /etc/init.d/nagios-nrpe-server

Remind me why people like Ubuntu over other flavors for a server OS again?

Oh, and you'll probably also need:

apt-get install libssl-dev

Tip - Convert Nagios.log Timestamp

If you are like me, you have to dig through some log files to research some errors.  The ../var/nagios.log file has alot of data and unfortunately the times stamps are not exactly friendly to read.

[1256314960] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;hostname;servicename;0;Service running OK

Using a little perl command line magic we can convert that ugly timestamp into something more readable.

[Fri Oct 23 11:22:40 2009] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;hostname;servicename;0;Service running OK

Just use...

perl -pe 's/(\d+)/localtime($1)/e' nagios.log

Of course that will spew the entire log.  So using grep or tail, you can make it a bit more useful.

perl -pe 's/(\d+)/localtime($1)/e' nagios.log |grep server1

tail nagios.log | perl -pe 's/(\d+)/localtime($1)/e' 

Nagios SNMP Tools

Just a quick post about trying to get Nagios to use SNMP.  You need to make sure you have the components needed.  My stripped down little VPS I use for testing did not.  I needed to run:

yum install net-snmp-utils

That will install the utils and base package needed for Nagios and various nagios plugins.  I will update more as my testing continues.