From: Buchan M. <bg...@st...> - 2011-01-24 15:21:41
|
On Sunday, 19 December 2010 15:10:13 Nelis, Wim wrote: > Hello, > > Below are a number of modifications to Devmon, which are in use here for > almost a year. I think that some of them are usefull to other DEVMON users > as well. > > A- In revision 118 the option is introduced to format the date/time shown > in the header of each message like Xymon does. However, the date/time of > the "dm" status message was forgotten. > > Index: dm_msg.pm > =================================================================== > --- dm_msg.pm (revision 3) > +++ dm_msg.pm (revision 5) > @@ -21,6 +21,7 @@ > # Modules > use strict; > use Socket; > + use POSIX qw/ strftime /; > use dm_config; > > # Our global variable hash > @@ -212,7 +213,8 @@ > # Add the header > my $host = $g{'nodename'}; > $host =~ s/\./,/g; # Dont forget our FQDN stuff > - $message = "status $host.dm $color ".(scalar > localtime)."\n\n$message\n"; + my $now = $g{'bbdateformat'} ? > strftime($g{'bbdateformat'},localtime) : scalar(localtime); + $message > = "status $host.dm $color $now\n\n$message\n"; > > return $message; In r207. > B- There is no trend-information about the run-time of devmon itself. The > following patch does send the run-time as an NCV to Xymon. In Xymon > additional changes are needed to capture and display these statistics. I have wanted to add some statistics, but I am not quite sure what I want there yet. For example, with the information supplied on forks in svn, it might be better to graph the number of devices polled by each fork, in which case the devmon collector might be better. Let me think some about this one before applying ... > Index: dm_msg.pm > =================================================================== > --- dm_msg.pm (revision 5) > +++ dm_msg.pm (revision 6) > @@ -210,6 +210,15 @@ > $message .= "&red $stalledforks forks of $g{'numforks'} are > stalled\n"; } > > + # Replace each ":" and "=" by their equivalent HTML escape charater, 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 > > C- The speed of a Gigabit interface is shown as "1000 Mbps". I prefer it to > be shown as "1.00 Gbps". Applied in r208. > Index: dm_tests.pm > =================================================================== > --- dm_tests.pm (revision 6) > +++ dm_tests.pm (revision 7) > @@ -1141,7 +1141,7 @@ > > # Get largest speed type > my $speed = 1; # Start low: 1 bps > - $speed *= 1000 while $bps > ($speed * 1000); > + $speed *= 1000 while $bps >= ($speed * 1000); > my $unit = $speeds{$speed}; > > # Measure to 2 decimal places > @@ -1161,7 +1161,7 @@ > > # Get largest speed type > my $speed = 1; # Start low: 1 bps > - $speed *= 1000 while $bps > ($speed * 1000); > + $speed *= 1000 while $bps >= ($speed * 1000); > my $unit = $speeds{$speed}; > > # Measure to 2 decimal places > > D- In function read_tansforms_file the check on transform 'index' is moved. > The transform checks are now in sorted order. I moved it around r205 or r206. Thanks for the contributions. Regards, Buchan |