Page 1 of 2

yum update alert incorrect

Posted: Wed Oct 26, 2016 12:13 pm
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??

Re: yum update alert incorrect

Posted: Wed Oct 26, 2016 12:48 pm
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?

Re: yum update alert incorrect

Posted: Wed Oct 26, 2016 12:54 pm
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 `('

Re: yum update alert incorrect

Posted: Wed Oct 26, 2016 12:57 pm
by rkennedy
The command you'll want to run is yum check-update - the rest of that part is from the actual plugin.

Re: yum update alert incorrect

Posted: Wed Oct 26, 2016 1:40 pm
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

Re: yum update alert incorrect

Posted: Wed Oct 26, 2016 1:47 pm
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


Re: yum update alert incorrect

Posted: Wed Oct 26, 2016 4:41 pm
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 ~]#

Re: yum update alert incorrect

Posted: Wed Oct 26, 2016 4:51 pm
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.

Re: yum update alert incorrect

Posted: Wed Oct 26, 2016 6:42 pm
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

Re: yum update alert incorrect

Posted: Thu Oct 27, 2016 8:51 am
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.