Page 1 of 3

NRDP Nagios XI receiving info from nagios core

Posted: Mon Mar 30, 2020 12:18 pm
by paulo.ferreira
Dear Team,

I have a nagios xi installed localy and 2 nagios core installed at 2 differents clients site, I followed the instructions from https://assets.nagios.com/downloads/nag ... h-NRDP.pdf, and in 1 client works fine and the other one don't, anyone know we this could happen?

ps: Both clients have open firewall ports and rules configured
ps: I use different tokens for each client

Re: NRDP Nagios XI receiving info from nagios core

Posted: Mon Mar 30, 2020 3:12 pm
by scottwilkerson
Do you have both tokens listed on your Inbound Transfers page?
Can you verify they both also appear here on the Nagios XI server

Code: Select all

grep authorized_tokens /usr/local/nrdp/server/config.inc.php

Re: NRDP Nagios XI receiving info from nagios core

Posted: Tue Mar 31, 2020 7:08 am
by paulo.ferreira
Yes, both tokens appers.

follow the output


[root@atbr2mong001pvx ~]# grep authorized_tokens /usr/local/nrdp/server/config.inc.php
$cfg['authorized_tokens'] = array("MbJMjUTeWMEM","MbJMjUTeWMES",);

Re: NRDP Nagios XI receiving info from nagios core

Posted: Tue Mar 31, 2020 1:26 pm
by scottwilkerson
Are you seeing errors in the nagios.log on the sending server that is having the problem?

Re: NRDP Nagios XI receiving info from nagios core

Posted: Wed Apr 01, 2020 8:28 am
by paulo.ferreira
Only a few like this one below:
:[1585746819] Warning: OCHP command '/usr/local/nagios/libexec/send_nrdp.php --url=https://10.202.1.69/nrdp/ --token=MbJMjUTeWMES --host="SGS-SANTOS-HP-RACK-SERVIDORES" --state=0 --output="PING OK - Packet loss = 0%, RTA = 13.24 ms"' for host 'SGS-SANTOS-HP-RACK-SERVIDORES' timed out after 0.00 seconds
[1585746819] wproc: Core Worker 15366: job 109889 (pid=9438) timed out. Killing it
[1585746819] wproc: OCHP job 109889 from worker Core Worker 15366 timed out after 70.67s

But this error shows just for a few Devices, and none of them shows at nagios xi.

Re: NRDP Nagios XI receiving info from nagios core

Posted: Wed Apr 01, 2020 9:22 am
by scottwilkerson
Ok, it looks like this isn't working, maybe there is a problem reaching the server?

Code: Select all

/usr/local/nagios/libexec/send_nrdp.php --url=https://10.202.1.69/nrdp/ --token=MbJMjUTeWMES --host="SGS-SANTOS-HP-RACK-SERVIDORES" --state=0 --output="PING OK - Packet loss = 0%, RTA = 13.24 ms"
How about the results of this

Code: Select all

curl -vvv -k https://10.202.1.69/nrdp/

Re: NRDP Nagios XI receiving info from nagios core

Posted: Wed Apr 01, 2020 10:02 am
by paulo.ferreira
The ouput, the connection looking ok:

