From: W.J.M. N. <ne...@nl...> - 2010-04-07 07:47:57
|
Hello, by default, Devmon statistics in Xymon will show the last runtime, as well as the average run-time of the last 5 runs. I wanted to have a graph showing the run-time of Devmon. I've made the following modifications in module dm_msg.pm: [xymon]$ diff -u dm_msg.pm.org dm_msg.pm --- dm_msg.pm.org 2009-01-22 17:42:12.000000000 +0100 +++ dm_msg.pm 2010-03-19 09:17:44.000000000 +0100 @@ -22,6 +22,7 @@ use strict; use Socket; use dm_config; + use POSIX qw/ strftime / ; # Our global variable hash use vars qw(%g); @@ -186,13 +187,21 @@ $avg_time /= $num_polls; $message .= "$avg_time seconds\n\n" . "Poll time averaged over 5 poll cycles."; - } + # Replace ":" and "=" in order not to confuse the Xymon NCV module + # Write the polling time (in HTML comment) for storage in an RRD + $message =~ s/:/:/g ; +# $message =~ s/=/=/g ; + $message .= "<!--\n" . + "PollTime : $this_poll_time\n" . + "-->" ; + # Add the header my $host = $g{'nodename'}; $host =~ s/\./,/g; # Dont forget our FQDN stuff - $message = "status $host.dm green ".(scalar localtime)."\n\n$message\n"; + my $now = $g{'bbdateformat'} ? strftime($g{'bbdateformat'},localtime) : scalar(localtime); + $message = "status $host.dm green $now\n\n$message\n"; return $message; Note that these modifications contain a second, independent enhancement as well: the timestamp of test dm has been changed to use the format specified in BBDATEFORMAT, if available. In order to get a graph, two configuration files of Xymon need some exension. In file hobbitserver.cfg, variable TEST2RRD is extended with "dm=ncv", and a new variable NCV_dm is defined: NCV_dm="*:GAUGE" File hobbitgraph.cfg needs to be extended with a graph definition, something like: [dm] TITLE , Devmon runtime YAXIS Runtime [s] DEF:time=dm.rrd:PollTime:AVERAGE LINE1:time#FF0000:Runtime GPRINT:time:MIN:Min\: %5.1lf %ss GPRINT:time:MAX:Max\: %5.1lf %ss GPRINT:time:AVERAGE:Avg\: %5.1lf %ss GPRINT:time:LAST:Cur\: %5.1lf %ss\n Regards, Wim Nelis. ******************************************************************************************************* The NLR disclaimer (http://www.nlr.nl/emaildisclaimer) is valid for NLR e-mail messages. ******************************************************************************************************* |