2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

MIB file availability check added

This commit is contained in:
Thomas Diener 2012-01-25 16:59:33 +01:00
parent ce8b1121ec
commit 6db1665991

View File

@ -12,6 +12,7 @@
# #
# Version: v1.00 30.10.2011 First draft of the fortigate plugin # Version: v1.00 30.10.2011 First draft of the fortigate plugin
# v1.01 19.01.2012 OID to MIB changed, plugins gets faster # v1.01 19.01.2012 OID to MIB changed, plugins gets faster
# v1.02 25.01.2012 MIB file availability check added
# #
# Parameters: config (required) # Parameters: config (required)
# autoconf (optional) # autoconf (optional)
@ -28,7 +29,7 @@
# Fortigate Activate snmp on your Fortigate firewall. Fortigate documentation # Fortigate Activate snmp on your Fortigate firewall. Fortigate documentation
# at https://support.fortinet.com # at https://support.fortinet.com
# #
# MIB Download and copy the Fortigate MIB defintion file to # MIB Download and copy the original Fortigate MIB defintion file to
# /usr/share/snmp/mibs/FORTINET-300-MIB.txt (Filename depends on # /usr/share/snmp/mibs/FORTINET-300-MIB.txt (Filename depends on
# used Version) # used Version)
# #
@ -45,8 +46,12 @@
SNMPCLIENT=`basename $0 | sed 's/^snmp_//g' | cut -d "_" -f1` SNMPCLIENT=`basename $0 | sed 's/^snmp_//g' | cut -d "_" -f1`
MIBFILE="/usr/share/snmp/mibs/FORTINET-300-MIB.20080414.txt" MIBFILE="/usr/share/snmp/mibs/FORTINET-300-MIB.20080414.txt"
FNTYPE=`echo $MIBFILE | cut -d "." -f1 | cut -d "/" -f6` FNTYPE=`echo $MIBFILE | cut -d "." -f1 | cut -d "/" -f6`
SNMPGET="/usr/bin/snmpget -m $MIBFILE -c $community -v 2c $SNMPCLIENT" if [ -r $MIBFILE ]; then
SNMPGET="/usr/bin/snmpget -m $MIBFILE -c $community -v 2c $SNMPCLIENT"
else
echo no, MIB definition file not available or readable.
exit 1
fi
### Variables ------------------------------------------------------------------ ### Variables ------------------------------------------------------------------
fnSysVersion="1.3.6.1.4.1.12356.1.3.0" fnSysVersion="1.3.6.1.4.1.12356.1.3.0"
@ -57,10 +62,9 @@ fnSysSesCount="$FNTYPE::fnSysSesCount.0"
fnVPNSslStatsLoginUsers="$FNTYPE::fnVpnSslStatsLoginUsers.1" fnVPNSslStatsLoginUsers="$FNTYPE::fnVpnSslStatsLoginUsers.1"
fnVPNSslStatsActiveWebSessions="$FNTYPE::fnVpnSslStatsActiveWebSessions.1" fnVPNSslStatsActiveWebSessions="$FNTYPE::fnVpnSslStatsActiveWebSessions.1"
fnVPNSslStatsActiveTunnels="$FNTYPE::fnVpnSslStatsActiveTunnels.1" fnVPNSslStatsActiveTunnels="$FNTYPE::fnVpnSslStatsActiveTunnels.1"
mibfile="/usr/share/snmp/mibs/FORTINET-300-MIB.20080414.txt"
UNIT=`$SNMPGET $fnSysVersion | cut -d ":" -f4 | cut -d " " -f2 | cut -d "\"" -f2` UNIT=`$SNMPGET $fnSysVersion | cut -d ":" -f4 | cut -d " " -f2 | cut -d "\"" -f2`
SCPU=`$SNMPGET $FGTcpu | cut -d ":" -f4 | cut -d " " -f2` SCPU=`$SNMPGET $FGTcpu | cut -d ":" -f4 | cut -d " " -f2`
SMEM=`$SNMPGET $fnSysMemUsage | cut -d ":" -f4 | cut -d " " -f2` SMEM=`$SNMPGET $fnSysMemUsage | cut -d ":" -f4 | cut -d " " -f2`
SCNT=`$SNMPGET $fnSysSesCount | cut -d ":" -f4 | cut -d " " -f2` SCNT=`$SNMPGET $fnSysSesCount | cut -d ":" -f4 | cut -d " " -f2`
USER=`$SNMPGET $fnVPNSslStatsLoginUsers | cut -d ":" -f4 | cut -d " " -f2` USER=`$SNMPGET $fnVPNSslStatsLoginUsers | cut -d ":" -f4 | cut -d " " -f2`
@ -86,7 +90,7 @@ autoconf()
exit 1 exit 1
fi fi
if [ $SCNT ]; then if [ $SCNT ]; then
echo yes, OID $fnSysSesCount can be read. echo yes, OID $fnSysSesCount can be readed.
else else
echo no, one or multiple OID can not be read. echo no, one or multiple OID can not be read.
exit 1 exit 1
@ -107,7 +111,6 @@ config()
echo 'forticpu.info CPU usage' echo 'forticpu.info CPU usage'
echo 'forticpu.draw AREA' echo 'forticpu.draw AREA'
echo '' echo ''
echo "multigraph fn_memory" echo "multigraph fn_memory"
echo "host_name $SNMPCLIENT" echo "host_name $SNMPCLIENT"
echo "graph_title $UNIT - Memory usage" echo "graph_title $UNIT - Memory usage"