Show command used

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
BanditBBS
Posts: 2457
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Show command used

Post by BanditBBS »

I don't want to give someone permission to see CCM but would be very useful for them to see the command used. In their old Nagios Core with Thruk it was shown on the Host status and service status pages. I just added the object config component btu it just shows the command name and the ARG fields. Anyone ever make something to show the actually full commandline command used?
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Show command used

Post by ssax »

You could probably use the Actions component to call a script that would return that info but I'm unaware of anything currently that would do it.
User avatar
BanditBBS
Posts: 2457
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Show command used

Post by BanditBBS »

Yeah, I could easily make a component that adds another tab too, my issue is how to build the commandline. Is there a call in the XI code that I can make? I've just never messed with building the commandline used...
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Show command used

Post by tgriep »

In XI, you can use the API to get the Host or Service configs in json format and then use that in your script to parse it for the user.

This is an example of the command you would use.

Code: Select all

curl -XGET "https://xxx.xxx.xxx.xxx/nagiosxi/api/v1/config/service?apikey=<APIKEY>&pretty=1" -k
This is the output of one of the services on my test system.

Code: Select all

{
        "config_name": "Ubuntu",
        "host_name": [
            "Ubuntu"
        ],
        "service_description": "Negate NRPE",
        "use": [
            "generic-service"
        ],
        "check_command": "negate_nrpe!60%!8%!-C -w 50% -c 3% -r \/boot!!!!!",
        "max_check_attempts": "5",
        "check_interval": "5",
        "retry_interval": "1",
        "check_period": "xi_timeperiod_24x7",
        "notification_interval": "60",
        "notification_period": "xi_timeperiod_24x7",
        "notifications_enabled": "0",
        "contacts": [
            "nagiosadmin"
        ],
        "_xiwizard": "nrpe",
        "register": "1"
    },
That should get you closer to what you need.

You need to run XI 5.6.x to get this feature.

Check the Help > API Docs > Config Reference menu for more details.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked