yum update alert incorrect

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

yum update alert incorrect

Post by JohnFLi »

I have a handfull of centos systems that I run the 'check_yum' check on. the centos install range from 6.5 to 7. something.
but the issue is, Nagios is reporting "YUM WARNING: O/S requires an update. " on several machines (os version doesn't seem to matter)
I ssh into the machines, run yum update and it comes back with saying "no packages marked for update"

any ideas on what is going on??
Everybody is somebody else’s weirdo
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: yum update alert incorrect

Post by rkennedy »

Which check_yum script are you using? If it's the one deployed with XI, then here's the logic behind it. (not much)

Code: Select all

$yum = system("yum check-update >/dev/null");

if ($yum != 0)
{
  print "YUM WARNING:  O/S requires an update.\n";
  exit $exit_codes{'WARNING'};
}
It looks like it's just using yum check-update to determine what the answer is. Does that command come back clean as well?
Former Nagios Employee
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: yum update alert incorrect

Post by JohnFLi »

just using the generic check from XI
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 700 -c $ARG1$ $ARG2$
$ARG1$ check_yum
# $yum = system("yum check-update >/dev/null");
-bash: syntax error near unexpected token `('
Everybody is somebody else’s weirdo
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: yum update alert incorrect

Post by rkennedy »

The command you'll want to run is yum check-update - the rest of that part is from the actual plugin.
Former Nagios Employee
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: yum update alert incorrect

Post by JohnFLi »

]# yum check-update
Loaded plugins: fastestmirror, langpacks, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
Loading mirror speeds from cached hostfile
Everybody is somebody else’s weirdo
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: yum update alert incorrect

Post by rkennedy »

Was there anything else outputted?

For example on mine it comes back with packages -

Code: Select all

[root@localhost libexec]# yum check-update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.steadfast.net
 * extras: bay.uchicago.edu
 * updates: centos.mirrors.wvstateu.edu

audit.x86_64                                                2.4.5-3.el6                                        base
audit-libs.x86_64                                           2.4.5-3.el6                                        base
avahi-libs.x86_64                                           0.6.25-15.el6_8.1                                  updates
b43-openfwwf.noarch                                         5.2-10.el6                                         base
bash.x86_64                                                 4.1.2-40.el6                                       base
bfa-firmware.noarch                                         3.2.23.0-2.el6                                     base
binutils.x86_64                                             2.20.51.0.2-5.44.el6                               base
ca-certificates.noarch                                      2015.2.6-65.0.1.el6_7                              base
chkconfig.x86_64                                            1.3.49.5-1.el6                                     base

Former Nagios Employee
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: yum update alert incorrect

Post by JohnFLi »

[root@alfresco ~]# yum check-update
Loaded plugins: fastestmirror, langpacks, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
Loading mirror speeds from cached hostfile
[root@alfresco ~]#
Everybody is somebody else’s weirdo
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: yum update alert incorrect

Post by avandemore »

Your post said CentOS boxes, but your output says RHEL. This error actually makes more sense as a RHEL issue. See this:

https://sourceforge.net/p/nagios/mailma ... /22112176/

Does the fix from there apply to you?:
It seems that your /etc/sudoers contains a line

'Defaults requiretty'

If you comment it, also connections without a real tty are allowed
to run sudo commands.
Previous Nagios employee
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: yum update alert incorrect

Post by JohnFLi »

the "Default requiretty" is there and is NOT commented out.

but I don't understand why that would make Nagios say there are updates for it, yet the system itself doesn't think so
Everybody is somebody else’s weirdo
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: yum update alert incorrect

Post by avandemore »

I don't understand why that would make Nagios say there are updates for it
If yum repo's need to be updated, root access is required on RHEL. The plugin runs as user nagios.
yet the system itself doesn't think so
Most likely you were running as root.
Previous Nagios employee
Locked