[prev in list] [next in list] [prev in thread] [next in thread]
List: nagios-users
Subject: Re: [Nagios-users] How to monitor Windows Scheduled Tasks?
From: Natxo Asenjo <natxo.asenjo () gmail ! com>
Date: 2009-06-30 12:49:31
Message-ID: 90f6e8270906300549k18261051hddd867183d46f3eb () mail ! gmail ! com
[Download RAW message or body]
hi,
ok, but I do not have any time to support the script, it is supplied
'as is' without license or obligations on my part. I will not answer
any questions about why it is not working for you (in case it does not
work for you).
#!perl
use strict;
use warnings;
use diagnostics;
# first run schtasks /query /fo /list /v and dump everything to a file
open (JOBS, "schtasks /query /fo list /v |") or die "couldn't exec
schtasks: $!\n";
# Counters
my $count = 0;
my @count = ();
# parse file, if string Last Result is not 0 (success), croak
while (<JOBS>) {
if (/^Last Result:\s+(.*)$/) {
# count how many jobs there are, we'll use this later
$count++;
# By type
$count[$1]++;
}
}
close JOBS;
if ($count[1]) {
warn "WARNING: problem with $count[1] scheduled jobs\n";
exit 1;
}
if ($count[0] == $count) {
warn "OK: all scheduled tasks have run fine\n";
exit 0;
}
else {
# if there is something wrong, give unkonw and errolevel 3
warn "UNKONWN: something else went wrong\n";
exit 3;
}
__END__
--
Groeten,
J.Asenjo
------------------------------------------------------------------------------
_______________________________________________
Nagios-users mailing list
Nagios-users@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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic