check_amanda with nsca
Thomas Ginestet
thomas.ginestet at gpsa.fr
Mon Jul 2 11:31:25 CEST 2007
Thomas Ginestet a écrit :
> Hi list,
>
> I would like to use the plugin check_amanda (a python script) with nsca
> but it doesn't seem to work:
> In the client side, here is the output:
> echo "backup;check_amanda;return_code;`./check_amanda`" |
> /usr/sbin/send_nsca -H serverIP -d ";" -to 500 -c /etc/nagios/send_nsca.cfg
> 1 data packet(s) sent to host successfully.
>
> In the server side, here is the output (/var/log/syslog):
> Jun 19 15:30:22 nagios nsca[8621]: connect from backup (clientIP)
> Jun 19 15:30:22 nagios nsca[8621]: Handling the connection...
> Jun 19 15:32:07 nagios nsca[8621]: Dropping packet with stale timestamp
> - packet was 105 seconds old.
>
> With the others plugins like check_users, check_imap, check_http, etc it
> can works:
> client side:
> echo "backup;check_http;return_code;`./check_http -H serverIP`" |
> /usr/sbin/send_nsca -H servIP -d ";" -to 1000 -c /etc/nagios/send_nsca.cfg
> 1 data packet(s) sent to host successfully.
>
> server side:
> Jun 19 15:42:26 nagios nsca[11212]: connect from backup (192.168.6.36)
> Jun 19 15:42:26 nagios nsca[11212]: Handling the connection...
> Jun 19 15:42:26 nagios nsca[11212]: SERVICE CHECK -> Host Name:
> 'backup', Service Description: 'check_http', Return Code: '0', Output:
> 'OK - HTTP/1.1 302 Found - 0.126 second response time
> |time=0.125801s;;;0.000000 size=484B;;;0'
> Jun 19 15:42:26 nagios nsca[11212]: End of connection...
>
> check_amanda works fine if manually launched:
> backup:/usr/lib/nagios/plugins# ./check_amanda
> Amanda backup for "DailySet" is ok.
>
> Check_amanda is the only python script i use with nsca, could it be the
> problem ? Does anyone use this plugin with nsca ?
>
> Thks in advance,
>
> Thomas Ginestet
>
I've solved my problem using several scripts based on check_grep
(nagios-of-plugins-0.8.3.tar.gz). Two for the amcheck (one for the label
check and one for the connection check) and one for amstatus.
In order to use nsca, you have to do a thing like this:
- a config file config.pl (usefull if you have more than one check with
nsca, useless if not):
#!/usr/bin/perl
$nsca_host="@ip";
$config="/etc/nagios/send_nsca.cfg";
$send_nsca="/usr/sbin/send_nsca -c $config -H $nsca_host";
- a perl script amstatus.pl (for example):
#!/usr/bin/perl
require "/usr/lib/nagios/plugins/config.pl";
$cmd="/usr/lib/nagios/plugins/amstatus.sh";
$hosts="backup";
$service="backup_check_status"; # you have to create this service on
the services conf file / oreon interface
$RESULT=`$cmd`;
if ($RESULT =~ /OK/) { $code = 0; }
if ($RESULT =~ /WARNING/) { $code = 1; }
if ($RESULT =~ /CRITICAL/) { $code = 2; }
open(SEND,"|$send_nsca") || die "Could not run $send_nsca: $!\n";
print SEND "$hosts\t$service\t$code\t$RESULT\n";
close SEND;
- a bash script amstatus.sh with the command to use:
#!/bin/sh
/usr/lib/nagios/plugins/check_grep "dumped : 52" --command
'amstatus DayliSet' # 52 if the number of entries in my disklist, so
you'll have to change this to suit your needs.
Then, add the amstatus.pl to the crontab
Hope this help
Thomas
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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