A good chart add-on for nagios

Hello,
does anyone here use a graphing add-on? whats your recommendations.
I’m looking for one that’d be able to graph realtime with multiple graphs (like Novell’s ManageWise).
your thoughts and preferences are really appreciated :slight_smile:

i’ve been using nagiostat for a long time. at the moment i’m running nagios+nagiostat in parallel with cacti… cacti seems much more user friendly… but if you have a full nagios install i wouldn’t recommend the switch.

Luca

PS: Checked a bit and cacti has no alerting part so it’s no way a substitute… nagiostat or nagiosgraph are the only options i suppose.
Edited Sun Jan 08 2006, 10:12PM ]

I’ve been trying to get nagiosgraph and nagiostat to work, but I’ve failed miserably. They don’t seem to be generating any files in the database directory. I’ve went through the installation documentation carefully but still no luck.
First I have a problem with the web interface, even if nagiosgraph/stat aren’t collecting data, the page itself should appear, right? I get an “Internal Server Error”. Here’s my nagiosgraph.conf file content:
ScriptAlias /nagiosgraph/ /usr/local/nagios/nagiosgraph/
<Directory “/usr/local/nagios/nagiosgraph/”>
AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all

Do I need to add anything special to nagios.cfg itself to get the database running? I’ve already done the perfermance data stuff on misscommands.cfg and created entries in serviceextinfo.cfg.

Thank you for your time :slight_smile:

Nagiostat only: (never used nagiosgraph)

what you need in fact is only the perfromance data… serviceextinfo only adds the icons.

check your apache log for the error while accessing $nagioshome/nagiostat/nagiostat.cgi

then change in the nagiostat file the debug level to 3 and see if the debug.log file has anything…

Luca

Here’s a concise how-to for nagiosgraph which I use.

First off, I’d recommend throwing show.cgi into your nagios cgi-bin directory (sbin) and make sure it is executable by your web server user (probably ‘chmod a+x show.cgi’ is sufficient). You’ll need to edit show.cgi to set my $configfile= to the path and filename of your nagiosgraph.conf, i.e.:

my $configfile=/usr/local/nagios/etc/nagiosgraph.conf’

Your paths may be different. This way you don’t need to touch apache’s conf file, assuming you already have it set up correctly for nagios’ cgi-bin alias.

Next, you need to set up a directory for the nagiosgraph scripts and rrd data, I use /usr/local/nagios/nagiosgraph. In it I have:

ls -l

-r-xr-xr-x 1 nagios nagios 4784 Nov 15 09:30 insert.pl
-r–r--r-- 1 nagios nagios 8784 Jan 9 13:22 map
-r–r--r-- 1 nagios nagios 846 Nov 15 09:30 nagiosgraph.conf
drwxrwxr-x 2 nagios nagios 6144 Nov 15 09:30 rrd

Note that I have my nagios set to run as user nagios / group nagios. Your setup may be different. In any event, make sure that the user you run nagios as has permissions to read everything in that directory, and to execute insert.pl, and that both your nagios user and your webserver user have permissions to read the rrd directory. I added www (user my apache runs as) to the nagios group in /etc/group so that the above permissions are satisfied, you could do the same or just ‘chmod a+r rrd’. You will need to edit insert.pl similar to show.cgi:

my $configfile = ‘/usr/local/nagios/etc/nagiosgraph.conf’;

Next, you should verify that nagios.cfg is set up to process perfdata for services (I don’t process perfdata for hosts):

process_performance_data=1
service_perfdata_file=/var/spool/nagios/perfdata.dat
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=60
service_perfdata_file_processing_command=process-service-perfdata

Your perfdata.dat file may be in a different location, just make sure that the file is read/writable by your nagios user.

I have the process-service-perfdata command specified as:

define command {
command_name process-service-perfdata
command_line /usr/local/nagios/nagiosgraph/insert.pl
}

You also must specify ‘process_perf_data 1’ for any service that you wish nagios to perform this on:

define service {
host_name myserver.com
service_description CPU Load

process_perf_data 1

}

You can also define a serviceextinfo stanza for your service, adding a notes_url that can be used to access the rrd later (via show.cgi):

