nagiosgraph and disk space ?

Michael Gale michael.gale at pason.com
Fri Apr 1 18:07:35 CEST 2005


Hello,

I have setup nagiosgraph to graph almost the out put from every check,
below are some examples of what I have added, I have also attached a
copy of my map.edit file so if you want to use them you will not need to
worry about the line wraps.

Anyways I can not get the disk space check, using nrpe to graph the
data. Since some Linux boxes will have more then others I setup a few
rules:

The log file shows:
Fri Apr  1 08:51:06 2005 INSERT info: Input lastcheck:1112370662
Fri Apr  1 08:51:06 2005 INSERT info: Input hostname:hostname
Fri Apr  1 08:51:06 2005 INSERT info: Input
perfdata: /=7025MB;23251;26157;0;29064 /boot=18MB;78;88;0;98 /dev/shm=0MB;1335;1502;0;1669 /var/lib/mysql=156379MB;375428;422357;0;469286
Fri Apr  1 08:51:06 2005 INSERT info: Input servicedescr:Disk Usage
Fri Apr  1 08:51:06 2005 INSERT info: Input output:DISK OK - free
space: / 22039 MB (76%): /boot 80 MB (81%): /dev/shm 1670 MB
(100%): /var/lib/mysql 312907 MB (67%):
Fri Apr  1 08:51:06 2005 INSERT info: System /home/nagios/network-
monitor/bin/rrdtool create /home/nagios/network-
monitor/nagiosgraph/rrd/hostname%2D2_Disk%20Usage_unixdiskusage.rrd --
start 1112370662 DS:/:GAUGE:600:U:U RRA:AVERAGE:0.5:1:600
RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797

But no graph is ever created ?

# Service type: nrpe unix disk only 1 partitions
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB
(73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1
122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
        [ $1, GAUGE, $2 ] ];

# Service type: nrpe unix disk only 2 partitions
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB
(73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1
122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
        [ $1, GAUGE, $2 ],
        [ $3, GAUGE, $4 ] ];

# Service type: nrpe unix disk only 3 partitions
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB
(73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1
122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d
+)%.:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
        [ $1, GAUGE, $2 ],
        [ $3, GAUGE, $4 ],
        [ $5, GAUGE, $6 ] ];

# Service type: nrpe unix disk
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB
(73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1
122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d
+)%.:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
        [ $1, GAUGE, $2 ],
        [ $3, GAUGE, $4 ],
        [ $5, GAUGE, $6 ],
        [ $7, GAUGE, $8 ] ];




--snip-- part of my map.edit file -- which contains working regular
expressions for windows CPU,DISK and memory checks using nsclient
# Service type: check-win-cpu 
# check command: check_nt -H Address -v CPULOAD -l5,70,90,30,70,90
# output: CPU Load 9% (5 min average) 11% (30 min average)
# perfdata: ‘5 min avg Load’=9%;70;80;0;100 ‘30 min avg
Load’=11%;70;90;0;100
#/perfdata:.*5 min avg Load’=(d+)%;(d+);(d+);d+;d+ ‘30 min avg Load’=(d
+)%;d+;d+;d+;d+ /
#/output:CPU.Load.*?(d+)% /
#and push @s, [ winload,
#        [ avg05min, GAUGE, $3 ] ];
#/perdata:   5 min avg Load=9%;80;90;0;100
#/perdata:.*5 min avg Load=(\d+) /
#and push @s, [winload,
#       [ avg05min, GAUGE, $1 ] ];
#/perfdata:.*5 min avg Load’=(\d+)%;(\d+);(\d+);\d+;\d+ /
/output:CPU.Load.(\d+)%/
and push @s, [ winload,
        [ avg05min, GAUGE, $1 ] ];

# Service type: check-win-memory
#output: output:Memory usage: total:1230.19 Mb - used: 312.98 Mb (25%) -
free: 917.21 Mb (75%)
#perfdata: Memory usage=312.98Mb;984.15;1107.17;0.00;1230.19
/perfdata:.*Memory.usage=(\d+\.\d+)Mb;(\d+\.\d+);(\d+\.\d+);(\d+\.\d+);
(\d+\.\d+)/
and push @s, [ winmemory,
        [ memused, GAUGE, $1*1024**2 ],
        [ memwarn, GAUGE, $2*1024**2 ],
        [ memcrit, GAUGE, $3*1024**2 ],
        [ memmmax, GAUGE, $5*1024**2 ] ];