[root@BRMON001 ~]# curl -vvv -k https://10.202.1.69/nrdp/
* About to connect() to 10.202.1.69 port 443 (#0)
* Trying 10.202.1.69...
* Connected to 10.202.1.69 (10.202.1.69) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* subject: CN=161.89.129.130,OU=Development,O=Nagios Enterprises,L=St. Paul,ST=Minnesota,C=US
* start date: Dec 28 19:43:25 2018 GMT
* expire date: Dec 25 19:43:25 2028 GMT
* common name: 161.89.129.130
* issuer: CN=161.89.129.130,OU=Development,O=Nagios Enterprises,L=St. Paul,ST=Minnesota,C=US
> GET /nrdp/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 10.202.1.69
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 01 Apr 2020 15:08:12 GMT
< Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16
< X-Powered-By: PHP/5.4.16
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
<
<!doctype html>
<html>
<head>
<title>Nagios Remote Data Processor</title>
<script src="includes/jquery-3.2.1.min.js"></script>
<link href="includes/bootstrap.min.css" rel="stylesheet" />
<script src="includes/bootstrap.bundle.min.js"></script>
<style>
body {
margin: 2em 0;
}
.btn {
margin-top: 2em;
cursor: pointer;
}
.tab-content {
margin: 1em 0;
}
.token-group {
margin-top: 1em;
}
</style>
<script>

// number of seconds to keep the alerts
var alert_timeout = 3;

function build_alert(cssclass, msg) {

var $alert = $("<div class=\"alert alert-" + cssclass + " form-control-sm\">" + msg + "</div>");
$(".messages").html($alert);
return $alert;
}

function check_message_status(status, msg) {

var $alertbox;

if (status != 0) {
$alertbox = build_alert("danger", msg);
} else {
$alertbox = build_alert("info", msg);
}

setTimeout(function() { $alertbox.remove(); }, (alert_timeout * 1000));
}

function success_xml(xml) {

console.log("success_xml(xml) data:");
console.log(xml);

var status = $(xml).find("status").text();
var msg = $(xml).find("message").text();

check_message_status(status, msg);
}

function success_json(json) {

console.log("success_json(json) data:");
console.log(json);

var status = json.result.status;
var msg = json.result.message;

check_message_status(status, msg);
}

$(function() {

// get the page hash so we can set the appropriate tabs
var page_hash = $(location).attr("hash").substr(1);
if (page_hash == "") {

// use the php defined default if no hash is used
page_hash = "json";
}

if (page_hash == "command") {

// this is the default, so we don't need to do anything
}
else if (page_hash == "checkresult") {

$(".nav-tabs a[href='#checkresult'").tab("show");
}
else if (page_hash == "xml") {

$(".nav-tabs a[href='#checkresult'").tab("show");

// we don't need to explicitly show the xml tab either
// since it is the default
//$(".nav-tabs a[href='#xml'").tab("show");
}
else if (page_hash == "json") {

$(".nav-tabs a[href='#checkresult'").tab("show");
$(".nav-tabs a[href='#json'").tab("show");
}

$(".submit-command").click(function() {
$.ajax({
type: "GET",
data: {
cmd: "submitcmd",
token: $("#token").val(),
command: $("#extcommand").val()
},
success: function(xml) { success_xml(xml); }
});
});

$(".submit-checkresult-xml").click(function() {
$.ajax({
type: "POST",
dataType: "xml",
data: {
cmd: "submitcheck",
token: $("#token").val(),
XMLDATA: $("#xmldata").val()
},
success: function(xml) { success_xml(xml); }
});
});

$(".submit-checkresult-json").click(function() {
$.ajax({
type: "POST",
dataType: "json",
data: {
cmd: "submitcheck",
token: $("#token").val(),
JSONDATA: $("#jsondata").val()
},
success: function(json) { success_json(json); }
});
});
});
</script>
</head>
<body>
<div class="container">

<div class="row">
<div class="col-12">
<h2>NRDP ยท Nagios Remote Data Processor</h2>
</div>
</div>


<hr />

<div class="row">
<div class="col-12">

<ul class="nav nav-tabs" id="action-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="command-tab" data-toggle="tab" href="#command" role="tab" aria-controls="command" aria-selected="true">Submit Nagios Command</a>
</li>
<li class="nav-item">
<a class="nav-link" id="checkresult-tab" data-toggle="tab" href="#checkresult" role="tab" aria-controls="checkresult" aria-selected="false">Submit Check Result</a>
</li>
</ul>

<!-- token is used everywhere -->
<div class="form-group token-group">
<label for="token">Token</label>
<input type="text" name="token" id="token" value="token" placeholder="token" class="form-control form-control-sm">
<small class="form-text">
Use the token you've configured in your <code>config.inc.php</code> file.
</small>
</div>

<!-- command / check result tabs -->
<div class="tab-content" id="action-contents">

<!-- command tab -->
<div class="tab-pane fade show active" id="command" role="tabpanel" aria-labelledby="command-tab">

<div class="form-group">
<label for="extcommand">Command</label>
<input type="text" name="command" id="extcommand" value="DISABLE_HOST_NOTIFICATIONS;somehost" class="form-control form-control-sm">
<small id="command-command-help" class="form-text">
Specify your command string here. Helpful information <a href="https://assets.nagios.com/downloads/nag ... .html">can be found here.</a>
</small>
</div>

<button type="button" class="btn btn-primary submit-command">Submit Command</button>

</div><!-- /command-tab -->

<!-- checkresult tab -->
<div class="tab-pane fade" id="checkresult" role="tabpanel" aria-labelledby="checkresult-tab">

<ul class="nav nav-tabs" id="crtype-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="xml-tab" data-toggle="tab" href="#xml" role="tab" aria-controls="xml" aria-selected="true">XML Check Result</a>
</li>
<li class="nav-item">
<a class="nav-link" id="json-tab" data-toggle="tab" href="#json" role="tab" aria-controls="json" aria-selected="false">JSON Check Result</a>
</li>
</ul>

<!-- xml / json check result tabs -->
<div class="tab-content" id="crtpe-contents">

<!-- xml tab -->
<div class="tab-pane fade show active" id="xml" role="tabpanel" aria-labelledby="xml-tab">
<form method="post">

<div class="form-group">
<textarea rows="19" name="XMLDATA" id="xmldata" class="form-control form-control-sm"><?xml version='1.0'?>
<checkresults>
<checkresult type='host'>
<hostname>somehost</hostname>
<state>0</state>
<output>Everything looks okay! | perfdata=1;</output>
</checkresult>
<checkresult type='service'>
<hostname>somehost</hostname>
<servicename>someservice</servicename>
<state>1</state>
<output>WARNING: Danger Will Robinson! | perfdata=1;</output>
</checkresult>
</checkresults></textarea>
<small class="form-text">
Check result data in XML format.
</small>
</div>

<button type="button" class="btn btn-primary submit-checkresult-xml">Submit XML Check Result</button>

</div><!-- /xmltab -->

<!-- json tab -->
<div class="tab-pane fade" id="json" role="tabpanel" aria-labelledby="json-tab">

<div class="form-group">
<textarea rows="23" name="JSONDATA" id="jsondata" class="form-control form-control-sm">{
"checkresults": [
{
"checkresult": {
"type": "host",
"checktype": "1"
},
"hostname": "somehost",
"state": "0",
"output": "Everything looks okay! | perfdata=1;"
},
{
"checkresult": {
"type": "service",
"checktype": "1"
},
"hostname": "somehost",
"servicename": "someservice",
"state": "1",
"output": "WARNING: Danger Will Robinson! | perfdata=1;"
}
]
}</textarea>
<small class="form-text">
Check result data in JSON format.
</small>
</div>

<button type="button" class="btn btn-primary submit-checkresult-json">Submit JSON Check Result</button>

</div><!-- /jsontab -->

</div><!-- /xml&json check result tabs -->
</div><!-- /checkresult tab -->

</div><!-- /action-contents -->
</div><!-- /col-12 -->
</div><!-- /row -->


<hr />

<!-- this is where the alerts show up -->
<div class="row">
<div class="col-12 messages">
</div>
</div>
</div><!-- /container -->
</body>
</html>
* Connection #0 to host 10.202.1.69 left intact

Re: NRDP Nagios XI receiving info from nagios core

Posted: Wed Apr 01, 2020 12:43 pm
by scottwilkerson
And this?

Code: Select all

/usr/local/nagios/libexec/send_nrdp.php --url=https://10.202.1.69/nrdp/ --token=MbJMjUTeWMES --host="SGS-SANTOS-HP-RACK-SERVIDORES" --state=0 --output="PING OK - Packet loss = 0%, RTA = 13.24 ms"

Re: NRDP Nagios XI receiving info from nagios core

Posted: Thu Apr 02, 2020 6:50 am
by paulo.ferreira
No return from the script

[root@BRMON001 libexec]# ./send_nrdp.php --url=https://10.202.1.69/nrdp/ --token=MbJMjUTeWMES --host="SGS-SANTOS-HP-RACK-SERVIDORES" --state=0 --output="PING OK - Packet loss = 0%, RTA = 13.24 ms"

[root@BRMON001 libexec]#

Re: NRDP Nagios XI receiving info from nagios core

Posted: Thu Apr 02, 2020 10:53 am
by scottwilkerson
If you run that again, and look at the apache log on the remote system (10.202.1.69) are you seeing any errors?

Code: Select all

grep nrdp /var/log/httpd/access_log
tail -50 /var/log/httpd/error_log