Page 1 of 1
Can I add icon to services to manually issue commands?
Posted: Wed Nov 05, 2014 3:49 am
by zicat
Hello.
I recently used Nagios to monitor our production servers. I want to do the following, but can't find a solution.
I want to display an icon next to the service on the web interface, when the service becomes critical. So, when the operator get notified and logon to the web interface, he can choose to click the icon, to issue some command to the service, e.g. to restart it.
Any ideas? Thanks in advance.
Re: Can I add icon to services to manually issue commands?
Posted: Wed Nov 05, 2014 10:52 am
by slansing
Yes, you could build this in, but it won't be necessarily easy. You would have to hook it into an SSH session extension for your browser, and allow them to log into the system. For what you are mentioning, users typically find event-handlers the best, and easiest solution:
http://nagios.sourceforge.net/docs/nagi ... dlers.html
Re: Can I add icon to services to manually issue commands?
Posted: Wed Nov 05, 2014 11:03 am
by abrist
You could use the action url to do this:
action_url: This directive is used to define an optional URL that can be used to provide more actions to be performed on the host. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing host information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).
http://nagios.sourceforge.net/docs/3_0/ ... tions.html
Though you will need to create a cgi or web api to your script.
Re: Can I add icon to services to manually issue commands?
Posted: Thu Nov 06, 2014 3:51 am
by zicat
Event handler is an option. But it runs after the service becomes critical. I want to leave the operator chance to choose, if restarting the service is safe.
slansing wrote:Yes, you could build this in, but it won't be necessarily easy. You would have to hook it into an SSH session extension for your browser, and allow them to log into the system. For what you are mentioning, users typically find event-handlers the best, and easiest solution:
http://nagios.sourceforge.net/docs/nagi ... dlers.html
Re: Can I add icon to services to manually issue commands?
Posted: Thu Nov 06, 2014 4:15 am
by zicat
The first part of my problem is solved by action_url. Although it only applies to host, it is acceptable.
Now, how to issue a shell script command by clicking the icon on the web page? Do I have to write my own cgi?
abrist wrote:You could use the action url to do this:
action_url: This directive is used to define an optional URL that can be used to provide more actions to be performed on the host. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing host information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).
http://nagios.sourceforge.net/docs/3_0/ ... tions.html
Though you will need to create a cgi or web api to your script.
Re: Can I add icon to services to manually issue commands?
Posted: Thu Nov 06, 2014 3:18 pm
by abrist
zicat wrote: Do I have to write my own cgi?
Yes, or php script or something similar.
Re: Can I add icon to services to manually issue commands?
Posted: Thu Nov 06, 2014 3:19 pm
by sreinhardt
Essentially yes, although it most certainly does not need to be written in C. Really all you need is a script in a web accessible location, that can resolve your issue when called via apache. To start, I would suggest making ones that do not accept arguments, once you get it figured out, you can move on to accepting url or post variables for better scripts.