Submit Exernal commands from Remote Machine to Nagioxi

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mdusanapudi
Posts: 35
Joined: Tue Mar 15, 2016 1:31 pm

Submit Exernal commands from Remote Machine to Nagioxi

Post by mdusanapudi »

Hi ,
I am trying to integrate service now with nagios xi using NRDP and Goal of this integrations is to disable /enable host and service checks from servicenow.
While using NRDP client I cam e to know that it can only submit the passive checks but not external commands.

Is there a way to send external commands to nagiosxi from remote machine using NRDP?
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Submit Exernal commands from Remote Machine to Nagioxi

Post by bwallace »

No, there is not any way to send external commands to Nagios XI from a remote machine using NRDP or via any other component, as far as I'm aware.

For what reasons do you need to suspend host/ service checks on Service now, and under what conditions? Perhaps there is another approach.
Be sure to check out the Knowledgebase for helpful articles and solutions!
mdusanapudi
Posts: 35
Joined: Tue Mar 15, 2016 1:31 pm

Re: Submit Exernal commands from Remote Machine to Nagioxi

Post by mdusanapudi »

We wanted to put the host check disabled when there is change request in servicenow for maintenance activity.
I am thinking using NRDP if we can pass DISABLE_HOST_CHECK and DISABLE_HOST_SVC_CHECK we can fire them from ServiceNow.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Submit Exernal commands from Remote Machine to Nagioxi

Post by rkennedy »

There are a couple plugins built already, for ServiceNow integration. I don't know if they all work completely, so they make take some hacking to get them working.
https://exchange.nagios.org/directory/P ... er/details

Instructions can be found here -
http://roshamboot.org/main/deprecated-p ... tegration/

For reference, by setting notification_interval 0 - you will only receive one notification when a host or service goes down.

Will that perl script work for your needs?
Former Nagios Employee
mdusanapudi
Posts: 35
Joined: Tue Mar 15, 2016 1:31 pm

Re: Submit Exernal commands from Remote Machine to Nagioxi

Post by mdusanapudi »

rkennedy wrote:There are a couple plugins built already, for ServiceNow integration. I don't know if they all work completely, so they make take some hacking to get them working.
https://exchange.nagios.org/directory/P ... er/details

Instructions can be found here -
http://roshamboot.org/main/deprecated-p ... tegration/

For reference, by setting notification_interval 0 - you will only receive one notification when a host or service goes down.

Will that perl script work for your needs?
I am actually looking for a way to interact with nagios from a remote machine and not from nagios to servicenow integration
Any API or Script will work for me and I can customize them
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Submit Exernal commands from Remote Machine to Nagioxi

Post by Box293 »

mdusanapudi wrote:Is there a way to send external commands to nagiosxi from remote machine using NRDP?
You don't need NRDP for that, you can just issue a curl:

"Scheduling Downtime From A Remote Host"

This is for the host object:
Command:

Code: Select all

curl -d "cmd_typ=55&cmd_mod=2&host=centos03&com_data=TestingDowntime&trigger=0&start_time=03-13-2015 11:30:00&end_time=03-13-2015 11:40:00&fixed=1&childoptions=0&btnSubmit=Commit" "http://xitest/nagios/cgi-bin/cmd.cgi" -u "troylea:password"
This is for the host's services:
Command:

Code: Select all

curl -d "cmd_typ=86&cmd_mod=2&host=centos03&com_data=TestingDowntime&trigger=0&start_time=03-13-2015 11:30:00&end_time=03-13-2015 11:40:00&fixed=1&childoptions=0&btnSubmit=Commit" "http://xitest/nagios/cgi-bin/cmd.cgi" -u "troylea:password"
The output you receive for the commands is a http page, but most importantly you are after this message:
Output:

Code: Select all

<P><DIV CLASS='infoMessage'>Your command request was successfully submitted to Nagios for processing.<BR><BR>
Note: It may take a while before the command is actually processed.<BR><BR>
More examples here:
http://sites.box293.com/nagios/guides/t ... e-and-cgis

These two URL's also have useful information:

https://old.nagios.org/developerinfo/ex ... ndlist.php

https://github.com/NagiosEnterprises/na ... cmd_list.c
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mdusanapudi
Posts: 35
Joined: Tue Mar 15, 2016 1:31 pm

Re: Submit Exernal commands from Remote Machine to Nagioxi

Post by mdusanapudi »

Thanks Everyone for your replies...I was able to make it work using Ruby.
we need to install a ruby gem called nagios_nrdp
written a ruby script to call the commands
#!/usr/bin/env /usr/local/rvm/rubies/ruby-2.1.0/bin/ruby
require 'nagios_nrdp'


url = ARGV[0]

token = ARGV[1]

command = ARGV[2]
nrdp = Nagios::Nrdp.new(url: url, token: token)
nrdp.submit_command(command)



Run the script with commandline args .URL,token,command
example :send_nrdp.rb http://testurl.com/nrdp mytoken DISABLE_HOST_CHECK;somehost



Thanks
Locked