added nagios plugins
[puppet_munin.git] / files / plugins / nagios_perf_
1 #!/bin/bash
2
3 NAME=$(basename $0)
4
5 TYPE=${NAME##nagios_perf_}
6
7 [ "x$TYPE" = 'xhosts' ] && TYPE_ABBR=HST
8 [ "x$TYPE" = 'xsvc' ] && TYPE_ABBR=SVC
9 [ -z "$TYPE_ABBR" ] && echo "unknown type $TYPE" >&2 && exit 1
10
11 if [ "$1" = "config" ]; then
12         echo "graph_title Nagios $TYPE performance stats"
13         echo "graph_args --base 1000"
14         echo "graph_vlabel seconds"
15         echo "graph_category nagios"
16         echo "graph_info Check performance statistics"
17
18         echo "act_lat_$TYPE_ABBR.label act lat"
19         echo "act_lat_$TYPE_ABBR.type GAUGE"
20         echo "act_lat_$TYPE_ABBR.draw AREA"
21         echo "act_lat_$TYPE_ABBR.cdef act_lat_$TYPE_ABBR,1000,/"
22         echo "act_lat_$TYPE_ABBR.info average latency of active checks over the last 5 minutes"
23
24         echo "act_ext_$TYPE_ABBR.label act ext"
25         echo "act_ext_$TYPE_ABBR.type GAUGE"
26         echo "act_ext_$TYPE_ABBR.draw LINE1"
27         echo "act_ext_$TYPE_ABBR.cdef act_ext_$TYPE_ABBR,1000,/"
28         echo "act_ext_$TYPE_ABBR.info average execution time of active checks over the last 5 minutes"
29
30         exit 0
31 fi
32
33 echo "act_lat_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}LAT)
34 echo "act_ext_$TYPE_ABBR.value " $(nagios2stats --mrtg --data AVGACT${TYPE_ABBR}EXT)
35