Snmp graphs

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Acnologia
Posts: 6
Joined: Mon Dec 18, 2017 6:42 am

Snmp graphs

Post by Acnologia »

Hello ! I would like to create rdd graphs with snmp/nagios. I want to monitor a switch port (for example).

I have 4 scripts doing that for 'ping' command, can you help me do it for 'snmp' please (like : snmpwalk -v 1 -c public SwitchIP 1.3.6.1.2.1.2.2)

Here are my scripts :

create

Code: Select all

#!/bin/bash
rrdtool create rtt.rrd --step 1\
      DS:rtt:GAUGE:3:U:U\
      RRA:AVERAGE:0.5:1:10\
      RRA:AVERAGE:0.5:10:6\
      RRA:AVERAGE:0.5:60:5
oneping

Code: Select all

#!/bin/bash
i=0
while [ 0 ];
do
    i=$(expr \( $i + 1 \) % 300)
    read a
    rtt=$(echo $a | sed s/time=// | cut -d' ' -f 7)
    ./update $rtt $i
    sleep 1
done
ping

Code: Select all

#!/bin/bash
ping $1 | ./oneping
update

Code: Select all

#!/bin/bash
if [ $# -ne 2 ]; then exit
fi
echo $1
date=$(date +%s)
rrdtool update rtt.rrd $date:$1

t10=$(expr $date - 10)
t60=$(expr $date - 60)
t300=$(expr $date - 300)

rrdtool graph p10.png --start $t10\
  --x-grid SECOND:1:SECOND:5:SECOND:2:0:%X\
  DEF:mp=rtt.rrd:rtt:AVERAGE LINE2:mp#FC0000 > /dev/null

min=$(expr $2 % 10)
fmin=$(expr $2 % 60)

if [ $min -eq 0 ]
then
    rrdtool graph p60.png --start $t60\
  --x-grid SECOND:10:SECOND:30:SECOND:30:0:%X\
  DEF:mp=rtt.rrd:rtt:AVERAGE LINE2:mp#FC0000 > /dev/null
fi
if [ $fmin -eq 0 ]; then
    rrdtool graph p300.png --start $t300\
    DEF:mp=rtt.rrd:rtt:AVERAGE LINE2:mp#FC0000 > /dev/null
fi
Thank you for your help !
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Snmp graphs

Post by dwhitfield »

For switches, we usually use MRTG: https://assets.nagios.com/downloads/nag ... raphs.html

If you want to see how we do it in our commercial product, you can download a free trial of Nagios XI and install it using the instructions at https://assets.nagios.com/downloads/nag ... -Linux.pdf (we also have prebuilt OVA files). XI isn't meant to be run on the same server as Core. The apache configs will get in the way of each other.

There is also a bit of MRTG documentation, such as https://support.nagios.com/kb/article.php?id=510 . Most of it is written for XI, but the bits about the MRTG side of things should be useful.

Also, you can find all sorts of info about MRTG at their website: https://oss.oetiker.ch/mrtg/
Locked