syslog-ng stuff
Williams, P. Lane
Lane.Williams at jhuapl.edu
Wed Sep 24 17:59:08 CEST 2003
Sorry for the repost.
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";
}
}
-------------------------------------------------------
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