* Refactored and added erro checking for zabbix_sender
This commit is contained in:
parent
7a7a0b765a
commit
2a34b19201
@ -2,13 +2,16 @@
|
|||||||
|
|
||||||
This is based on script found in thread https://www.zabbix.com/forum/showthread.php?t=17273
|
This is based on script found in thread https://www.zabbix.com/forum/showthread.php?t=17273
|
||||||
|
|
||||||
Tested with Zabbix 2.4 (http://www.zabbix.com/) and Backuppc v3 (http://backuppc.sourceforge.net/).
|
Tested with Zabbix 4.0 (http://www.zabbix.com/) and Backuppc v3 (http://backuppc.sourceforge.net/).
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
1. Add a line from 'sudo' file to your sudo config
|
1. Add a line from 'sudo' file to your sudo config
|
||||||
|
cp etc/sudoers.d/zabbix-backuppc /etc/sudoers.d/zabbix-backuppc
|
||||||
2. copy 'zabbix-backuppc.pl' and 'zabbix-discover-backuppc.pl' to '/usr/local/bin'
|
2. copy 'zabbix-backuppc.pl' and 'zabbix-discover-backuppc.pl' to '/usr/local/bin'
|
||||||
|
cp usr/local/bin/*.pl /usr/local/bin
|
||||||
3. make it executable with backuppc user
|
3. make it executable with backuppc user
|
||||||
|
chmod +x /usr/local/bin/*.pl
|
||||||
4. You need to have 'EnableRemoteCommands=1' in Zabbix agent config
|
4. You need to have 'EnableRemoteCommands=1' in Zabbix agent config
|
||||||
4. Import 'backuppc_zbx_export_templates.xml' into Zabbix and configure it
|
4. Import 'backuppc_zbx_export_templates.xml' into Zabbix and configure it
|
||||||
|
|
||||||
|
@ -345,7 +345,10 @@ sub zabbix_post {
|
|||||||
|
|
||||||
foreach my $server (@servers) {
|
foreach my $server (@servers) {
|
||||||
my $cmd = "zabbix_sender -z $server -p 10051 -s $zabbix_host -k $key -o '$val'";
|
my $cmd = "zabbix_sender -z $server -p 10051 -s $zabbix_host -k $key -o '$val'";
|
||||||
system("$cmd >/dev/null");
|
$cmd_result=system("$cmd >/dev/null");
|
||||||
|
if ( $cmd_result > 0 ) {
|
||||||
|
print ("Sending data failed. Try to execute the command manually to see errors (is your host correclty spelled ?)\n$cmd\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user