Page 1 of 1
PnP Graph with two values
Posted: Sun Feb 22, 2015 3:45 pm
by zaji_nms
Dear Expert
Previously via some efforts, me able to generate PnP graph with single value as below
#!/bin/sh
zusminute=`date +%M`
echo ""Minute $zusminute" | mIn=$zusminute"
exit 0
Now me trying to plot the graph with two values but no idea how to do this, appreciate your help.
#!/bin/sh
zusminute=`date +%M`
zushour=`date +%H`
echo ""Minute $zusminute" | MH=$zusminute | $zushour"
exit 0
Regards
Re: PnP Graph with two values
Posted: Sun Feb 22, 2015 4:45 pm
by Box293
https://nagios-plugins.org/doc/guidelines.html#AEN200
'label'=value[UOM];[warn];[crit];[min];[max]
space separated list of label/value pairs
For Example:
Code: Select all
echo ""Minute $zusminute" | Minute=$zusminute Hour=$zushour"
Have a look at this presentation I did at the Nagios World Conference about performance data:
https://www.youtube.com/watch?v=kqA2KcpUFg4
Re: PnP Graph with two values
Posted: Tue Feb 24, 2015 7:57 am
by zaji_nms
Thanks Mr.Troy
Me trying to aggregate some STM16 links traffic into one PNP graph (I have asked this feature, hope NagiosXI will consider in future)
Just showing two links but there is around 10 links (I omitted script to make it short readable)
Code: Select all
oneIN1=`snmpwalk -v 2c -c public myzusrtr3 ifOutOctets.628`
oneIN2=`snmpwalk -v 2c -c public myzusrtr5 ifOutOctets.633`
let slptm=25
sleep $slptm
twoIN1=`snmpwalk -v 2c -c public myzusrtr3 ifOutOctets.628`
twoIN2=`snmpwalk -v 2c -c public myzusrtr5 ifOutOctets.633`
oneIN1=`echo $oneIN1| cut -d':' -f 4`
oneIN2=`echo $oneIN2| cut -d':' -f 4`
twoIN1=`echo $twoIN1| cut -d':' -f 4`
twoIN2=`echo $twoIN2| cut -d':' -f 4`
ZUS1=`echo $twoIN1-$oneIN1/$slptm*8 | bc`
ZUS2=`echo $twoIN2-$oneIN2/$slptm*8 | bc`
FINAL=`echo $ZUS1+$ZUS2 | bc`
FINAL=`echo $FINAL/1000000 | bc`
echo ""Total $FINAL" | InMbps=$FINAL"
Me asking if there is any better way to do this as above not giving values very correctly? Any suggestion/hint....
Dear Mr.Troy, yes I have gone through your lecture and helped me to do this, really thanks (me novice in Linux). However my question still remain to plot two values in one PNP graph (same as Bandwidth graph), me want In & Out both values on one graph.
rrd files we know where stores /usr/local/nagios/share/perfdata/ && /var/lib/mrtg, however this above PNP graph, where values get stored?
Me appreciate your patience , expecting three answers.
Regards
Re: PnP Graph with two values
Posted: Tue Feb 24, 2015 5:57 pm
by tmcdonald
zaji_nms wrote:
Me asking if there is any better way to do this as above not giving values very correctly? Any suggestion/hint....
Can you provide a screenshot of what graphs your current implementation is producing?
Re: PnP Graph with two values
Posted: Tue Feb 24, 2015 10:50 pm
by Box293
zaji_nms wrote:However my question still remain to plot two values in one PNP graph (same as Bandwidth graph), me want In & Out both values on one graph.
If you currently have the data from separate service checks and you want to display this in one graph, then Graph Explorer is currently the easiest option.
Home
Performance Graphs > Graph Explorer
Multistacked Performance Graph
Here you can select A Host
Then Select the service
Then select the actual Data Type (data source) and then click Add To Graph
You can keep repeating this until you have a graph full of sources then you can click the Dashify icon (top left of the graph) and add this to a dashboard.
Does this answer your question?
Personally I would really like a way to save these Multistack graphs so I don't have to rebuild them each time.
I also thing Highcharts should have a graph templating option like PNP does.
zaji_nms wrote:Me trying to aggregate some STM16 links traffic into one PNP graph (I have asked this feature, hope NagiosXI will consider in future)
Just showing two links but there is around 10 links (I omitted script to make it short readable)
Code: Select all
oneIN1=`snmpwalk -v 2c -c public myzusrtr3 ifOutOctets.628`
oneIN2=`snmpwalk -v 2c -c public myzusrtr5 ifOutOctets.633`
let slptm=25
sleep $slptm
twoIN1=`snmpwalk -v 2c -c public myzusrtr3 ifOutOctets.628`
twoIN2=`snmpwalk -v 2c -c public myzusrtr5 ifOutOctets.633`
oneIN1=`echo $oneIN1| cut -d':' -f 4`
oneIN2=`echo $oneIN2| cut -d':' -f 4`
twoIN1=`echo $twoIN1| cut -d':' -f 4`
twoIN2=`echo $twoIN2| cut -d':' -f 4`
ZUS1=`echo $twoIN1-$oneIN1/$slptm*8 | bc`
ZUS2=`echo $twoIN2-$oneIN2/$slptm*8 | bc`
FINAL=`echo $ZUS1+$ZUS2 | bc`
FINAL=`echo $FINAL/1000000 | bc`
echo ""Total $FINAL" | InMbps=$FINAL"
Me asking if there is any better way to do this as above not giving values very correctly? Any suggestion/hint....
Thats really a difficult question. You are going to have to write a script from scratch (like you are doing) which would account for all scenarios. I think using the graph explorer method above is better, especially if the data already exists in other service checks.
zaji_nms wrote:/var/lib/mrtg
Don't bother querying these files, you should be querying the final location of this data which is the relevant bandwidth check.
zaji_nms wrote:however this above PNP graph, where values get stored?
If you wrote your own service check, then the rrd file will end up in /usr/local/nagios/share/perfdata/HOST/SERVICE_NAME.rrd
Re: PnP Graph with two values
Posted: Thu Feb 26, 2015 1:33 pm
by zaji_nms
Thanks Mr.Troy/tmcdonald
Per your advice, me gave up my way to for the consolidate graph, me achieved and nearly succeed taking help from check_rrdtraf, nothing very special but will share my script with different Topic may be will help other Nagios user and may trigger to Nagios developer to add the feature.
However our traffic ingress traffic (download) is very high compare to egress (out bond traffic), values showing correctly but graph not plotting at all, I don't know may be there is bug, as both graphs are independent, should plot. Can you check further what me thinking is correct? One value download is in 15000 and other egress upload traffic just 4000 Mbps (there is big gap in the values causing graph not to plot), due to this reason I have broke my one script in two.
Combined valued => Mbps:In/Out 19539 / 3622 (but no graph) , below the Data Source showing x (cross mark), even no plotting with nan.
echo ""Mbps:In/Out $TOTALIN / $TOTALOUT" | InMbps=$TOTALIN OutMbps=$TOTALOUT"
exit 0
Broke into two /usr/local/nagios/libexec/(all_stm16_only_in & all_stm16_only_out) , there is two graphs
echo ""InMbps $TOTALIN" | InMbps=$TOTALIN"
exit
echo ""OutMbps $TOTALOUT" | OutMbps=$TOTALOUT"
exit
Regards
Re: PnP Graph with two values
Posted: Fri Feb 27, 2015 12:38 pm
by tmcdonald
I'm having a hard time visualizing the issue. Can you post screenshots of the broken graphs?
Re: PnP Graph with two values
Posted: Mon Mar 02, 2015 2:17 pm
by zaji_nms
Dear tmcdonald
There is something wrong, me removed re-added same issue, however you close the case as me renamed the script, removed the slash (/) , longer name make shorter and somehow its working (graph coming), if bother to much, I will report you via this Forum.
Me opening another post/thread (so in future will help others to open correct post when anyone search) and will put my very basic script.
Regards
Re: PnP Graph with two values
Posted: Mon Mar 02, 2015 6:00 pm
by abrist
zaji_nms wrote:however you close the case as me renamed the script
Fair enough.
EDIT: Just to add the link to the new thread:
http://support.nagios.com/forum/viewtop ... 16&t=31648