Skip to content

Instantly share code, notes, and snippets.

View ravnx's full-sized avatar

Michael Palmer ravnx

  • Houston, TX
  • 19:04 (UTC -05:00)
View GitHub Profile
@ravnx
ravnx / status2json.py
Last active August 20, 2022 18:46 — forked from alexwright/status2json.py
Parse the Nagios status.dat and poop out some JSON
#!/usr/bin/python3
"""
This script will dump host stats from your Nagios4 status.dat as JSON.
You can put this in your /usr/lib/cgi-bin/nagios4 directory and chmod +x this file,
then, to access it remotely use python requests:
r = requests.get('https://nagiosinstall-location.com/nagios4/cgi-bin/status2json.py', auth=HTTPDigestAuth(user,pass))
print(r.json())
You might need to add .py to your http.conf cgi handlers.