How to add a new service command in service page

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
zaheer.abdulla
Posts: 5
Joined: Sat May 31, 2014 6:25 am

How to add a new service command in service page

Post by zaheer.abdulla »

Hi,

Is it possible to add a Service Command in the page where we see other service commands like Reschedule service check, acknowledge alarm etc.?

Thanks
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to add a new service command in service page

Post by tmcdonald »

I'm a bit confused by what you mean. All configuration in Nagios Core is done via the config files, not the web interface. What page are you referring to? Are you actually using Nagios XI?
Former Nagios employee
zaheer.abdulla
Posts: 5
Joined: Sat May 31, 2014 6:25 am

Re: How to add a new service command in service page

Post by zaheer.abdulla »

Sorry for the bad explanation and confusion. I am using Nagios core.

In Nagios wepage, when we click on any service, eg. http service, the Service Information page opens. There we have Service State Information and Service Commands (eg. Disable Active Checks Of This Service, Re-schedule Next Service Check, etc.) in the page.

Is it possible to add a new service command there?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: How to add a new service command in service page

Post by slansing »

You are talking about the check_command? As in check_nrpe!cpu_usage!30!50 etc? Or a new action button such as those you noted above? If you are asking about changing the check command you can do that by clicking Configure > Reconfigure.
zaheer.abdulla
Posts: 5
Joined: Sat May 31, 2014 6:25 am

Re: How to add a new service command in service page

Post by zaheer.abdulla »

A new action button is that what I am looking for. By clicking it, need to trigger a perl script.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: How to add a new service command in service page

Post by eloyd »

You would have to write the code and add it to the Nagios core source for the CGIs. Most likely you'd want to smack your code into the middle of <nagios src>/cgi/statuswml.c. This is not "hard" exactly, but likely to be way beyond the scope of this forum.

If you're looking for a "plug-in" type approach to adding an action button to this display, the answer is no. But I think it's a great idea for future core development to "plug-in-ify" this part of the UI if you want to tackle it :-)
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
zaheer.abdulla
Posts: 5
Joined: Sat May 31, 2014 6:25 am

Re: How to add a new service command in service page

Post by zaheer.abdulla »

:) .

So, instead of creating new action, if I want modify already existing action, is this the file I need to modify? <nagios src>/cgi/statuswml.c.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: How to add a new service command in service page

Post by eloyd »

If you want to "jerry rig" it to do something else on your server (aim it at a different CGI or a perl script or whatever) then you could hijack one of the existing actions, yes. But this is a "your mileage may vary" type thing since whatever you want to do will 100% break if you ever upgrade. Plus you would lose whatever functionality you hijack.

But basically, the answer to your question is "yes." :mrgreen:
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to add a new service command in service page

Post by scottwilkerson »

Thanks @eloyd

@zaheer.abdulla - Not sure if you are a long time user or just getting started, but I did want to mention that in the Commercial XI version of Nagios, this is a built-in feature, in Core, as eloyd has suggested you would have to roll-your-own.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked