hudson-trading / netbox-nagios

Plugin to show Nagios host and service status in NetBox on the device page.
Other
44 stars 10 forks source link

Allow alternative URLs for Hosts/Services #3

Open garnser opened 4 years ago

garnser commented 4 years ago

Not all nagios-based monitoring systems which has livestatus available is utilizing the hardcoded URL to get access to the object. Please consider adding a configurable "status.cgi?host= addresses" and likewise for services.

As a sample, I'm using Check_MK which renders the URLs as follows:

Hosts: https://monitoringhost/site/check_mk/index.py?start_url=view.py%3Ffilled_in%3Dfilter%26host%3D**hostname**%26view_name%3Dhost

Services: https://monitoringhost/site/check_mk/index.py?start_url=view.py%3Fhost%3D**hostname**%26service%3D**service**%26view_name%3Dservice

roganartu commented 4 years ago

Thanks for the feedback!

The URLs are rendered here, where the hardcoded path you describe can be found: https://github.com/hudson-trading/netbox-nagios/blob/main/netbox_nagios/templates/device_nagios_box.html. I don't see any reason the path and query params wouldn't be able to be configurable.

We would accept a PR if you'd like to submit one.

nikor30 commented 3 years ago

Hi we are also using check_MK think it´s very popular regarding network monitoring. Also I have here the same issue , bleo the link of the device how it´s in checkmk

http://checkmk/sdestovpcmk1/check_mk/index.py?start_url=%2Fsdestovpcmk1%2Fcheck_mk%2Fview.py%3Ffilled_in%3Dfilter%26host%3DSSTO153CIS%26view_name%3Dhost

and here when I click on the go to nagios btton in netbox

http://chekmk/nagios/cgi-bin/status.cgi?host=SSTO153CIS

I sit possible you can help us here ?

skalec commented 3 years ago

I would like to join the topic. For example, we use icinga2 and would also like to use this plugin here. So a customizable link would be usable for several different monitoring tools.

nikor30 commented 2 years ago

Hi, so can you add this feature for more broader integration for this plugin

skalec commented 2 years ago

Any Reply from the admin?

fabi125 commented 2 years ago

I'm fairly busy with other things right now, not sure when I can get around adding this feature. But I'll be more than happy to review a PR if anybody else wants to contribute.

skalec commented 2 years ago

Hello. I just tried to change the plugin a bit. I was successful. I made the following adjustments to call up the live status of icinga2.

device_nagios_buttons.html

change <a href="{{ nagios_base_url }}status.cgi?host={{ object.name }}" class="btn btn-sm btn-info" target="_blank"> <span class="mdi mdi-open-in-new" aria-hidden="true"><span> Open in Nagios </a>

to

<a href="{{ nagios_base_url }}monitoring/host/show?host={{ object.name }}" class="btn btn-sm btn-info" ta> <span class="mdi mdi-open-in-new" aria-hidden="true"><span> Open in Icinga2 </a>

2.

device_nagios_box.html

change

<a href='{{ nagios_base_url }}status.cgi?host={{ object.name }}' target="_blank">

to

<a href='{{ nagios_base_url }}monitoring/host/show?host={{ object.name }}' target="_blank">

3.

change <a href='{{ nagios_base_url }}extinfo.cgi?type=2&host={{ object.name }}&service={{ service.0 }}' target="_blank">{{ service.0 }}</a>

to

<a href='{{ nagios_base_url }}monitoring/service/show?host={{ object.name }}&service={{ service.0 }}' target="_blank">{{ service.0 }}</a>

confoguration.py

PLUGINS_CONFIG = { "netbox_nagios": { "livestatus_host": "monitoring.example.com", "nagios_base_url": "https://monitoring.example.com/icingaweb2/", }, }

I tried using the livestatus_port option. unfortunately this didn't work. So I redirected the default port 6557 to port 6666 from Icinga2.

I hope it helps you further.