[Nagios-devel] check_nagios.pl
Posted: Mon May 31, 2004 2:20 pm
--_=__=_XaM3_.1086041670.2A.656901.42.2039.52.42.007.998719202
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
hi there,
for a long time with no response here,
today, someone repor=
ted to me a little
bug in my plugin (check_nagios.pl) of
nagios.
He=
re it is:
The version on today's CVS, have the
line 37 as shown:
=0D
=
the file I refer to at the CVS is this
(version 1.1.1.1):
http://cvs.=
sourceforge.net/viewcvs.py/*checkout*/nagiosplug/nagiosplug/contrib/check=
_nagios.pl?content-type=3Dtext%2Fplain&rev=3D1.1.1.1
$mon_now+=3D1; $y=
ea_now+=3D1900;
but the correct is:
$mon=3D$mon-1; $yea_now+=3D1900;=0D
=
I'm sending the corrected file attached.
If there is another way to =
commit the
fix, please let me know.
Thank you in advance, and
congra=
tulations for the great work.
--
Denis Almeida Vieira Jr - Systems En=
gineer
Universo Online - UOL -
http://www.uol.com.br
=0A =0A__________=
________________________________________________________________=0AAcabe =
com aquelas janelinhas que pulam na sua tela.=0AAntiPop-up UOL - =C9 gr=E1=
tis!=0Ahttp://antipopup.uol.com.br/=0A
--_=__=_XaM3_.1086041670.2A.656901.42.2039.52.42.007.998719202
Content-Type: text/x-perl;
name="=?iso-8859-1?Q?check=5Fnagios.pl?="
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="=?iso-8859-1?Q?check=5Fnagios.pl?="
#!/usr/bin/perl=0A# denao - [email protected] - Systems Engineer=0A# Unive=
rso Online - http://www.uol.com.br =0Ause DBI;=0Ause Time::Local;=0A=0Amy=
$t_lambuja =3D 5; # (expire_minutes)=0Amy $databasename =3D ""=
; # The name of nagios database (i.e.: nagios)=0Amy $table =3D "pro=
gramstatus";=0Amy $where =3D "localhost"; # The machine where the dat=
abase=0Amy $port =3D "3306";=0Amy $base =3D "DBI:mysql:$databasename:$whe=
re:$port";=0Amy $user =3D ""; # the user to connect to the =
database =0A # (needs permission to "select a=
t programstatus table only"=0Amy $password =3D ""; # the passwo=
rd (if any)=0Amy %results;=0Amy @fields =3D qw( last_update );=0Amy $dbh =
=3D DBI->connect($base,$user,$password);=0Amy $fields =3D join(', ', @fie=
lds);=0Amy $query =3D "SELECT $fields FROM $table";=0Amy $VERSION =3D "1.=
1.1.2";=0A=0Amy $sth =3D $dbh->prepare($query);=0A$sth->execute();=0A=0A@=
results{@fields} =3D ();=0A$sth->bind_columns(map { \$results{$_} } @fiel=
ds);=0A=0A$sth->fetch();=0A$sth->finish();=0A$dbh->disconnect();=0A=0Ache=
ck_update();=0A=0Asub check_update {=0A($yea,$mon,$day,$hou,$min,$sec)=3D=
($results{last_update}=3D~/(\d+)\-(\d+)\-(\d+)\s(\d+)\:(\d+)\:(\d+)/);=0A=
($sec_now, $min_now, $hou_now, $day_now, $mon_now, $yea_now) =3D (localti=
me(time))[0,1,2,3,4,5];=0A$mon=3D$mon-1;$yea_now+=3D1900;=0A$unixdate=3Dt=
imelocal($sec,$min,$hou,$day,$mon,$yea);=0A$unixdate_now=3Dtimelocal($sec=
_now,$min_now,$hou_now,$day_now,$mon_now,$yea_now);=0A if (scalar($unix=
date_now - $unixdate) > scalar($t_lambuja * 60)) {=0A print "Nagios=
problem: nagios is down, for at least " . scalar($t_lambuja) . " minutes=
.\n";=0A exit(1);=0A } else {=0A print "Nagios ok: status d=
ata updated " . scalar($unixdate_now - $unixdate) . " seconds ago\n";=0A =
exit(0);=0A }=0A}=0A
--_=__=_XaM3_.1086041670.2A.656901.42.2039.52.42.007.998719202--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
hi there,
for a long time with no response here,
today, someone repor=
ted to me a little
bug in my plugin (check_nagios.pl) of
nagios.
He=
re it is:
The version on today's CVS, have the
line 37 as shown:
=0D
=
the file I refer to at the CVS is this
(version 1.1.1.1):
http://cvs.=
sourceforge.net/viewcvs.py/*checkout*/nagiosplug/nagiosplug/contrib/check=
_nagios.pl?content-type=3Dtext%2Fplain&rev=3D1.1.1.1
$mon_now+=3D1; $y=
ea_now+=3D1900;
but the correct is:
$mon=3D$mon-1; $yea_now+=3D1900;=0D
=
I'm sending the corrected file attached.
If there is another way to =
commit the
fix, please let me know.
Thank you in advance, and
congra=
tulations for the great work.
--
Denis Almeida Vieira Jr - Systems En=
gineer
Universo Online - UOL -
http://www.uol.com.br
=0A =0A__________=
________________________________________________________________=0AAcabe =
com aquelas janelinhas que pulam na sua tela.=0AAntiPop-up UOL - =C9 gr=E1=
tis!=0Ahttp://antipopup.uol.com.br/=0A
--_=__=_XaM3_.1086041670.2A.656901.42.2039.52.42.007.998719202
Content-Type: text/x-perl;
name="=?iso-8859-1?Q?check=5Fnagios.pl?="
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="=?iso-8859-1?Q?check=5Fnagios.pl?="
#!/usr/bin/perl=0A# denao - [email protected] - Systems Engineer=0A# Unive=
rso Online - http://www.uol.com.br =0Ause DBI;=0Ause Time::Local;=0A=0Amy=
$t_lambuja =3D 5; # (expire_minutes)=0Amy $databasename =3D ""=
; # The name of nagios database (i.e.: nagios)=0Amy $table =3D "pro=
gramstatus";=0Amy $where =3D "localhost"; # The machine where the dat=
abase=0Amy $port =3D "3306";=0Amy $base =3D "DBI:mysql:$databasename:$whe=
re:$port";=0Amy $user =3D ""; # the user to connect to the =
database =0A # (needs permission to "select a=
t programstatus table only"=0Amy $password =3D ""; # the passwo=
rd (if any)=0Amy %results;=0Amy @fields =3D qw( last_update );=0Amy $dbh =
=3D DBI->connect($base,$user,$password);=0Amy $fields =3D join(', ', @fie=
lds);=0Amy $query =3D "SELECT $fields FROM $table";=0Amy $VERSION =3D "1.=
1.1.2";=0A=0Amy $sth =3D $dbh->prepare($query);=0A$sth->execute();=0A=0A@=
results{@fields} =3D ();=0A$sth->bind_columns(map { \$results{$_} } @fiel=
ds);=0A=0A$sth->fetch();=0A$sth->finish();=0A$dbh->disconnect();=0A=0Ache=
ck_update();=0A=0Asub check_update {=0A($yea,$mon,$day,$hou,$min,$sec)=3D=
($results{last_update}=3D~/(\d+)\-(\d+)\-(\d+)\s(\d+)\:(\d+)\:(\d+)/);=0A=
($sec_now, $min_now, $hou_now, $day_now, $mon_now, $yea_now) =3D (localti=
me(time))[0,1,2,3,4,5];=0A$mon=3D$mon-1;$yea_now+=3D1900;=0A$unixdate=3Dt=
imelocal($sec,$min,$hou,$day,$mon,$yea);=0A$unixdate_now=3Dtimelocal($sec=
_now,$min_now,$hou_now,$day_now,$mon_now,$yea_now);=0A if (scalar($unix=
date_now - $unixdate) > scalar($t_lambuja * 60)) {=0A print "Nagios=
problem: nagios is down, for at least " . scalar($t_lambuja) . " minutes=
.\n";=0A exit(1);=0A } else {=0A print "Nagios ok: status d=
ata updated " . scalar($unixdate_now - $unixdate) . " seconds ago\n";=0A =
exit(0);=0A }=0A}=0A
--_=__=_XaM3_.1086041670.2A.656901.42.2039.52.42.007.998719202--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]