syslog-ng stuff

Williams, P. Lane willipl1 at jhuapl.edu
Wed Sep 24 16:50:35 CEST 2003


On Wed, 2003-09-24 at 09:59, Williams, P. Lane wrote:
For those interested.  I currently use a combination of Event Sentry and
Syslog-ng for Microsoft Eventlog Monitoring.  To make my job a little
easier I wrote a little PERL script that would generate the syslog-ng
configuration data for me.  I prepend all of my Microsoft hostgroups
with "Microsoft", so it makes the pattern matching a little easier.  

Here's the script, I apologize up front for the email program messing up
the format of the script:

#!/usr/bin/perl

open (LOG, "/usr/local/nagios/etc/hostgroups.cfg") or die "You either do
not have rights or the log file does not exist:$! \n";

while (<LOG>) {
       if (/hostgroup_name/ && /Microsoft/) {
           $begin = 1;
                }
        if ($begin) {
              if (/members/) {
                    $members = $_;
                    ($m1,$m2) = split ' ',$members;
                    $hosts = "$m2,";
                    $hosts =~ s/,/ /g;
                    push (@hosts, split ' ',$hosts);
                    $end ++;
                    if ($end) {
                               $begin = 0;
                               $end = 0;}
                }
        }

}
close LOG;
  foreach $entry(@hosts){
     @name = `ping $entry -c 1 | grep "64 bytes from" | awk {'print
\$4'}`;
     chomp @name;
     foreach $x (@name){
         $x =~ s/\.\w+//g;
         print "######## $x syslog-ng definition ########\n";
         print "filter $entry \{ host (\"$x\")\;\}\;","\n";
         print "destination
$entry\{file(\"/var/log/syslog-ng/$entry\")\;\}\;","\n";
         print "log \{source(net)\; filter($entry)\; destination
($entry)\;\}\;","\n\n";
       }
   }


> For those interested.  I had a request to add a simple host search to
> the
> Nagios side bar.  I thought that someone else may find use in it.  I
> added
> the snippet (below) to the end of the side.html file under
> ~nagios/share/
> before </BODY></HTML>.
> 
> Lane
> 
> <FORM ACTION="/nagios/cgi-bin/status.cgi" target="main"
> class="NavBarItem"
> METHOD="GET">
> <p>
> <table width="150" border="0">
>   <tr>
>     <td><a class="NavBarItem">Host Search</a></td>
>   </tr>
> </table>
>    <INPUT TYPE="TEST" NAME="host"><br>
>    <INPUT TYPE="SUBMIT" VALUE="Search">
> </p>
> </FORM>
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
> reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null
> 



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list