Nagiosgraph question...

Chris Wilson chris at aidworld.org
Wed Mar 30 18:28:10 CEST 2005


Hi all,

I found the default map file to be absolutely useless. It didn't match
ANY of the 1.4 plugins. I've attached my map file, which fixes all the
plugins that I want graphs for.

Cheers, Chris.

On Wed, 2005-03-30 at 17:17, Braun Brelin wrote:
> Hello,
> 
> i've installed nagiosgraph but I can't seem to get it to generate any graphs.
> There don't seem to be any rrd database files being generated in the rrd
> directory, despite permissions of rwxrwxrwx set on the dir itself.
> 
> i'm running nagios/nagiosgraph on a Fedora Core 3 x86 system.
> 
> The map file itself seems to be fine, at least a perl -c map doesn't
> produce any errors.  I'm using the stock map file that comes with the
> nagiosgraph 0.3 distribution.
> 
> Should I not expect some rrd DB files to be created by default for the
> defined service graphs in the map file?
> 
> Thanks,
> 
> Braun Brelin
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null
-- 
(aidworld) chris wilson | chief engineer (chris at aidworld.org)
-------------- next part --------------
# File:    $Id: map,v 1.4 2004/11/12 03:01:55 sauber Exp $
# Author:  (c) Soren Dossing, 2004
# License: OSI Artistic License
#          http://www.opensource.org/licenses/artistic-license.php

########################################################################
#
# INSTRUCTIONS:
#
# This file contains several example of service types. Edit this file to 
# add more service types. The data string from Nagios is in $_ . Use 
# regular expressions to identify and extract data like the examples below
# below.  Match on either output: or perfdata: . The code is pure perl, 
# that will be run inside and eval{}. Results are expected in @s. The
# general format is:
# 
# /output|perfdata:<servicetype> <key>=<value> <key2=value2> .../
# and push @s, [ <databasename>,
#                [ <key>,  GAUGE|DERIVE, <value>  ],
#                [ <key2>, GAUGE|DERIVE, <value2> ],
#                [ .       .              .        ],
#                [ .       .              .        ] ];
# 
# But more advanced code is possible, as long as the resulting 
# datastructure is correct.
# 
########################################################################

# Service type: ping
#   output:PING OK - Packet loss = 0%, RTA = 0.00 ms
/output:PING.*?(\d+)%.+?([.\d]+)\sms/
and push @s, [ ping,
               [ losspct, GAUGE, $1      ],
               [ rta,     GAUGE, $2/1000 ] ];

# Service type: check_disk
#   output: "DISK OK [67349680 kB (62%) free on /dev/hdc2]"
#   output: "DISK OK - free space: /var 3887 MB (78%):"
#   perfdata: /=12372mB;14417;15698;96;16019 /raid=882441mB;999780;999780;91;999780
m|output:DISK (\w+) \[(\d+) kB \((\d+)%\) free on (\S+)\]| and do {
  my $status   = $1;
  my $kb_free  = $2;
  my $pct_free = $3;
  my $mount    = $4;
  push @s, [ $mount, [ blockpct, GAUGE, $pct_free ] ];
};
m|output:DISK (\w+) - free space: (\S+) (\d+) MB \((\d+)%\)|
and push @s, [ $2, [ blockpct, GAUGE, $4 ] ];

# Service type: unix-dns
#   output:DNS OK - 0.008 seconds response time (test.test.1M IN A192.169.0.47)
#   perfdata:time=8260us;;;0
/output:DNS.*?([.0-9]+) sec/
and push @s, [ dns,
               [ response,  GAUGE, $1 ] ];

# Service type: unix-imap
#   output:IMAP OK - 0.009 second response time on port 143
/output:IMAP.*?([-.0-9]+) sec/
and push @s, [ imap,
               [ response, GAUGE, $1 ] ];

# Service type: unix-ldap
#   ouput:LDAP OK - 0.004 seconds response time
#   perfdata:time=3657us;;;0
/output:LDAP.*?([.0-9]+) sec/
and push @s, [ ldap,
               [ response, GAUGE, $1 ] ];

# Service type: unix-load
#   output: OK - load average: 0.66, 0.70, 0.73
#   perfdata:load1=0;15;30;0 load5=0;10;25;0 load15=0;5;20;0
/output:.*load average: ([.0-9]+), ([.0-9]+), ([.0-9]+)/
and push @s, [ load,
               [ avg1min,  GAUGE, $1 ],
               [ avg5min,  GAUGE, $2 ],
               [ avg15min, GAUGE, $3 ] ];

# Service type: unix-mailq
#   output:WARNING: mailq is 5717 (threshold w = 5000)
#   perfdata:unsent=5717;5000;10000;0
/perfdata:unsent=(\d+);(\d+);(\d+);(\d+)/
and push @s, [ mailq =>
               [ qsize, GAUGE, $1 ],
               [ qwarn, GAUGE, $2 ],
               [ qcrit, GAUGE, $3 ] ];