define serviceextinfo {
host_name myserver.com
service_description CPU Load
notes_url show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
icon_image graph.png
icon_image_alt View graphs
}

Lastly, check nagiosgraph.conf to verify that all the paths are correct:

logfile = /var/log/nagios/nagiosgraph.log
rrddir = /usr/local/nagios/nagiosgraph/rrd
mapfile = /usr/local/nagios/nagiosgraph/map
perflog = /var/spool/nagios/perfdata.dat

Again your paths may be different. Make sure the logfile is in a place that is writable by the nagios user. Later on you can watch this logfile ‘tail -f /path/to/nagiosgraph.log’ to see why rrd files aren’t being created for a particular service.

At this point, restart nagios and any time one of the services that process_perf_data is true for is polled, nagios will call the the process-service-perfdata command, which invokes insert.pl. insert.pl reads the nagiosgraph.cfg file, sees where the perfdata.dat file is located, then processes each line in that file and creates or updates a corresponding .rrd file for that service in the rrd directory, which show.cgi can later read and display a graph for.

One last thing, the ‘map’ file. This file has some pre-written stanza’s to parse perfdata.dat and identify lines as one type of service or another. If you use custom check plugins, or plugins that the nagiosgraph map file knows nothing about (which is quite a few of them), those particular lines in perfdata.dat won’t be recognised by the map file, and will just be skipped. You will probably want to learn how to manipulate the map file to teach it new tricks.

-mike
Edited Thu Jan 12 2006, 12:06AM ]

Luca: Thanks a lot, heres what I get when I try to access nagios stat url, this is the error_log from apache:
[Thu Jan 12 11:54:19 2006] [error] File does not exist: /var
/www/html/nagiostat

Mike: I really appreciate the walk-through, I’ll give it a try now and see where I get from there.

thanks again guys

Mike,
When I did a pre-flight check, nagios complained about this line in nagios.cfg:
service_perfdata_file=/var/spool/nagios/perfdata.dat
the error is :"Error in configuration file ‘/usr/local/nagios/etc/nagios.cfg’ - Line 483 (UNKNOWN VARIABLE)"
am I doing something wrong? thanks a lot :slight_smile:

I’m using Nagios 1.3 btw

neverymind my two last posts, I upgraded to version 2 so those performance data commands would work.

However, :), when I start nagios, theres something wrong with insert.pl. I think I’m missing a library of some kind because it tells me:
Can’t locate RRDs.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at /usr/local/nagios/nagiosgraph/insert.pl line 9.
BEGIN failed–compilation aborted at /usr/local/nagios/nagiosgraph/insert.pl line 9."

line 9 on my insert.pl says: “use RRDs” , so obviously I’m missing this RRDs thingie.

I tried by using the “use lib qw(rrdtool)” but didn’t work out.
any thoughts on how to fix this RRDs problem?
I have RRD tools installed.

looks like perl can’t find it. You may have to install perl again.
But make sure your rrdtool lib is in the path for
vi /etc/ld.so.conf
add /usr/local/rrdtool-1.2.11/lib or whatever
then
ldconfig
then compile/install perl again.
or add to your perl script
use lib “/usr/local/rrdtool-1.2.11/lib”;

I tried to use: use lib “/usr/local/rrdtool-1.2.12/lib”; but it gave me the same error.
if its not much trouble, where should I head to recompile perl ?

Download the source and read the docs to install.

I finally got it to work by adding the full path to your earlier example, I had to put:
use lib “/usr/local/rrdtool-1.2.12/lib/perl/5.8.0/i386-linux-thread-multi”;
and now it works find, produces the rrd files, graphs and everything.

Is it possible to make show.cgi refresh itself on the browser every minute or so as can be done with service detai, host detail etc. In other words make it graph real-time without the need to refresh the page.
thanks

change the code in show.cgi to perform that function I suppose.

thanks, I had to wrap it up in a timed loop.
thanks for all the help guys. Trying to set up nagios and graphs was very intimidating specially that this was my first time to use a unix based system. now feels like I won a nobel prize, great amount of satisfaction :slight_smile:

this paragraph here should be frame and hung somewhere, it really helped my thick skull understand whats going on, thanks a lot mike.