Closed bernardinosousa closed 2 years ago
Hi Bernardino18!
Is Basic Auth needed for getting the data from the Nagios livestatus endpoint? If so, do you have an example on how to use it?
Thanks, Fabi
Thanks for quick response! Yes, i tried with postman and worked with basic auth.
Generated code for Python - Requests
import requests
url = "https://example.com/monitoring/nagios/cgi-bin/status.cgi?host=192.168.1.1"
payload = {}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Basic GENERATED_BASE64'
}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
Ah, looks like you need the MK Livestatus plugin for Nagios: https://exchange.nagios.org/directory/Documentation/MK-Livestatus/details
Which is the endpoint this plugin talks to (and which I don't think supports auth). I'll update the README file to make this clearer.
Already found the problem. The software installed on my company it´s check_mk and it´s based on nagios. Since it´s not the same software, it´s normal to don´t work.
I'm not very familiar with check_mk, but I found these instructions that might help you make livestatus available over the network: https://checkmk.com/cms_livestatus.html#network
Already done that. I tried testing connection with the livestatus_host with telnet and worked. But plugin still don´t show data.
I'm not sure what the best way for me to help you here is. Is the hostname in Netbox the same as in Nagios?
This is what the plugin sends over to the livestatus_host:
GET hosts
Filter: host_name = <hostname>
OutputFormat: json
Other things you can try is to write a little script that imports livestatus.py
to see if that works or run tcpdump
on one of the two ends to see what the actual network traffic between the two is.
I will let the the plugin also to be installed. And will test it as we are also using check_mk. I let you know when I get the results.. :-)
Closing stale issue. Please re-open if needed.
Hi, My nagios server it´s protected with auth, could you add on config: nagios_user and nagios_password ? I already tried changing the plugin but i don´t have knowledge with python language.
Here´s the source i tried: https://stackoverflow.com/questions/2929532/http-basic-authentication-using-sockets-in-python