NCPA uptime Check - urlopen Error

Hello Community,

I am currently blocked on my NCPA Check for the uptime of an Host. I couldnt find the problem. I hope together we can find a solution. Thank you in advance.

I am trying to monitor the uptime of a host with ncpa. The current situation is:
The check works for some hosts but not for the last host I want to check.
When I run the check manually it works fine. I get the result : ok - up for a couple of days. But not when I let icinga run the check automatically.
Icinga shows “unknown” use verbose flag as a problem - so I did include it in my automatic check and the output looks like this:

`Connecting to: https://xx.xxx.xxx.xxx:xxxx/api/system/uptime/?token=xxxxxxxx&warning=3600%3A&critical=300%3A&check=1

An error occurred:<urlopen error Tunnel connection failed: 403 Forbidden>`

I hope anyone has an idea what the problem could be.
thank you community.

Hi,

I’m receiving the same error when running this checkCommand:

object CheckCommand "check_ncpa_services_running_bck" {
  import "plugin-check-command"
  command = [ PluginDir + "/check_ncpa.py",
    "-H", "$address$",
    "-t", api_token,
    "-M", "$remote_ncpa_metric$",
    "-q", "$remote_ncpa_query$",
    "-v", "-v",
  ]
}

Error:

Connecting to: https://10.116.217.243:5693/api/services/?token=w2vf2QOLsap9VyD2&check=1&service=docker&status=running
An error occurred:<urlopen error Tunnel connection failed: 403 Forbidden>

adding the “sudo” command before “PluginDir” seems to resolve this issue, but will lead into the following error/warning:
"sudo: account validation failure, is your account locked?"

Quiet interesting fact: The checkCommand can be executed on Windows machines without the “sudo” perfectly, just on Linux machines it’s throwing the error message of 403 forbidden…

Running the command manually via command line works fine, though:

/usr/lib64/nagios/plugins/check_ncpa.py -H 10.116.217.243 -t w2vf2QOLabe9VyD2 -M services -q service=docker,status=running -v    
Connecting to: https://10.116.217.243:5693/api/services/?token=w2vf2QOLabe9VyD2&check=1&service=docker&status=running
File returned contained:
{
    "returncode": 0, 
    "stdout": "OK: docker is running"
}
OK: docker is running