Created
August 25, 2015 14:33
-
-
Save ujuc/051277d419577be8f6f7 to your computer and use it in GitHub Desktop.
Zabbix Ping check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UserParameter=ping_check[*], /etc/zabbix/ping_check.py $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
import os | |
import sys | |
import subprocess as sub | |
ping_ip = sys.argv[1] | |
response = sub.call(['ping', '-c', '1', '-W', '1', '{}'.format(ping_ip)}, stdout=open(os.devnull, 'wb')) | |
if response == 0: | |
print 'UP' | |
else: | |
print 'DOWN' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
syntax error : '{}'.format(ping_ip)} <- should be ']'
syntax error 2 : print 'UP' <- should be print('UP')