Hi,
I have a Agent-Problem on my new Zabbix-Server:
Zabbix 2.2.4 / Agent 2.2.4
CentOS 6.5 x86_64
Perl 5.10.1 x86_64
MySQL 5.1.73 x86_64
----------
I want to use external scripts, like "mail-server-check".
But if I start the Agent, following error appears:
Starting Zabbix agent: zabbix_agentd [8158]: invalid entry [use warnings;] (not following "parameter=value" notation) in config file [/etc/zabbix/zabbix_agentd.d//smtp.check.pl], line 3
Here's the script (smtp.check.pl):
--------------
#!/usr/bin/perl
use warnings;
use Net::SMTP;
sub controll;
close STDERR;
open(STDERR, '>',\$debug_out);
# Connect to the mailserver
$smtp = Net::SMTP->new($ARGV[0],Debug=>1,Timeout=>20) or ( print 'CONNECTION FAILED' );
controll();
# Try if mailserver would accept a mail FROM a given address
# if second paramter is a FROM mailadress
if( $ARGV[1] =~ /@.*\.[a-z]/)
{
$smtp->mail($ARGV[1]);
controll();
# Try if mailserver would accept a mail FOR a given address
# if third paramter is a TO mailadress
if( $ARGV[2] =~ /@.*\.[a-z]/)
{
$smtp->to($ARGV[2]);
controll();
}
}
$smtp->quit();
print $result."\n";
sub controll
{
if( $smtp->ok() == 1 )
{
$result = "OK";
}
else
{
$debug_out = ((split /\n/ , $debug_out)[-1]);
$debug_out = ((split /<<< /, $debug_out)[-1]);
print $debug_out."\n";
exit;
}
}
--------------
If I start the script at the console, it works correct:
[root@server]# ./smtp.check.pl localhost
OK
I´ve also that Problem with all other external Zabbix-Scripts from the web.
Thanks for your replay,
emvectra
I have a Agent-Problem on my new Zabbix-Server:
Zabbix 2.2.4 / Agent 2.2.4
CentOS 6.5 x86_64
Perl 5.10.1 x86_64
MySQL 5.1.73 x86_64
----------
I want to use external scripts, like "mail-server-check".
But if I start the Agent, following error appears:
Starting Zabbix agent: zabbix_agentd [8158]: invalid entry [use warnings;] (not following "parameter=value" notation) in config file [/etc/zabbix/zabbix_agentd.d//smtp.check.pl], line 3
Here's the script (smtp.check.pl):
--------------
#!/usr/bin/perl
use warnings;
use Net::SMTP;
sub controll;
close STDERR;
open(STDERR, '>',\$debug_out);
# Connect to the mailserver
$smtp = Net::SMTP->new($ARGV[0],Debug=>1,Timeout=>20) or ( print 'CONNECTION FAILED' );
controll();
# Try if mailserver would accept a mail FROM a given address
# if second paramter is a FROM mailadress
if( $ARGV[1] =~ /@.*\.[a-z]/)
{
$smtp->mail($ARGV[1]);
controll();
# Try if mailserver would accept a mail FOR a given address
# if third paramter is a TO mailadress
if( $ARGV[2] =~ /@.*\.[a-z]/)
{
$smtp->to($ARGV[2]);
controll();
}
}
$smtp->quit();
print $result."\n";
sub controll
{
if( $smtp->ok() == 1 )
{
$result = "OK";
}
else
{
$debug_out = ((split /\n/ , $debug_out)[-1]);
$debug_out = ((split /<<< /, $debug_out)[-1]);
print $debug_out."\n";
exit;
}
}
--------------
If I start the script at the console, it works correct:
[root@server]# ./smtp.check.pl localhost
OK
I´ve also that Problem with all other external Zabbix-Scripts from the web.
Thanks for your replay,
emvectra
Comment