Page 1 of 1

Submit Exernal commands from Remote Machine to Nagioxi

Posted: Wed Mar 16, 2016 7:20 am
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?

Re: Submit Exernal commands from Remote Machine to Nagioxi

Posted: Wed Mar 16, 2016 12:07 pm
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.

Re: Submit Exernal commands from Remote Machine to Nagioxi

Posted: Wed Mar 16, 2016 12:21 pm
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.

Re: Submit Exernal commands from Remote Machine to Nagioxi

Posted: Wed Mar 16, 2016 3:38 pm
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?

Re: Submit Exernal commands from Remote Machine to Nagioxi

Posted: Wed Mar 16, 2016 4:26 pm
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

Re: Submit Exernal commands from Remote Machine to Nagioxi

Posted: Thu Mar 17, 2016 1:05 am
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

Re: Submit Exernal commands from Remote Machine to Nagioxi

Posted: Wed Mar 30, 2016 5:36 pm
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