Skip to content

Instantly share code, notes, and snippets.

@ujuc
Created August 25, 2015 14:33
Show Gist options
  • Save ujuc/051277d419577be8f6f7 to your computer and use it in GitHub Desktop.
Save ujuc/051277d419577be8f6f7 to your computer and use it in GitHub Desktop.
Zabbix Ping check
UserParameter=ping_check[*], /etc/zabbix/ping_check.py $1
#!/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'
@ykdhan
Copy link

ykdhan commented Aug 6, 2020

syntax error : '{}'.format(ping_ip)} <- should be ']'
syntax error 2 : print 'UP' <- should be print('UP')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment