Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRPE not showing real output of check_apt #261

Open
basd82 opened this issue May 25, 2022 · 6 comments
Open

NRPE not showing real output of check_apt #261

basd82 opened this issue May 25, 2022 · 6 comments
Labels

Comments

@basd82
Copy link

basd82 commented May 25, 2022

When i run the check_apt plug localy on a ubuntu 22.04 server i get:
/usr/lib/nagios/plugins/check_apt
APT OK: 0 packages available for upgrade (0 critical updates). |available_upgrades=0;;;0 critical_updates=0;;;0
when i run the the command with nrpe
/usr/local/nagios/libexec/check_nrpe -H 172.31.1.250 -c check_apt
APT WARNING: 2 packages available for upgrade (0 critical updates). |available_upgrades=2;;;0 critical_updates=0;;;0

it look liks nrpe does some caching ???

It works great on 20.04 but on 22.04 i have this.
After 1 or 2 days it reports correctly

version info
Server: nrpe Version: 4.0.3
client Version: 4.0.3

@sawolf
Copy link
Contributor

sawolf commented Jun 8, 2022

Hi @basd82, thanks for reaching out.

I don't think NRPE does any caching of check results. If you're skeptical, you can look over the source code yourself. It's a fairly small program.

The most likely cause for this issue is that you're running the plugin on two different machines and don't realize it - there are a few different situations where multiple machines (especially VMs) can think that they have the same IP address. If you haven't already, try using SSH from the check_nrpe machine into 172.31.1.250 and manually run check_apt from that terminal. If that still gets a different result from check_nrpe, troubleshooting gets a lot harder - maybe check the command configuration in nrpe.cfg? After that I'd probably be using gdb to attach to the running nrpe daemon, but that's pretty involved.

@sawolf sawolf added the Question label Jun 8, 2022
@kevinwincott
Copy link

I have exactly the same issue:

$# /usr/lib/nagios/plugins/check_apt
 APT OK: 0 packages available for upgrade (0 critical updates). |available_upgrades=0;;;0 critical_updates=0;;;0

$# /usr/lib/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_apt 
APT WARNING: 9 packages available for upgrade (0 critical updates). |available_upgrades=9;;;0 critical_updates=0;;;0

@kevinwincott
Copy link

kevinwincott commented Jun 24, 2022

Here is the NRPE log:

[1656085752] CONN_CHECK_PEER: checking if host is allowed: XX port XX
[1656085752] Connection from XX port XX
[1656085752] is_an_allowed_host (AF_INET): is host >XX< an allowed host >XX<
[1656085752] is_an_allowed_host (AF_INET): host is in allowed host list!
[1656085752] Host address is in allowed_hosts
[1656085752] Host XXis asking for command 'check_apt' to be run...
[1656085752] Running command: /usr/lib/nagios/plugins/check_apt -t 60
[1656085752] WARNING: my_system() seteuid(0): Operation not permitted
[1656085753] Command completed with return code 1 and output: APT WARNING: 7 packages available for upgrade (0 critical updates). |available_upgrades=7;;;0 critical_updates=0;;;0
[1656085753] Return Code: 1, Output: APT WARNING: 7 packages available for upgrade (0 critical updates). |available_upgrades=7;;;0 critical_updates=0;;;0
[1656085753] Connection from XXclosed.

@basd82
Copy link
Author

basd82 commented Jun 24, 2022 via email

@basd82
Copy link
Author

basd82 commented Jun 25, 2022

Issue is also with other check command's

for example simple script that checks if a reboot is needed:

#!/bin/bash

if [ -f /var/run/reboot-required ]; then
        echo "WARNING, Reboot is nodig"
        exit 1
else
        echo "OK, geen reboot nodig"
        exit 0
fi

Strange sting is thats only with ubuntu 22.04 servers at my end
But for this script a reboot of nagios server solves the issue, but for apt it doesn't

@yabrab
Copy link

yabrab commented Feb 15, 2023

Hi !

Did you find a workaround for this problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants