Xymon Mailing List Archive search

Patch for including directories in hosts.cfg

list Paul Root
Tue, 29 Mar 2016 16:16:20 +0000
Message-Id: <user-8a4062b461f1@xymon.invalid>

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
user-76fdb6883669@xymon.invalid

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.