Xymon custom graph config: Difference between revisions
Jump to navigation
Jump to search
(Created page with "===collect the data with a script=== hobbit server:/usr/lib/hobbit/client/ext/cputemp: <pre> #!/bin/sh #/usr/bin/sensors -f | grep "CPU Temp" | awk '{print $1 $2 $3}' | # awk {'…") |
No edit summary |
||
Line 33: | Line 33: | ||
exit 0 | exit 0 | ||
</pre> | </pre> | ||
* you can run the script from the command line to test it | |||
===launch the script with hobbit=== | |||
hobbit server:/usr/lib/hobbit/server/etc/hobbitlaunch.cfg: | |||
<pre> | |||
[cputemp] | |||
ENVFILE /usr/lib/hobbit/client/etc/hobbitclient.cfg | |||
CMD /usr/lib/hobbit/client/ext/cputemp | |||
INTERVAL 5m | |||
</pre> | |||
hobbit client:/usr/lib/hobbit/client/etc/hobbitlaunch.cfg | |||
* wait for five minutes and then you should see the data in the web interface, but not the graph | |||
===collect the data in an RRD=== | |||
hobbit server:/usr/lib/hobbit/server/etc/hobbitserver.cfg | |||
<pre> | |||
TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,cputemp=ncv,heater=ncv" | |||
</pre> | |||
<pre> | |||
NCV_cputemp="temp1:GAUGE,Core0Temp:GAUGE,Core1Temp:GAUGE" | |||
</pre> | |||
*restart hobbit after making these changes | |||
* you can verify the RRD: | |||
hobbit server:/var/lib/hobbit/rrd/localhost/cputemp.rrd | |||
<pre> | |||
root@weasel:/var/lib/hobbit/rrd/localhost# rrdtool info ./cputemp.rrd | |||
filename = "./cputemp.rrd" | |||
rrd_version = "0003" | |||
step = 300 | |||
last_update = 1311266629 | |||
header_size = 2320 | |||
ds[temp1].index = 0 | |||
ds[temp1].type = "GAUGE" | |||
ds[temp1].minimal_heartbeat = 600 | |||
ds[temp1].min = NaN | |||
ds[temp1].max = NaN | |||
ds[temp1].last_ds = "131" | |||
ds[temp1].value = 2.9999000000e+04 | |||
ds[temp1].unknown_sec = 0 | |||
root@weasel:/var/lib/hobbit/rrd/localhost# ls -lt cputemp.rrd | |||
-rw-r--r-- 1 hobbit hobbit 57616 2011-07-21 09:43 cputemp.rrd | |||
</pre> | |||
The timestamp on the file should be less than 5 minutes old and the data inside should correspond to the output of the script. | |||
===create a graph definition=== |
Revision as of 16:53, 21 July 2011
collect the data with a script
hobbit server:/usr/lib/hobbit/client/ext/cputemp:
#!/bin/sh #/usr/bin/sensors -f | grep "CPU Temp" | awk '{print $1 $2 $3}' | # awk {'sub("\+", ""); sub("°F", ""); print }' > /tmp/cputemp.txt #/usr/bin/sensors -f | grep -i temp | grep -v k8temp| awk '{ sub("°F", ""); sub("\+", ""); sub("/", ""); sub(" +", ""); sub("\(.*$", ""); print}' > /tmp/cputemp.txt RAWTEMP=`nvidia-smi -a | grep Temperature | sed -e "s/.*.://g" -e "s/C//g"` FGPUTEMP=$((${RAWTEMP:-0}*9/5+32)) echo "temp1:$FGPUTEMP" > /tmp/cputemp.txt /usr/bin/sensors -f | grep Temp | grep -v k8temp | awk '{sub(".F.*$", ""); sub(" +",""); sub("+",""); print}' >> /tmp/cputemp.txt RESULT=`grep Core0Temp /tmp/cputemp.txt | awk '{ FS=":"; print int($2) }'`; COLOR=green if test "$RESULT" -gt 120 then COLOR=red fi if test "$RESULT" -lt 70 then COLOR=red fi $BB $BBDISP "status $MACHINE.cputemp $COLOR `date` `cat /tmp/cputemp.txt` " exit 0
- you can run the script from the command line to test it
launch the script with hobbit
hobbit server:/usr/lib/hobbit/server/etc/hobbitlaunch.cfg:
[cputemp] ENVFILE /usr/lib/hobbit/client/etc/hobbitclient.cfg CMD /usr/lib/hobbit/client/ext/cputemp INTERVAL 5m
hobbit client:/usr/lib/hobbit/client/etc/hobbitlaunch.cfg
- wait for five minutes and then you should see the data in the web interface, but not the graph
collect the data in an RRD
hobbit server:/usr/lib/hobbit/server/etc/hobbitserver.cfg
TEST2RRD="cpu=la,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,files,procs=processes,ports,clock,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,if_load=devmon,temp=devmon,paging,mdc,mdchitpct,cics,dsa,getvis,maxuser,nparts,cputemp=ncv,heater=ncv"
NCV_cputemp="temp1:GAUGE,Core0Temp:GAUGE,Core1Temp:GAUGE"
- restart hobbit after making these changes
- you can verify the RRD:
hobbit server:/var/lib/hobbit/rrd/localhost/cputemp.rrd
root@weasel:/var/lib/hobbit/rrd/localhost# rrdtool info ./cputemp.rrd filename = "./cputemp.rrd" rrd_version = "0003" step = 300 last_update = 1311266629 header_size = 2320 ds[temp1].index = 0 ds[temp1].type = "GAUGE" ds[temp1].minimal_heartbeat = 600 ds[temp1].min = NaN ds[temp1].max = NaN ds[temp1].last_ds = "131" ds[temp1].value = 2.9999000000e+04 ds[temp1].unknown_sec = 0 root@weasel:/var/lib/hobbit/rrd/localhost# ls -lt cputemp.rrd -rw-r--r-- 1 hobbit hobbit 57616 2011-07-21 09:43 cputemp.rrd
The timestamp on the file should be less than 5 minutes old and the data inside should correspond to the output of the script.