matteocorti / nagios_plugins

18 stars 7 forks source link

Sometimes yum blocks itself #116

Closed matteocorti closed 8 years ago

matteocorti commented 8 years ago

Original reporter: roland.wolters@credativ.de

I use this plugin on CentOS 6.3 machines. If new updates occur, the plugin sometimes flapps in Icinga. If I call the plugin in a while loop I indeed see output indicating that yum blocks itself:

[root@DATA01 ~]# while [ 1 ]; do /usr/lib64/nagios/plugins/check_updates -t 60 -vvv; sleep 2; done

[extra-opts] check_updates -t 60 -vvv
Checking a linux system
Running on CentOS release 6.3 (Final)
Using yum
running a Linux kernel: 2.6.32-279.19.1
kernel: running # 2.6.32-279.19.1, installed2.6.32-279.19.1
Loaded plugins: fastestmirror, presto, security
Security plugin installed
Loading mirror speeds from cached hostfile
 - epel: mirror.fraunhofer.de
 - extras: swissmirror.silyus.net

kernel.x86_64                         2.6.32-279.22.1.el6                updates
kernel-firmware.noarch                2.6.32-279.22.1.el6                updates
Security updates available
Loaded plugins: fastestmirror, presto, security
Loading mirror speeds from cached hostfile
 - epel: mirror.fraunhofer.de
 - extras: swissmirror.silyus.net
Limiting package lists to security relevant ones
No packages needed for security; 2 packages available
CHECK_UPDATES CRITICAL - 2 non-critical updates available | total_updates=2;0;0 security_updates=0;0;0
kernel.x86_64
kernel-firmware.noarch

[...] 

[extra-opts] check_updates -t 60 -vvv
Checking a linux system
Running on CentOS release 6.3 (Final)
Using yum
running a Linux kernel: 2.6.32-279.19.1
kernel: running # 2.6.32-279.19.1, installed2.6.32-279.19.1
Loaded plugins: fastestmirror, presto, security
Security plugin installed
Existing lock /var/run/yum.pid: another copy is running as pid 7040.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  63 M RSS (740 MB VSZ)
    Started: Thu Feb  7 11:05:17 2013 - 00:01 ago
    State  : Running, pid: 7040
Existing lock /var/run/yum.pid: another copy is running as pid 7063.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  51 M RSS (728 MB VSZ)
    Started: Thu Feb  7 11:05:19 2013 - 00:01 ago
    State  : Running, pid: 7063
Loading mirror speeds from cached hostfile
 - epel: mirror.fraunhofer.de
 - extras: swissmirror.silyus.net

kernel.x86_64                         2.6.32-279.22.1.el6                updates
kernel-firmware.noarch                2.6.32-279.22.1.el6                updates
Security updates available
Loaded plugins: fastestmirror, presto, security
Loading mirror speeds from cached hostfile
 - epel: mirror.fraunhofer.de
 - extras: swissmirror.silyus.net
Limiting package lists to security relevant ones
No packages needed for security; 2 packages available
CHECK_UPDATES CRITICAL - 2 non-critical updates available | total_updates=2;0;0 security_updates=0;0;0
kernel.x86_64
kernel-firmware.noarch
matteocorti commented 8 years ago

Original reporter: matteo@corti.li

Dear Roland,

The behavior of the plugin is normal and expected.

yum blocks when another instance is running and waits for the other instance to finish.

This means that if another check or an update is running, the plugin, which uses yum, will wait that the other yum process is finished.

Depending on your system this could take more time than the timeout you specified. If the timeout is reached the plugin will exit with a status UNKNOWN. Since this happens only from time to time the exit status of the plugin will switch from OK to UNKNOWN and back from time to time: hence the flapping status.

The only solution would be either: