Hi,
I'm currently having an issue with External check item. I've written a perl script to ping my hosts in mpls vrf.
When i call it from zabbix as an External check type i have the following error messages:
sh: /etc/zabbix/externalscripts/sw_ping.pl: Permission denied
Item [test:sw_ping.pl[172.17.148.182,xyz,password,VRF-182-TEST1, 192.168.15.16]]error: Script /etc/zabbix/externalscripts/sw_ping.pl returned nothing.
Although the script has correct permission(-rwxrwxrwx 1 root zabbix 1267 May 5 06:57 sw_ping.pl) i can't figure out this problem.
Here are the parameters of my item:
Host:test
Description: switch ping
Type: External check
Key:sw_ping.pl[172.17.148.182,xyz,password,VRF-182-TEST1, 192.168.15.16]
My script do the following:
1) login to a router via telnet
2) do a ping vrf
3) return 1(when ping successes) or 0 (unsuccessful)
Here is my script:
#!/usr/bin/perl
if ($#ARGV != 4) {
print "usage: ip useer pwd vf host";
exit;
}
use strict;
use warnings;
use Net::Telnet::Cisco;
my $ip= $ARGV[0];
my $user= $ARGV[1];
my $pwd= $ARGV[2];
my $vf= $ARGV[3];
my $host= $ARGV[4];
my $result =0;
my $session = Net::Telnet::Cisco->new(Host => $ip);
$session->login($user, $pwd);
# Execute the ping command
my @output = $session->cmd("ping vrf $vf $host");
# print @output;
my $info ="";
foreach $info (@output) {
chomp($info);
#print $info;
if ($info =~ /Success rate is 100/) {
$result=1; #print "-ok";
}
else{
$result=0; #print"-nok";
}
#print "\n";
}
#print "\n";
print $result;
$session->close;
How to resolve it?
Any suggestions would be appreciated.
Many Thanks
Mike13
I'm currently having an issue with External check item. I've written a perl script to ping my hosts in mpls vrf.
When i call it from zabbix as an External check type i have the following error messages:
sh: /etc/zabbix/externalscripts/sw_ping.pl: Permission denied
Item [test:sw_ping.pl[172.17.148.182,xyz,password,VRF-182-TEST1, 192.168.15.16]]error: Script /etc/zabbix/externalscripts/sw_ping.pl returned nothing.
Although the script has correct permission(-rwxrwxrwx 1 root zabbix 1267 May 5 06:57 sw_ping.pl) i can't figure out this problem.
Here are the parameters of my item:
Host:test
Description: switch ping
Type: External check
Key:sw_ping.pl[172.17.148.182,xyz,password,VRF-182-TEST1, 192.168.15.16]
My script do the following:
1) login to a router via telnet
2) do a ping vrf
3) return 1(when ping successes) or 0 (unsuccessful)
Here is my script:
#!/usr/bin/perl
if ($#ARGV != 4) {
print "usage: ip useer pwd vf host";
exit;
}
use strict;
use warnings;
use Net::Telnet::Cisco;
my $ip= $ARGV[0];
my $user= $ARGV[1];
my $pwd= $ARGV[2];
my $vf= $ARGV[3];
my $host= $ARGV[4];
my $result =0;
my $session = Net::Telnet::Cisco->new(Host => $ip);
$session->login($user, $pwd);
# Execute the ping command
my @output = $session->cmd("ping vrf $vf $host");
# print @output;
my $info ="";
foreach $info (@output) {
chomp($info);
#print $info;
if ($info =~ /Success rate is 100/) {
$result=1; #print "-ok";
}
else{
$result=0; #print"-nok";
}
#print "\n";
}
#print "\n";
print $result;
$session->close;
How to resolve it?
Any suggestions would be appreciated.
Many Thanks
Mike13
Comment