# Service type: unix-netstat
#   output:OK
#   perfdata:udpInDatagrams=46517147, udpOutDatagrams=46192507, udpInErrors=0, 
#   tcpActiveOpens=1451583, tcpPassiveOpens=1076181, tcpAttemptFails=1909, 
#   tcpEstabResets=5045, tcpCurrEstab=6, tcpOutDataBytes=3162434373, 
#   tcpInDataBytes=1942718261, tcpRetransBytes=215439
/perfdata:.*udpInDatagrams=(\d+), udpOutDatagrams=(\d+), udpInErrors=(\d+), tcpActiveOpens=(\d+), tcpPassiveOpens=(\d+), tcpAttemptFails=(\d+), tcpEstabResets=(\d+), tcpCurrEstab=(\d+), tcpOutDataBytes=(\d+), tcpInDataBytes=(\d+), tcpRetransBytes=(\d+)/
and push @s, [ udp =>
               [ InPkts,  DERIVE, int $1/300 ],
               [ OutPkts, DERIVE, int $2/300 ],
               [ Errors,  DERIVE, int $3/300 ] ],
             [ tcp =>
               [ ActOpens,    DERIVE, int $4/300    ],
               [ PsvOpens,    DERIVE, int $5/300    ],
               [ AttmptFails, DERIVE, int $6/300    ],
               [ OutBytes,    DERIVE, int $9/300*8  ],
               [ InBytes,     DERIVE, int $10/300*8 ] ];

# Service type: unix-ntp
#   output:NTP OK: Offset 0.001083 secs, jitter 14.84 msec, peer is stratum 1
/output:NTP.*Offset ([-.0-9]+).*jitter ([-.0-9]+).*stratum (\d+)/
and push @s, [ ntp =>
               [ offset  => GAUGE => $1      ],
               [ jitter  => GAUGE => $2/1000 ],
               [ stratum => GAUGE => $3+1    ] ];

# Service type: unix-pop
#   output:POP OK - 0.008 second response time on port 110
/output:POP.*?([.0-9]+) second/
and push @s, [ pop3,
               [ response => GAUGE => $1 ] ];

# Service type: unix-procs
#   output:PROCS OK: 43 processes
/output:PROCS.*?(\d+) processes\n/
and push @s, [ procs,
               [ procs => GAUGE => $1 ] ];

# Service type: unix-smtp
#   output:SMTP OK - 0.187 sec. response time
/output:SMTP.*?([-.0-9]+) sec/
and push @s, [ smtp =>
               [ response => GAUGE => $1 ] ];

# Service type: unix-swap
#   output:SWAP OK: 96% free (2616 MB out of 2744 MB)
#   perfdata:swap=2616MB;274;54;0;2744
/perfdata:swap=(\d+)MB;(\d+);(\d+);\d+;(\d+)/
and push @s, [ swap =>
               [ free => GAUGE => $1*1024**2 ],
               [ warn => GAUGE => $2*1024**2 ],
               [ crit => GAUGE => $3*1024**2 ],
               [ max  => GAUGE => $4*1024**2 ] ];

# Service type: unix-users
#   output:USERS OK - 4 users currently logged in
#   perfdata:users=4;5;10;0 
/perfdata:users=(\d+);(\d+);(\d+)/
and push @s, [ procs =>
               [ users => GAUGE, $1 ],
               [ warn  => GAUGE, $2 ],
               [ crit  => GAUGE, $3 ] ];

# Service type: unix-zombies
#   ouput:PROCS OK: 0 processes with STATE = Z
/output:PROCS.*?(\d+) processes.*Z/
and push @s, [ zombie =>
               [ zombies => GAUGE, $1 ] ];

# Service type: check_http
#   output: "HTTP ok: HTTP/1.1 200 OK - 0.080 second response time"
m|output:HTTP (\w+):? (\S+) (\d+) (.*) - +(\d+\.\d+) second response time|
and push @s, [ http => [ time => GAUGE, $5 ] ];

# Service type: check_cpu_2.pl
# output: "OK: CPU 0.40% busy (...)"
m|output:(\w+): CPU (\d+\.\d+)% busy|
and push @s, [ cpu => [ busy => GAUGE, $2 ] ];

# Service type: check_memusage.pl
# output: "Java free memory OK: currently 59494960"
m|output:Java free memory (\w+): currently (\d+)|
and push @s, [ java => [ memfree => GAUGE, $2 ] ];

if (m|SENSORS \w+: .*\((.*)\)|) {
	my @values = split m', ', $1;
	my @data = ( "sensors" );
	foreach my $value (@values) {
		next unless $value =~ m|^(.+) = (\d+) (\w+)|;
		my $val = $2;
		$val /= 100 if $3 eq "RPM";
		push @data, [ $1, GAUGE, $val ];
	}
	push @s, \@data;
}


More information about the Users mailing list