Error: host check result obtained by '', but no host can be

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
Eudes87
Posts: 30
Joined: Wed Oct 09, 2019 8:37 am

Error: host check result obtained by '', but no host can be

Post by Eudes87 »

Hello, Guys

I installed NCPA / NRDP per the manuals available here at the links.
https://assets.nagios.com/downloads/ncp ... g-NCPA.pdf
https://assets.nagios.com/downloads/ncp ... Checks.pdf
https://support.nagios.com/kb/article/n ... s-762.html

STATUS PENDING ALL
https://i.imgur.com/AMzKxN5.jpg

Checking Nagios logs, I observed a message: Error: host check result obtained by '', but no host can be found

found it the article link https://support.nagios.com/kb/article/n ... p-795.html
There is already php-xml installed on my Nagios Server.

I also read it here https://support.nagios.com/forum/viewto ... 2&start=10, but as I understand it, it was not resolved.

Can you help me?

Details:

Machine monitored in passive mode:
/usr/local/ncpa/etc/ncpa.cfg.d/nrdp.cfg

Code: Select all

%HOSTNAME%|Disk Usage = disk/logical/C:|/used_percent --warning 80 --critical 90 --units Gi
%HOSTNAME%|CPU Usage = cpu/percent --warning 60 --critical 80 --aggregate avg
%HOSTNAME%|Swap Usage = memory/swap --warning 60 --critical 80 --units Gi
%HOSTNAME%|Memory Usage = memory/virtual --warning 80 --critical 90 --units Gi
/usr/local/ncpa/etc/ncpa.cfg

Code: Select all

[nrdp]
parent = https://security2/nrdp/
token = 45mlafp49838afcdaaffad
hostname = host_ncpa

[passive]

handlers = nrdp
uid = nagios
gid = nagios
sleep = 150
loglevel = info
logfile = var/log/ncpa_passive.log
pidfile = var/run/ncpa_passive.pid

[nrdp]

parent = https://security2/nrdp/
token = 45mlafp49838afcdaaffad
hostname = host_ncpa
less /usr/local/ncpa/var/log/ncpa_passive.log

Code: Select all

Traceback (most recent call last):
  File "/root/ncpa/agent/passive/nrdp.py", line 198, in submit_to_nagios
  File "/root/ncpa/agent/passive/nrdp.py", line 145, in log_result
  File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
  File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: no element found: line 1, column 0
Server Nagios:

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

Code: Select all

$cfg['authorized_tokens'] = array( "mytoken",  // <-- not a good token
);

$cfg['external_commands_deny_tokens'] = array(
);

$cfg["require_https"] = true;

$cfg["nagios_command_group"] = "nagcmd";

$cfg["command_file"] = "/usr/local/nagios/var/rw/nagios.cmd";

$cfg["check_results_dir"] = "/usr/local/nagios/var/spool/checkresults";

$cfg["disable_external_commands"] = false;

$cfg["allow_old_results"] = false;

$cfg["debug"] = false;

$cfg["debug_log"] = "/usr/local/nrdp/server/debug.log";

$cfg['product_name'] = 'nrdp';
$cfg['product_version'] = '1.5.0'
Attachments
XML no print result??????
XML no print result??????
screenshot.15.jpg
screenshot.14.jpg
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Error: host check result obtained by '', but no host can

Post by benjaminsmith »

Hello,
Checking Nagios logs, I observed a message: Error: host check result obtained by '', but no host can be found
It would be helpful to review the actual /usr/local/nagios/var/nagosl.log as it looks like the passive checks are coming in to Nagios, but there is no confgurations for host and service to assign them to.

Can you post the configurations for us to review? Thanks.

See: NRDP - Passive Host And Service Definitions
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Eudes87
Posts: 30
Joined: Wed Oct 09, 2019 8:37 am

Re: Error: host check result obtained by '', but no host can

Post by Eudes87 »

benjaminsmith wrote:Hello,
Checking Nagios logs, I observed a message: Error: host check result obtained by '', but no host can be found
It would be helpful to review the actual /usr/local/nagios/var/nagosl.log as it looks like the passive checks are coming in to Nagios, but there is no confgurations for host and service to assign them to.

Can you post the configurations for us to review? Thanks.

See: NRDP - Passive Host And Service Definitions
Hello @benjaminsmith
I found that this error "host check result obtained by '', but no host can be" is generated after running the XML Check Result and JSON Check Result tests, the last returns "OK", but the XML returns nothing.

Code: Select all

[11-05-2019 12:33:47] Error: Got host checkresult for '', but no such host can be found
Informational Message[11-05-2019 12:33:46] Error: Got host checkresult for '', but no such host can be found
Submit nagios command also works.

Code: Select all

[11-05-2019 12:42:32] External command [1572968552] DISABLE_HOST_NOTIFICATIONS;ncpa_host returned error Command failed

Following is my host configuration:

Code: Select all

define command {
    command_name            check_dummy
    command_line            $USER1$/check_dummy $ARG1$
}

define host {
    use                        generic-host
    name                        host_ncpa
    active_checks_enabled        0
    passive_checks_enabled        1
    flap_detection_enabled        0
    register                    0
    check_period                24x7
    max_check_attempts        1
    check_interval            5
    retry_interval            1
    check_freshness            0
    contact_groups            admins
    check_command            check_dummy!0
    notification_interval    60
    notification_period        24x7
    notification_options        d,u,r
}

define service {
    use                        generic-service
    name                        passive_service
    active_checks_enabled        0
    passive_checks_enabled        1
    flap_detection_enabled        0
    register                    0
    check_period                24x7
    max_check_attempts        1
    check_interval            5
    retry_interval            1
    check_freshness            0
    contact_groups            admins
    check_command            check_dummy!0
    notification_interval    60
    notification_period        24x7
    notification_options        w,u,c,r
}

define host {
    use            passive_host
    host_name        host_ncpa
}	

define service {
    use                    passive_service
    service_description    CPU Usage
    host_name                host_ncpa
}

define service {
    use                    passive_service
    service_description    Disk Usage
    host_name                host_ncpa
}

define service {
    use                    passive_service
    service_description    Swap Usage
    host_name                host_ncpa
}

define service {
    use                    passive_service
    service_description    Memory Usage
    host_name                host_ncpa
}

define service {
    use                    passive_service
    service_description    Process Count
    host_name                host_ncpa
}
Thanks for your help
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Error: host check result obtained by '', but no host can

Post by scottwilkerson »

Following your thread here
https://github.com/NagiosEnterprises/ncpa/issues/423

It appears your server is missing a php package or it is misconfigured.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Eudes87
Posts: 30
Joined: Wed Oct 09, 2019 8:37 am

Re: Error: host check result obtained by '', but no host can

Post by Eudes87 »

It has been resolved, solution is here: https://github.com/NagiosEnterprises/ncpa/issues/423

sorry for the delay in replying, you can lock the post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Error: host check result obtained by '', but no host can

Post by scottwilkerson »

Eudes87 wrote:It has been resolved, solution is here: https://github.com/NagiosEnterprises/ncpa/issues/423

sorry for the delay in replying, you can lock the post.
Great!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked