cookbook-zabbix/files/default/traps/scripts/check_mongo2
2017-02-07 01:02:03 -05:00

17 lines
361 B
Text

#/usr/bin/python
import sys
import urllib
import simplejson
f = urllib.urlopen("http://127.0.0.1:28017/_status" )
data=simplejson.loads(f.read())
condition=data[sys.argv[1]][sys.argv[2]]
if len(sys.argv) == 5:
print condition [sys.argv[3]] [sys.argv[4]]
elif len(sys.argv) == 4:
print condition [sys.argv[3]]
else:
print condition