# Service type: check-win-uptim
#output System Uptime - 0 day(s) 22 hour(s) 50 minute(s) 
/output:System.Uptime.-.(\d+).day\(s\).(\d+).hour\(s\).(\d+).minute.*/
and push @s, [ winuptime,
        [ totalminutes, GAUGE, (($1*24*60)+($2*60)+$3) ] ];

# Service type: check-win-bytesttotal
#output Bytes Total/sec: 249.04
/output:Bytes.Total\/sec:.(\d+)/
and push @s, [ winbytestotal,
        [ Bytespersec, GAUGE, $1 ] ];

# Service type: check-win-disk
#perfdata: C: Used Space=6.32Gb;29.81;33.54;0.00;37.27
#output:C: - total: 37.27 Gb - used: 6.32 Gb (17%) - free 30.94 Gb (83%)
/perfdata:.*Used.Space=(\d+\.\d+)Gb;(\d+\.\d+);(\d+\.\d+);(\d+\.\d+);(\d
+\.\d+)/
and push @s, [ windiskusage,
        [ Diskusage, GAUGE, $1 ],
        [ DiskTotal, GAUGE, $5 ] ];

# Service type: Mysql Service
#output:Uptime: 7740  Threads: 4  Questions: 9945  Slow queries: 0
Opens: 20  Flush tables: 1  Open tables: 4  Queries 
#per second avg: 1.285
#print $line =~ /.*Uptime:.(\d+).*Threads:.(\d+).*Questions:.(\d
+).*Slow.queries:.(\d+).*Opens:.(\d+).*Flush.tables:.(\d
+).*Open.tables:.(\d+).*Queries.per.second.avg:.(\d+)/;
/output:.*Uptime:.(\d+).*Threads:.(\d+).*Questions:.(\d
+).*Slow.queries:.(\d+).*Opens:.(\d+).*Flush.tables:.(\d
+).*Open.tables:.(\d+).*Queries.per.second.avg:.(\d+)/
and push @s, [ mysql,
        [ Threads, GAUGE, $2 ],
        [ SlowQueries, GAUGE, $4 ],
        [ QueriesPecSec, GAUGE, $8 ] ];


-------------- 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: unix-disk
#   ouput:DISK OK - free space: / 12372 mB (77% inode=96%): /raid 882442 mB (88% inode=91%):
#   perfdata: /=12372mB;14417;15698;96;16019 /raid=882441mB;999780;999780;91;999780
/output:DISK/ and do {
  my @_pct = /: (\/.*?) .*?(\d+)% inode=(\d+)%/g;
  while ( my($_d,$_b,$_i) = splice @_pct,0,3 ) {
    my @_s;
    /perfdata:.*$_d=(\d+)\w*?;(\d+);(\d+);(\d+);(\d+)/;
    push @s, [ $_d,
               [ free,     GAUGE, $1*1024**2  ],
               [ user,     GAUGE, $2*1024**2  ],
               [ root,     GAUGE, $3*1024**2  ],
               [ max,      GAUGE, $5*1024**2  ],
               [ blockpct, GAUGE, $_b ],
               [ inodepct, GAUGE, $_i ] ];
  }
};

# 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.*RSDT/
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,
               [ swapfree, GAUGE, $1*1024**2 ],
               [ swapwarn, GAUGE, $2*1024**2 ],
               [ swapcrit, GAUGE, $3*1024**2 ],
               [ swapmax,  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: unix-www
#   ouput:HTTP OK HTTP/1.1 200 OK - 1456 bytes in 0.003 seconds
/output:HTTP.*?(\d+) byte.*?([.0-9]+) sec/
and push @s, [ http,
               [ bps, GAUGE, $1/$2 ] ];


# Service type: check-win-cpu 
# check command: check_nt -H Address -v CPULOAD -l5,70,90,30,70,90
# output: CPU Load 9% (5 min average) 11% (30 min average)
# perfdata: ‘5 min avg Load’=9%;70;80;0;100 ‘30 min avg Load’=11%;70;90;0;100
#/perfdata:.*5 min avg Load’=(d+)%;(d+);(d+);d+;d+ ‘30 min avg Load’=(d+)%;d+;d+;d+;d+ /
#/output:CPU.Load.*?(d+)% /
#and push @s, [ winload,
#	 [ avg05min, GAUGE, $3 ] ];
#/perdata:   5 min avg Load=9%;80;90;0;100
#/perdata:.*5 min avg Load=(\d+) /
#and push @s, [winload,
#	[ avg05min, GAUGE, $1 ] ];
#/perfdata:.*5 min avg Load’=(\d+)%;(\d+);(\d+);\d+;\d+ /
/output:CPU.Load.(\d+)%/
and push @s, [ winload,
	[ avg05min, GAUGE, $1 ] ];

# Service type: check-win-memory
#output: output:Memory usage: total:1230.19 Mb - used: 312.98 Mb (25%) - free: 917.21 Mb (75%)
#perfdata: Memory usage=312.98Mb;984.15;1107.17;0.00;1230.19
/perfdata:.*Memory.usage=(\d+\.\d+)Mb;(\d+\.\d+);(\d+\.\d+);(\d+\.\d+);(\d+\.\d+)/
and push @s, [ winmemory,
	[ memused, GAUGE, $1*1024**2 ],
	[ memwarn, GAUGE, $2*1024**2 ],
	[ memcrit, GAUGE, $3*1024**2 ],
	[ memmmax, GAUGE, $5*1024**2 ] ];

# Service type: check-win-uptim
#output System Uptime - 0 day(s) 22 hour(s) 50 minute(s) 
/output:System.Uptime.-.(\d+).day\(s\).(\d+).hour\(s\).(\d+).minute.*/
and push @s, [ winuptime,
	[ totalminutes, GAUGE, (($1*24*60)+($2*60)+$3) ] ];

# Service type: check-win-bytesttotal
#output Bytes Total/sec: 249.04
/output:Bytes.Total\/sec:.(\d+)/
and push @s, [ winbytestotal,
	[ Bytespersec, GAUGE, $1 ] ];

# Service type: check-win-disk
#perfdata: C: Used Space=6.32Gb;29.81;33.54;0.00;37.27
#output:C: - total: 37.27 Gb - used: 6.32 Gb (17%) - free 30.94 Gb (83%)
/perfdata:.*Used.Space=(\d+\.\d+)Gb;(\d+\.\d+);(\d+\.\d+);(\d+\.\d+);(\d+\.\d+)/
and push @s, [ windiskusage,
	[ Diskusage, GAUGE, $1 ],
	[ DiskTotal, GAUGE, $5 ] ];

# Service type: Mysql Service
#output:Uptime: 7740  Threads: 4  Questions: 9945  Slow queries: 0  Opens: 20  Flush tables: 1  Open tables: 4  Queries 
#per second avg: 1.285
#print $line =~ /.*Uptime:.(\d+).*Threads:.(\d+).*Questions:.(\d+).*Slow.queries:.(\d+).*Opens:.(\d+).*Flush.tables:.(\d+).*Open.tables:.(\d+).*Queries.per.second.avg:.(\d+)/;
/output:.*Uptime:.(\d+).*Threads:.(\d+).*Questions:.(\d+).*Slow.queries:.(\d+).*Opens:.(\d+).*Flush.tables:.(\d+).*Open.tables:.(\d+).*Queries.per.second.avg:.(\d+)/
and push @s, [ mysql,
	[ Threads, GAUGE, $2 ],
	[ SlowQueries, GAUGE, $4 ],
	[ QueriesPecSec, GAUGE, $8 ] ];

# Service type: nrpe unix disk only 2 partitions
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB (73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1 122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
        [ $1, GAUGE, $2 ] ];

# Service type: nrpe unix disk only 2 partitions
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB (73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1 122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
        [ $1, GAUGE, $2 ],
        [ $3, GAUGE, $4 ] ];

# Service type: nrpe unix disk only 3 partitions
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB (73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1 122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
        [ $1, GAUGE, $2 ],
        [ $3, GAUGE, $4 ],
        [ $5, GAUGE, $6 ] ];

# Service type: nrpe unix disk
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB (73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1 122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
        [ $1, GAUGE, $2 ],
        [ $3, GAUGE, $4 ],
        [ $5, GAUGE, $6 ],
        [ $7, GAUGE, $8 ] ];

# Service type: nrpe unix disk
#output DISK CRITICAL - free space: / 15520 MB (57%): /boot 100 MB (73%): /dev/shm 252 MB (100%): /mnt/ghost2 18790 MB (5%): /mnt/ghost1 122852 MB (40%)
/output:.*DISK.*-.free.space:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%.:.(\S+).*MB..(\d+)%./
and push @s, [ unixdiskusage,
	[ $1, GAUGE, $2 ],
	[ $3, GAUGE, $4 ],
	[ $5, GAUGE, $6 ],
	[ $7, GAUGE, $8 ],
	[ $9, GAUGE, $10 ] ];


More information about the Users mailing list