[Xymon] Patch for including directories in hosts.cfg

Francois Claire fclaire at free.fr
Wed Mar 30 19:37:24 CEST 2016


Hi Paul,




Nice !  I always work around this limitation of devmon by putting all my 
snmp devices altogether in a single config file under /etc/xymon/hosts.d/

Maybe you could submit this patch to the devmon-devel mailing list ? 
Devmon project has been quite active over the last weeks, maybe we'll 
get a new -beta- version one day...



Cheers,
Francois.


Le 29/03/2016 18:16, Root, Paul T a écrit :
>
> Hi,
>
>                 I just reorganized my xymon hosts.cfg to use 
> directories to better organize my machines.  I completely forgot 
> devmon –readbbhosts.
>
>                 So I made a quick change to dm_config.pm to pick up 
> *.cfg files in directories.
>
> *** dm_config.pm        Tue Mar 29 10:35:58 2016
>
> --- /usr/local/devmon/modules/dm_config.pm      Fri Jan 23 09:41:27 2009
>
> ***************
>
> *** 1267,1274 ****
>
>             next FILEREAD;
>
>         }
>
> - #       print "working on $bbfile\n";
>
> -
>
>        # Now interate through our file and suck out the juicy bits
>
>         FILELINE: while ( my $line= <BBFILE> ) {
>
>           chomp $line;
>
> --- 1267,1272 ----
>
> ***************
>
> *** 1287,1311 ****
>
>             push @bbfiles, $file;
>
>           }
>
> -          # Check for directory includes
>
> -               if($line =~ /^\s*(?:disp|net)?directory\s+(.+)$/i) {
>
> -                       my $directory = $1;
>
> -                  # Tack on our etc dir if this isn’t an absolute path
>
> -                       $directory = "$etcdir/$directory" if 
> $directory !~ /^\//;
>
> -      #                 print "reading $directory\n";
>
> -
>
> -                  # Add the file to our read array
>
> -               opendir (DIR, $directory) || warn "Cannot open 
> $directory\n";
>
> -                       my $file;
>
> -                       while ($file = readdir (DIR)) {
>
> -                          # I name all config files with a .cfg
>
> -                               if (grep (/\.cfg/, $file)) {
>
> - push @bbfiles, $directory . '/' . $file;
>
> -                               }
>
> -                       }
>
> -                       close (DIR);
>
> -               }
>
> -
>
>          # Else see if this line matches the ip/host bb-hosts format
>
>           elsif($line =~ /^\s*(\d+\.\d+\.\d+\.\d+)\s+(\S+)(.*)$/i) {
>
>             my ($ip, $host, $bbopts) = ($1, $2, $3);
>
> --- 1285,1290 ----
>
> Devmon version 0.3.1-beta1.
>
> *Paul Root*
>
> Lead Engineer
>
> CenturyLink Network Reliability Operations Center
>
> 390 Commerce Dr
>
> Woodbury, MN 55125
>
> Direct: (651)312-5207
>
> Paul.Root at centurylink.com
>
> This communication is the property of CenturyLink and may contain 
> confidential or privileged information. Unauthorized use of this 
> communication is strictly prohibited and may be unlawful. If you have 
> received this communication in error, please immediately notify the 
> sender by reply e-mail and destroy all copies of the communication and 
> any attachments.
>
>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20160330/a394aeb5/attachment.html>


More information about the Xymon mailing list