Nagios Events

Albertus7 years ago

Good Day

I made a few nagios codes to monitor trackers, but cant seem to get events to show:

#!/usr/bin/env python

import json
import sys
import requests 

uid = (sys.argv[1])
url = 'http://myurl.co.za'
user = 'admin'
password = 'password'

payload = {'id': uid}
headers = {'content-type': 'application/json'}
response = requests.get(url + ':8082/api/events', auth=(user, password), params=payload, headers=headers, timeout=5.000)
data = json.loads(response.content)
print data

What am i doing wrong?

Thank You

Albertus Geyser

Anton Tananaev7 years ago

You should probably explain what uid is.

Albertus7 years ago

Event id in this case.

Anton Tananaev7 years ago

You should probably read documentation more carefully:

https://www.traccar.org/api-reference/