I scrapped my previous method in perl and decided to make a few assumptions about the logs always being in the same order. So here's what I did to get this running on Xymon.
Placed a shell script in ~xymon/client/ext/ called fps.sh
Code: Select all
#!/bin/bash
$BB $BBDISP "status $MACHINE.fps green `date`
cam1 : `tail -250 /var/log/messages | awk \"/Capturing/ && /Foscam/ {print \\$12}\" | tail -1`
cam2 : `tail -250 /var/log/messages | awk \"/Capturing/ && /CiscoPTZ/ {print \\$12}\" | tail -1`
cam3 : `tail -250 /var/log/messages | awk \"/Capturing/ && /Trendnet/ {print \\$12}\" | tail -1`
"
exit 0
Obviously your camera names will vary. Mine are named after the models since this is a mobile demo system.
Then add to ~xymon/client/etc/clientlaunch.cfg :
Code: Select all
[fps]
ENVFILE /usr/lib64/xymon/client/etc/hobbitclient.cfg
CMD /usr/lib64/xymon/client/ext/fps.sh
LOGFILE $HOBBITCLIENTHOME/logs/fps.log
INTERVAL 3m
You might want to make the interval longer or shorter. And of course your paths will vary for your xymon client installation.
At this point you want to restart the client and make sure the xymon web server is showing the new column and data.
Now go into the server CLI and modify the /etc/xymon/hobbitserver.cfg and add this to the end of the TEST2RRD line: fps=ncv
Mine, with everything else as default looks like this:
Code: Select all
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,fps=ncv
Next, add another line somewhere after the TEST2RRD line in the same file:
Code: Select all
NCV_fps="cam1:GAUGE,cam2:GAUGE,cam3:GAUGE"
Go to your installation's rrd folder (/var/lib/xymon/rrd/demo.demo.com in my case) and make sure you see fps.rrd showing up. If not, look for errors in the rrd log files within the /var/log/xymon dir.
Now, setup the graphs in /etc/xymon/hobbitgraph.cfg. Add this stanza:
Code: Select all
[fps]
TITLE FPS info
YAXIS FPS
DEF:cam1=fps.rrd:cam1:AVERAGE
DEF:cam2=fps.rrd:cam2:AVERAGE
DEF:cam3=fps.rrd:cam3:AVERAGE
LINE2:cam1#00CCCC:cam1 FPS
LINE2:cam2#FF0000:cam2 FPS
LINE2:cam3#FF00FF:cam3 FPS
COMMENT:\n
GPRINT:cam1:LAST:cam1 FPS \: %5.1lf%s (cur)
GPRINT:cam1:MAX: \: %5.1lf%s (max)
GPRINT:cam1:MIN: \: %5.1lf%s (min)
GPRINT:cam1:AVERAGE: \: %5.1lf%s (avg)\n
GPRINT:cam2:LAST:cam2 FPS\: %5.1lf%s (cur)
GPRINT:cam2:MAX: \: %5.1lf%s (max)
GPRINT:cam2:MIN: \: %5.1lf%s (min)
GPRINT:cam2:AVERAGE: \: %5.1lf%s (avg)\n
GPRINT:cam3:LAST:cam3 FPS \: %5.1lf%s (cur)
GPRINT:cam3:MAX: \: %5.1lf%s (max)
GPRINT:cam3:MIN: \: %5.1lf%s (min)
GPRINT:cam3:AVERAGE: \: %5.1lf%s (avg)\n
And the last thing you might want to do is have this fps graph show up on the trends page. So go back into the /etc/xymon/hobbitserver.cfg file and add "fps" at any point in the line that looks roughly like this:
Code: Select all
GRAPHS="la,disk,inode,qtree,files,processes,memory,fps,users,vmstat,
iostat,tcp.http,tcp,ncv,netstat,ifstat,mrtg::1,ports,temperature,ntpstat,apache,
bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd,clock
,lines,ops,stats,cifs,JVM,JMS,HitCache,Session,JDBCConn,ExecQueue,JTA,TblSpace
,RollBack,MemReq,InvObj,snapmirr,snaplist,snapshot,devmon::1,if_load::1,temp"
The order of the placement is reflected in the order of the graphs on the trends page. Notice how I put mine in as the 8th item in the list since I wanted it near the top.
And, obviously, everywhere that I have the "cam1" through "cam3" setup, you can keep adding cams in there. Don't forget to change the color in the graphing or it will get ugly down the road.
And I think that's all.