HariSekhon / Nagios-Plugins

450+ AWS, Hadoop, Cloud, Kafka, Docker, Elasticsearch, RabbitMQ, Redis, HBase, Solr, Cassandra, ZooKeeper, HDFS, Yarn, Hive, Presto, Drill, Impala, Consul, Spark, Jenkins, Travis CI, Git, MySQL, Linux, DNS, Whois, SSL Certs, Yum Security Updates, Kubernetes, Cloudera etc...
https://www.linkedin.com/in/HariSekhon
Other
1.13k stars 503 forks source link

check_yum.py YUM WARNING: Cannot find summary line in yum output RHEL 8.1 #328

Closed bakkc closed 4 years ago

bakkc commented 4 years ago

Hi, while a was testing your check_yum.py i encoutered the following message running on a RHEL8.1.

YUM WARNING: Cannot find summary line in yum output.

Below the -vvv output.

rhel81:root:/home/root/> ./check_yum.py -vvv Nagios Plugin for Yum updates on RedHat/CentOS systems - Version 0.10.3 Author: Hari Sekhon

setting plugin timeout to 30 seconds running command: /usr/bin/yum --security check-update Returncode: '100' Output: 'Updating Subscription Management repositories. nagios 170 kB/s | 2.4 kB 00:00
nmon 221 kB/s | 2.4 kB 00:00
tbmr 494 kB/s | 2.4 kB 00:00
tsmclient 553 kB/s | 2.4 kB 00:00
Extra Packages for Enterprise Linux Modular 8 - 67 kB/s | 34 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 17 kB/s | 9.8 kB 00:00
Red Hat Enterprise Linux 8 for x86_64 - AppStre 15 kB/s | 4.5 kB 00:00
Red Hat Enterprise Linux 8 for x86_64 - BaseOS 14 kB/s | 4.1 kB 00:00
Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (R 14 kB/s | 4.0 kB 00:00

kernel.x86_64 4.18.0-147.8.1.el8_1 rhel-8-for-x86_64-baseos-rpms kernel-core.x86_64 4.18.0-147.8.1.el8_1 rhel-8-for-x86_64-baseos-rpms kernel-modules.x86_64 4.18.0-147.8.1.el8_1 rhel-8-for-x86_64-baseos-rpms kernel-tools.x86_64 4.18.0-147.8.1.el8_1 rhel-8-for-x86_64-baseos-rpms kernel-tools-libs.x86_64 4.18.0-147.8.1.el8_1 rhel-8-for-x86_64-baseos-rpms python3-perf.x86_64 4.18.0-147.8.1.el8_1 rhel-8-for-x86_64-baseos-rpms ' YUM WARNING: Cannot find summary line in yum output.

HariSekhon commented 4 years ago

That's because there is really no summary line nor any information returned by yum/dnf around package updates.

I've just tried this on CentOS 8.1 in docker

# ./check_yum.py -vvv
Nagios Plugin for Yum updates on RedHat/CentOS systems - Version 0.10.3
Author: Hari Sekhon

setting plugin timeout to 30 seconds
running command: /usr/bin/yum --security check-update
Returncode: '0'
Output: 'Last metadata expiration check: 0:00:28 ago on Fri Apr 17 12:11:57 2020.
Failed to set locale, defaulting to C.UTF-8
No security updates needed, but 22 updates available
'
YUM OK: 0 Security Updates Available. 22 Non-Security Updates Available | security_updates_available=0 non_security_updates_available=22 total_updates_available=22

my version:

[root@cfbb9a40844b pwd]# cat /etc/*release
CentOS Linux release 8.1.1911 (Core) 
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

CentOS Linux release 8.1.1911 (Core) 
CentOS Linux release 8.1.1911 (Core) 

Iirc in some cases the code will make exceptions and infer other ways to account for various environments and versions.

Could you please tell me more about your environment, is it different to stock? Noticing "subscription management repositories"... is this a Satellite managed system?

Do you have any other systems you've tried this on with different results for comparison?

bakkc commented 4 years ago

It is a standaard redhat enterprise installation. Started from 8.0 and updated to 8.1. server8:root:/root> cat /etc/*release NAME="Red Hat Enterprise Linux" VERSION="8.1 (Ootpa)" ID="rhel" ID_LIKE="fedora" VERSION_ID="8.1" PLATFORM_ID="platform:el8" PRETTY_NAME="Red Hat Enterprise Linux 8.1 (Ootpa)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:redhat:enterprise_linux:8.1:GA" HOME_URL="https://www.redhat.com/" BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8" REDHAT_BUGZILLA_PRODUCT_VERSION=8.1 REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" REDHAT_SUPPORT_PRODUCT_VERSION="8.1" Red Hat Enterprise Linux release 8.1 (Ootpa) Red Hat Enterprise Linux release 8.1 (Ootpa) I had to set the python3 in the check_yum.py instead of python to make it run.

Server is properly registered to redhat network. Is the only rhel8 we have at the moment and if i run the command from the prompt i also don't get NO summary. Do i mis a package?

HariSekhon commented 4 years ago

It's probably do to with the setup of redhat network affecting the output of yum (dnf).

Do you have any other servers which require package upgrades, either 8.0 or 8.1 that are connected to redhat network?

If you can send me the output of /usr/bin/yum --security check-update on those systems I can write a fix in for your environment.

Ps. the Python3 thing is the fault of the python developers causing carnage and the RHEL developers not knowing what to do with that mess by default. I solve it by running this script in my DevOps Bash Tools repo.

This is called by default in newer builds of the underlying pylib submodule, and I'm thinking of extending this to all builds now because Python is used all over the place.

tonybrooks86 commented 4 years ago

Hi - I was also getting this error when using RH8 and RH Satellite 6. Turned out it was the epel version of the qpid-proton-c package that was causing the issue. This was fixed for me by doing the following;

yum remove qpid-proton-c -y yum --disablerepo=EPEL install katello-agent -y systemctl restart goferd

bakkc commented 4 years ago

Hi, qpid-proton-c is not installed on this system unfortunatly. Will install a fresh system in the next few days. I'll be back :-)

bakkc commented 4 years ago

Hi Hari, here i am with the requested output. I see that rhel 8 does not return summary lines. Below the output of yum check-update --security. Specs: Red Hat Enterprise Linux release 8.1 (Ootpa) Linux rhel8system.boekhuis.nl 4.18.0-147.el8.x86_64 #1 SMP Thu Sep 26 15:52:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

rhel8system:root:/usr/lib64/nagios/plugins> /usr/bin/yum --security check-update Updating Subscription Management repositories. Last metadata expiration check: 1:39:17 ago on Wed 27 May 2020 08:38:51 AM CEST.

bind-export-libs.x86_64 32:9.11.13-3.el8 rhel-8-for-x86_64-baseos-rpms
curl.x86_64 7.61.1-12.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-client.x86_64 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-common.noarch 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-libs.x86_64 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
e2fsprogs.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
e2fsprogs-libs.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
elfutils-default-yama-scope.noarch 0.178-7.el8 rhel-8-for-x86_64-baseos-rpms
glib2.x86_64 2.56.4-8.el8 rhel-8-for-x86_64-baseos-rpms
glibc.x86_64 2.28-101.el8 rhel-8-for-x86_64-baseos-rpms
glibc-common.x86_64 2.28-101.el8 rhel-8-for-x86_64-baseos-rpms
glibc-langpack-en.x86_64 2.28-101.el8 rhel-8-for-x86_64-baseos-rpms
gnutls.x86_64 3.6.8-10.el8_2 rhel-8-for-x86_64-baseos-rpms
grub2-common.noarch 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-pc.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-pc-modules.noarch 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools-extra.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools-minimal.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
kernel.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-core.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-modules.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-tools.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-tools-libs.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
libarchive.x86_64 3.3.2-8.el8_1 rhel-8-for-x86_64-baseos-rpms
libcom_err.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
libcomps.x86_64 0.1.11-4.el8 rhel-8-for-x86_64-baseos-rpms
libcurl.x86_64 7.61.1-12.el8 rhel-8-for-x86_64-baseos-rpms
libgcc.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libgomp.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libicu.x86_64 60.3-2.el8_1 rhel-8-for-x86_64-baseos-rpms
libmspack.x86_64 0.7-0.3.alpha.el8.4 rhel-8-for-x86_64-appstream-rpms libss.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
libsss_autofs.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_certmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_nss_idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_sudo.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libstdc++.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libxml2.x86_64 2.9.7-7.el8 rhel-8-for-x86_64-baseos-rpms
libxslt.x86_64 1.1.32-4.el8 rhel-8-for-x86_64-baseos-rpms
mozjs60.x86_64 60.9.0-4.el8 rhel-8-for-x86_64-baseos-rpms
openssh.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssh-clients.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssh-server.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssl.x86_64 1:1.1.1c-15.el8 rhel-8-for-x86_64-baseos-rpms
openssl-libs.x86_64 1:1.1.1c-15.el8 rhel-8-for-x86_64-baseos-rpms
platform-python.x86_64 3.6.8-23.el8 rhel-8-for-x86_64-baseos-rpms
platform-python-pip.noarch 9.0.3-16.el8 rhel-8-for-x86_64-baseos-rpms
plymouth.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms plymouth-core-libs.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms plymouth-scripts.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms python3-libcomps.x86_64 0.1.11-4.el8 rhel-8-for-x86_64-baseos-rpms
python3-libs.x86_64 3.6.8-23.el8 rhel-8-for-x86_64-baseos-rpms
python3-libxml2.x86_64 2.9.7-7.el8 rhel-8-for-x86_64-baseos-rpms
python3-perf.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
python3-pip.noarch 9.0.3-16.el8 rhel-8-for-x86_64-appstream-rpms python3-pip-wheel.noarch 9.0.3-16.el8 rhel-8-for-x86_64-baseos-rpms
python3-unbound.x86_64 1.7.3-10.el8 rhel-8-for-x86_64-appstream-rpms rsyslog.x86_64 8.1911.0-3.el8 rhel-8-for-x86_64-appstream-rpms sqlite-libs.x86_64 3.26.0-6.el8 rhel-8-for-x86_64-baseos-rpms
sssd-client.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-common.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-kcm.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-nfs-idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sudo.x86_64 1.8.29-5.el8 rhel-8-for-x86_64-baseos-rpms
systemd.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-libs.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-pam.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-udev.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
unbound-libs.x86_64 1.7.3-10.el8 rhel-8-for-x86_64-appstream-rpms Obsoleting Packages grub2-tools.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-efi.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-efi.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-extra.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-extra.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-minimal.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-minimal.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
rhel8system:root:/usr/lib64/nagios/plugins>

bakkc commented 4 years ago

Hi Hari,

i've also another rhel8.1 system , but dito result. It seems that yum check-update --security does not return a summary anymore.

rhcobbler:root:/root> yum check-update --security Updating Subscription Management repositories. Last metadata expiration check: 2:13:54 ago on Tue 02 Jun 2020 02:22:15 PM CEST.

bind-export-libs.x86_64 32:9.11.13-5.el8_2 rhel-8-for-x86_64-baseos-rpms
curl.x86_64 7.61.1-12.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-client.x86_64 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-common.noarch 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-libs.x86_64 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
e2fsprogs.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
e2fsprogs-libs.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
elfutils-default-yama-scope.noarch 0.178-7.el8 rhel-8-for-x86_64-baseos-rpms
glib2.x86_64 2.56.4-8.el8 rhel-8-for-x86_64-baseos-rpms
glibc.x86_64 2.28-101.el8 rhel-8-for-x86_64-baseos-rpms
glibc-common.x86_64 2.28-101.el8 rhel-8-for-x86_64-baseos-rpms
glibc-langpack-en.x86_64 2.28-101.el8 rhel-8-for-x86_64-baseos-rpms
gnutls.x86_64 3.6.8-10.el8_2 rhel-8-for-x86_64-baseos-rpms
grub2-common.noarch 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-pc.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-pc-modules.noarch 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools-extra.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools-minimal.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
kernel.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-core.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-modules.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-tools.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-tools-libs.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
libarchive.x86_64 3.3.2-8.el8_1 rhel-8-for-x86_64-baseos-rpms
libcom_err.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
libcomps.x86_64 0.1.11-4.el8 rhel-8-for-x86_64-baseos-rpms
libcurl.x86_64 7.61.1-12.el8 rhel-8-for-x86_64-baseos-rpms
libgcc.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libgomp.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libicu.x86_64 60.3-2.el8_1 rhel-8-for-x86_64-baseos-rpms
libmspack.x86_64 0.7-0.3.alpha.el8.4 rhel-8-for-x86_64-appstream-rpms libss.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
libsss_autofs.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_certmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_nss_idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_sudo.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libstdc++.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libxml2.x86_64 2.9.7-7.el8 rhel-8-for-x86_64-baseos-rpms
libxslt.x86_64 1.1.32-4.el8 rhel-8-for-x86_64-baseos-rpms
mozjs60.x86_64 60.9.0-4.el8 rhel-8-for-x86_64-baseos-rpms
openssh.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssh-clients.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssh-server.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssl.x86_64 1:1.1.1c-15.el8 rhel-8-for-x86_64-baseos-rpms
openssl-libs.x86_64 1:1.1.1c-15.el8 rhel-8-for-x86_64-baseos-rpms
platform-python.x86_64 3.6.8-23.el8 rhel-8-for-x86_64-baseos-rpms
platform-python-pip.noarch 9.0.3-16.el8 rhel-8-for-x86_64-baseos-rpms
plymouth.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms plymouth-core-libs.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms plymouth-scripts.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms python3-libcomps.x86_64 0.1.11-4.el8 rhel-8-for-x86_64-baseos-rpms
python3-libs.x86_64 3.6.8-23.el8 rhel-8-for-x86_64-baseos-rpms
python3-libxml2.x86_64 2.9.7-7.el8 rhel-8-for-x86_64-baseos-rpms
python3-perf.x86_64 4.18.0-193.1.2.el8_2 rhel-8-for-x86_64-baseos-rpms
python3-pip.noarch 9.0.3-16.el8 rhel-8-for-x86_64-appstream-rpms python3-pip-wheel.noarch 9.0.3-16.el8 rhel-8-for-x86_64-baseos-rpms
python3-unbound.x86_64 1.7.3-10.el8 rhel-8-for-x86_64-appstream-rpms rsyslog.x86_64 8.1911.0-3.el8 rhel-8-for-x86_64-appstream-rpms sqlite-libs.x86_64 3.26.0-6.el8 rhel-8-for-x86_64-baseos-rpms
sssd-client.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-common.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-kcm.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-nfs-idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sudo.x86_64 1.8.29-5.el8 rhel-8-for-x86_64-baseos-rpms
systemd.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-libs.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-pam.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-udev.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
unbound-libs.x86_64 1.7.3-10.el8 rhel-8-for-x86_64-appstream-rpms Obsoleting Packages grub2-tools.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-efi.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-efi.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-extra.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-extra.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-minimal.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-minimal.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda

mlude commented 4 years ago

dnf check-update uses different exit codes, 100 if updates are available, 0 if not, 1 if an error occurs

maybe at least mention in the check, that there are some updates available

bakkc commented 4 years ago

Maybe is the use op yum updateinfo a better way to check for updates. As far as i can see it offers more granular options. This works for rhel6 and rhel7 too.

rhcobbler:root:/root> yum updateinfo Updating Subscription Management repositories. Last metadata expiration check: 0:53:25 ago on Tue 09 Jun 2020 01:13:05 PM CEST. Updates Information Summary: available 1 New Package notice(s) 32 Security notice(s) 13 Important Security notice(s) 18 Moderate Security notice(s) 1 Low Security notice(s) 85 Bugfix notice(s) 17 Enhancement notice(s)

bakkc commented 4 years ago

Hi Hari, is this still work in progress?

HariSekhon commented 4 years ago

@bakkc @mlude thanks for the feedback guys

Looks like yum updateinfo is available from Centos 7 & 8 only in my testing... whereas this code was written on RHEL5 in the 2000s and extended to support all server versions since, so I'd have to incorporate both checks for portability.

Unfortunately when there aren't updates yum updateinfo doesn't output any of those lines mentioned above, which means there is a risk of parse failure going undetected should the format change in future. I'd prefer if it retained the 0 security packages / No security updates needed type message so that we know we have definitely parsed correctly without some random rhel update to yum/dnf breaking the parsing so we're confident there definitely are no security updates required.

I tend to code defensively to try to avoid anything getting past the parser, so I'm thinking of doing this as a secondary fallback check.

I'll write an update and test.

HariSekhon commented 4 years ago

I've just pushed a fix with yum updateinfo as a secondary fallback check for those on redhat network subscriptions.

I've also found some inconsistencies between yum updateinfo and the yum security updates plugin where the latter seems more reliable - this is documented in the code, eg. where if there are no security updates but only non-security updates, yum updateinfo will return no output, leading to miss the non-security updates that are found by yum security updates plugin.

A useful reference for options around this stuff is here (a link is also in the code):

https://access.redhat.com/solutions/10021

It's worth nothing that while that page says RHEL 6 has yum updateinfo, it seems in testing that CentOS 6 does not - this is also documented in the code.

Please git pull and try the latest version and let me know how you get on. For most users not on RHEL + Redhat network subscription, the code will continue to work as before, with some enhanced parsing validation, as I've tested this on CentOS with updates available.

bakkc commented 4 years ago

Hi Hari, i ran the latest but getting the following:

rhel8system:root:/usr/lib64/nagios/plugins> ./check_yum.py -vvv Nagios Plugin for Yum updates on RedHat/CentOS systems - Version 0.11.0 Author: Hari Sekhon

setting plugin timeout to 30 seconds running command: /usr/bin/yum --security check-update Returncode: '100' Output: 'Updating Subscription Management repositories. Last metadata expiration check: 1:14:37 ago on Sun 28 Jun 2020 01:41:51 PM CEST.

bind-export-libs.x86_64 32:9.11.13-5.el8_2 rhel-8-for-x86_64-baseos-rpms
curl.x86_64 7.61.1-12.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-client.x86_64 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-common.noarch 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
dhcp-libs.x86_64 12:4.3.6-40.el8 rhel-8-for-x86_64-baseos-rpms
e2fsprogs.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
e2fsprogs-libs.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
elfutils-default-yama-scope.noarch 0.178-7.el8 rhel-8-for-x86_64-baseos-rpms
glib2.x86_64 2.56.4-8.el8 rhel-8-for-x86_64-baseos-rpms
gnutls.x86_64 3.6.8-11.el8_2 rhel-8-for-x86_64-baseos-rpms
grub2-common.noarch 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-pc.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-pc-modules.noarch 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools-extra.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools-minimal.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
kernel.x86_64 4.18.0-193.6.3.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-core.x86_64 4.18.0-193.6.3.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-modules.x86_64 4.18.0-193.6.3.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-tools.x86_64 4.18.0-193.6.3.el8_2 rhel-8-for-x86_64-baseos-rpms
kernel-tools-libs.x86_64 4.18.0-193.6.3.el8_2 rhel-8-for-x86_64-baseos-rpms
libarchive.x86_64 3.3.2-8.el8_1 rhel-8-for-x86_64-baseos-rpms
libcom_err.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
libcomps.x86_64 0.1.11-4.el8 rhel-8-for-x86_64-baseos-rpms
libcurl.x86_64 7.61.1-12.el8 rhel-8-for-x86_64-baseos-rpms
libgcc.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libgomp.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libicu.x86_64 60.3-2.el8_1 rhel-8-for-x86_64-baseos-rpms
libmspack.x86_64 0.7-0.3.alpha.el8.4 rhel-8-for-x86_64-appstream-rpms libnghttp2.x86_64 1.33.0-3.el8_2.1 rhel-8-for-x86_64-baseos-rpms
libss.x86_64 1.45.4-3.el8 rhel-8-for-x86_64-baseos-rpms
libsss_autofs.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_certmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_nss_idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libsss_sudo.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
libstdc++.x86_64 8.3.1-5.el8 rhel-8-for-x86_64-baseos-rpms
libxml2.x86_64 2.9.7-7.el8 rhel-8-for-x86_64-baseos-rpms
libxslt.x86_64 1.1.32-4.el8 rhel-8-for-x86_64-baseos-rpms
microcode_ctl.x86_64 4:20191115-4.20200609.1.el8_2 rhel-8-for-x86_64-baseos-rpms
mozjs60.x86_64 60.9.0-4.el8 rhel-8-for-x86_64-baseos-rpms
openssh.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssh-clients.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssh-server.x86_64 8.0p1-4.el8_1 rhel-8-for-x86_64-baseos-rpms
openssl.x86_64 1:1.1.1c-15.el8 rhel-8-for-x86_64-baseos-rpms
openssl-libs.x86_64 1:1.1.1c-15.el8 rhel-8-for-x86_64-baseos-rpms
platform-python.x86_64 3.6.8-23.el8 rhel-8-for-x86_64-baseos-rpms
platform-python-pip.noarch 9.0.3-16.el8 rhel-8-for-x86_64-baseos-rpms
plymouth.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms plymouth-core-libs.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms plymouth-scripts.x86_64 0.9.3-16.el8 rhel-8-for-x86_64-appstream-rpms python3-libcomps.x86_64 0.1.11-4.el8 rhel-8-for-x86_64-baseos-rpms
python3-libs.x86_64 3.6.8-23.el8 rhel-8-for-x86_64-baseos-rpms
python3-libxml2.x86_64 2.9.7-7.el8 rhel-8-for-x86_64-baseos-rpms
python3-perf.x86_64 4.18.0-193.6.3.el8_2 rhel-8-for-x86_64-baseos-rpms
python3-pip.noarch 9.0.3-16.el8 rhel-8-for-x86_64-appstream-rpms python3-pip-wheel.noarch 9.0.3-16.el8 rhel-8-for-x86_64-baseos-rpms
python3-unbound.x86_64 1.7.3-11.el8_2 rhel-8-for-x86_64-appstream-rpms rsyslog.x86_64 8.1911.0-3.el8 rhel-8-for-x86_64-appstream-rpms sqlite-libs.x86_64 3.26.0-6.el8 rhel-8-for-x86_64-baseos-rpms
sssd-client.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-common.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-kcm.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sssd-nfs-idmap.x86_64 2.2.3-20.el8 rhel-8-for-x86_64-baseos-rpms
sudo.x86_64 1.8.29-5.el8 rhel-8-for-x86_64-baseos-rpms
systemd.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-libs.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-pam.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
systemd-udev.x86_64 239-30.el8_2 rhel-8-for-x86_64-baseos-rpms
unbound-libs.x86_64 1.7.3-11.el8_2 rhel-8-for-x86_64-appstream-rpms Obsoleting Packages grub2-tools.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-efi.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-efi.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-extra.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-extra.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-minimal.x86_64 1:2.02-78.el8_1.1 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
grub2-tools-minimal.x86_64 1:2.02-81.el8 rhel-8-for-x86_64-baseos-rpms
grub2-tools.x86_64 1:2.02-78.el8 @anaconda
' running command: yum updateinfo Returncode: '0' Output: 'Updating Subscription Management repositories. Last metadata expiration check: 1:14:41 ago on Sun 28 Jun 2020 01:41:51 PM CEST. Updates Information Summary: available 36 Security notice(s) 16 Important Security notice(s) 19 Moderate Security notice(s) 1 Low Security notice(s) 89 Bugfix notice(s) 18 Enhancement notice(s) ' yuminfo output: ['Updating Subscription Management repositories.', 'Last metadata expiration check: 1:14:41 ago on Sun 28 Jun 2020 01:41:51 PM CEST.', 'Updates Information Summary: available', ' 36 Security notice(s)', ' 16 Important Security notice(s)', ' 19 Moderate Security notice(s)', ' 1 Low Security notice(s)', ' 89 Bugfix notice(s)', ' 18 Enhancement notice(s)', ''] YUM WARNING: Yum output signature (71 unique lines) is larger than number of total updates (0). Please make sure you have upgraded to the latest version from https://github.com/harisekhon/nagios-plugins. If the problem persists, please raise a ticket at https://github.com/harisekhon/nagios-plugins/issues with the full -vvv output

HariSekhon commented 4 years ago

Ah, the debug output shows that there are spaces before the numbers on the yum updateinfo lines which didn't show in your original pasted output (GitHub markdown hides the leading spaces), so I've just added a quick fix for this, please git pull and try again.

bakkc commented 4 years ago

Hi Hari,

check works fine now om rhel8. Thanks.

On rhel7.8 a get :

No packages needed for security; 0 packages available ' YUM WARNING: Yum output signature (2 unique lines) is larger than number of total updates (0). Please make sure you have upgraded to the latest version from https://github.com/harisekhon/nagios-plugins. If the problem persists, please raise a ticket at https://github.com/harisekhon/nagios-plugins/issues with the full -vvv output

On rhel5 6.5:

somehost:root:/usr/lib64/nagios/plugins> ./check_yum.py -vvv File "./check_yum.py", line 466 lenoutput = len({.split()[0] for _ in output}) ^ SyntaxError: invalid syntax

HariSekhon commented 4 years ago

The second error is caused by using a set comprehension which isn't supported in old Python 2.6 on RHEL 6. This is partly the fault of my linting tool for insisting on changing that code and partly my fault for forgetting about Python 2.6 since almost nothing today supports it... but because this is widely used and RHEL 6 is still important, I've rewritten that bit to be backwards compatible and tested it on CentOS 6.

For the first error I've written a fix for but the sample output you've shown might be truncated / incomplete as when I run it I get Yum output signature (1 unique lines), for which I've written a fix for.

Please git pull and try the latest version, and if there is still any issue please check if you are pasting the full -vvv output for me to reproduce.

bakkc commented 4 years ago

rhel8.1 with updates: YUM OK: 0 Security Updates Available. 123 Non-Security Updates Available | security_updates_available=0 non_security_updates_available=123 total_updates_available=123

rhel7.8 with updates: YUM CRITICAL: 13 Security Updates Available. 26 Non-Security Updates Available | security_updates_available=13 non_security_updates_available=26 total_updates_available=39

rhel7.8 updated: No packages needed for security; 0 packages available ' YUM WARNING: Yum output signature (1 unique lines) is larger than number of total updates (0).

rhel7.7 with updates: YUM CRITICAL: 13 Security Updates Available. 46 Non-Security Updates Available | security_updates_available=13 non_security_updates_available=46 total_updates_available=59

rhel7.7 updated: No packages needed for security; 0 packages available ' YUM WARNING: Yum output signature (1 unique lines) is larger than number of total updates (0).

Centos 6.10 Final YUM OK: 0 Security Updates Available. 8 Non-Security Updates Available | security_updates_available=0 non_security_updates_available=8 total_updates_available=8

Looks like when all is updated the check gives a "Yum output signature"

HariSekhon commented 4 years ago

Can you please paste the complete outputs for the ones that are returning "Yum output signature" on RHEL7, the quoting looks like it's missing the opening quote or another line which might be triggering this for me to reproduce it. Basically any unrecognized line from the yum output can trigger this which is why I need the complete outputs from start to finish to add them to regex exclusions.

Alternatively is that stray single quote being returned by yum and not inserted by you?? It's not clear, usually in markdown you wrap the outputs in triple backticks to be more clear.

bakkc commented 4 years ago

Hi Hari, the leght of the output is very long. Below the first lines en the last ones.

rhanstest1:root:/usr/lib64/nagios/plugins> ./check_yum.py -vvv Nagios Plugin for Yum updates on RedHat/CentOS systems - Version 0.11.1 Author: Hari Sekhon

setting plugin timeout to 30 seconds running command: /usr/bin/yum --security check-update Returncode: '0' Output: 'Loaded plugins: product-id, search-disabled-repos, subscription-manager --> nrpe-selinux-3.2.0-6.el7.x86_64 from cb_nagios excluded (updateinfo) --> nrpe-2.15-2.el7.x86_64 from cb_nagios excluded (updateinfo) --> nmon-14g-1.el6.rf.x86_64 from cb_nmon excluded (updateinfo) --> nmon-14g-1.el5.rf.x86_64 from cb_nmon excluded (updateinfo) --> nmon-14g-1.el6.rf.i686 from cb_nmon excluded (updateinfo) --> nmon-14g-1.el4.rf.x86_64 from cb_nmon excluded (updateinfo) --> nmon-14g-1.el5.rf.i386 from cb_nmon excluded (updateinfo) --> nmon-14g-1.el4.rf.i386 from cb_nmon excluded (updateinfo) --> tbmr-7.3-1.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-7.2-2.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-7.2-2.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-7.3-1.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-7.2-2.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-7.2-2.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-7.3-1.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-7.2-2.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-7.2-2.x86_64 from cb_tbmr excluded (updateinfo) --> tbmr-6.5-1.x86_64 from cb_tsmclient excluded (updateinfo) --> libsolv-devel-0.6.20-5.el7.i686 from rhel-7-server-optional-rpms excluded (updateinfo) ................. here a few thousand of the packages excluded list that i did not copy/paste. .................. --> 2:texlive-misc-svn24955.0-38.el7.noarch from rhel-7-server-rpms excluded (updateinfo) --> 1:NetworkManager-libnm-1.0.6-27.el7.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> ipa-server-4.2.0-15.el7_2.3.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> fence-agents-hpblade-4.0.11-27.el7.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> abrt-gui-libs-2.1.11-34.el7.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> 2:texlive-xdvi-bin-svn26509.0-38.20130427_r30134.el7.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> boost-signals-1.53.0-25.el7.i686 from rhel-7-server-rpms excluded (updateinfo) --> libvirt-daemon-driver-nwfilter-1.2.17-13.el7_2.2.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> libappstream-glib-0.3.6-1.el7.i686 from rhel-7-server-rpms excluded (updateinfo) --> logrotate-3.8.6-7.el7_2.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> Red_Hat_Enterprise_Linux-Release_Notes-7-de-DE-7-2.1.el7.noarch from rhel-7-server-rpms excluded (updateinfo) --> 1:telepathy-mission-control-5.16.3-2.el7.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> libvirt-daemon-config-nwfilter-1.2.17-13.el7_2.4.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> ipa-server-dns-4.2.0-15.el7_2.6.1.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> libtiff-4.0.3-25.el7_2.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> mdadm-3.3.2-7.el7_2.1.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> sssd-dbus-1.13.0-40.el7_2.4.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> ntp-4.2.6p5-22.el7_2.2.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> nss-util-3.21.3-1.1.el7_3.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> dmraid-events-1.0.0.rc16-26.el7_2.1.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> libgcrypt-1.5.3-13.el7_3.1.x86_64 from rhel-7-server-rpms excluded (updateinfo) --> initscripts-9.49.30-1.el7_2.2.x86_64 from rhel-7-server-rpms excluded (updateinfo) No packages needed for security; 0 packages available ' YUM WARNING: Yum output signature (1 unique lines) is larger than number of total updates (0). Please make sure you have upgraded to the latest version from https://github.com/harisekhon/nagios-plugins. If the problem persists, please raise a ticket at https://github.com/harisekhon/nagios-plugins/issues with the full -vvv output

HariSekhon commented 4 years ago

I've just pushed an update with more exclusions and in -vvv mode will also show the offending lines so I can write the fix without needing your entire output.

If you git pull and re-run with -vvv then the last few lines should suffice.

bakkc commented 4 years ago

All systems with "Yum output signature" messages works fine now.

HariSekhon commented 4 years ago

Ok thanks for confirming, closing.

bakkc commented 4 years ago

Thnx for all the efford. We are happy with your plugin. Have a nice day, and keep save.

Met vriendelijke groet,

Christian Bakker Systems & Networks

[cid:image001.jpg@01D64E3E.E2151660]http://www.cb.nl/

Postbus 125 4100 AC Culemborg +31 345 47 5452 c.bakker@cb.nlmailto:c.bakker@cb.nl

CB is een handelsnaam van Centraal Boekhuis B.V. Op alle werkzaamheden en rechtsverhoudingen van CB zijn de Algemene Voorwaarden van Centraal Boekhuis B.V. en haar dochtermaatschappijen van toepassing. Deze voorwaarden zijn gedeponeerd bij de KvK Midden Nederland te Tiel en zijn daar op te vragen via KvK-nummer 11011108. De voorwaarden worden op uw eerste verzoek ook toegezonden en kunnen direct worden geraadpleegd op www.cb.nl. De informatie verzonden met dit e-mail bericht (en eventuele bijlagen) is uitsluitend bestemd voor de geadresseerde(n) en CB verzoekt onjuiste adressering direct te melden. CB staat niet in voor het virusvrij verzenden van e-mail berichten, om welke reden u wordt gevraagd e-mail berichten bij ontvangst op virussen te controleren.

Van: Hari Sekhon notifications@github.com Verzonden: maandag 29 juni 2020 17:04 Aan: HariSekhon/Nagios-Plugins Nagios-Plugins@noreply.github.com CC: Bakker, Christian C.Bakker@cb.nl; Mention mention@noreply.github.com Onderwerp: Re: [HariSekhon/Nagios-Plugins] check_yum.py YUM WARNING: Cannot find summary line in yum output RHEL 8.1 (#328)

Closed #328https://github.com/HariSekhon/Nagios-Plugins/issues/328.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/HariSekhon/Nagios-Plugins/issues/328#event-3493184649, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFIHSLRQVKLCQSEUA3JXIBLRZCUOXANCNFSM4MJL2I5A.

bakkc commented 4 years ago

Hi Hari, unfortunatly after deploy of the 11.1 release on all our development systems the schedules nagios check came back with an issues when system have no updates.. I noticed that running the check from cli works fine, but when ran through nrpe the result is WARNING. I did some testing and found that a few repository files in /etc/yum.repo.d are not readable for others. Conclusion is that nagios checks will run under a different user then root. After changing the permissions to 644 on al repositories the check went OK. Maybe a permission check on repo files would be a nice to have for debugging.

HariSekhon commented 4 years ago

What was the exact WARNING error message returned in that case, the output summary error?

I've just pushed a check for permission denied errors in the output from yum as it turns out that it still returns exit code 0 (which is broken behaviour) so this should detect it.

bakkc commented 4 years ago

The output with a permission issue on with version 0.11.1

No packages needed for security; 0 packages available ' output lines not accounted for: ["Skipping unreadable repository '/etc/yum.repos.d/nagios.repo'", 'Determining fastest mirrors'] YUM WARNING: Yum output signature (2 unique lines) is larger than number of total updates (0). Please make sure you have upgraded to the latest version from https://github.com/harisekhon/nagios-plugins. If the problem persists, please raise a ticket at https://github.com/harisekhon/nagios-plugins/issues with the full -vvv output

and with version 0.11.2 is the same

No packages needed for security; 0 packages available ' output lines not accounted for: ["Skipping unreadable repository '/etc/yum.repos.d/nagios.repo'"] YUM WARNING: Yum output signature (1 unique lines) is larger than number of total updates (0). Please make sure you have upgraded to the latest version from https://github.com/harisekhon/nagios-plugins. If the problem persists, please raise a ticket at https://github.com/harisekhon/nagios-plugins/issues with the full -vvv output

On rhel 6.10 with version 0.11.1 i got:

rhel6:someuser:/usr/lib64/nagios/plugins> ./check_yum.py -vvv Nagios Plugin for Yum updates on RedHat/CentOS systems - Version 0.11.1 Author: Hari Sekhon

setting plugin timeout to 30 seconds running command: /usr/bin/yum --security check-update Returncode: '0' Output: 'Loaded plugins: product-id, search-disabled-repos, security, subscription- : manager Repo rhel-6-server-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/2631304399696006085-key.pem Repo rhel-6-server-optional-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/2631304399696006085-key.pem Limiting package lists to security relevant ones No packages needed for security; 1 packages available ' output lines not accounted for: [' : manager', 'Repo rhel-6-server-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/2631304399696006085-key.pem', 'Repo rhel-6-server-optional-rpms forced skip_if_unavailable=True due to: /etc/pki/entitlement/2631304399696006085-key.pem', 'Limiting package lists to security relevant ones'] YUM WARNING: Yum output signature (3 unique lines) is larger than number of total updates (1). Please make sure you have upgraded to the latest version from https://github.com/harisekhon/nagios-plugins. If the problem persists, please raise a ticket at https://github.com/harisekhon/nagios-plugins/issues with the full -vvv output

HariSekhon commented 4 years ago

Ah, that new debug output shows the issues nicely.

I've added fixes for the latter issue on RHEL 6 but the first issue where an repository is unreadable will now result in an

UNKNOWN: Skipping unreadable repository '/etc/yum.repos.d/nagios.repo

Since you can't know what updates are available if that repo file is unreadable, but it'll make it obvious to solve.

bakkc commented 4 years ago

Hi Hari, at this time all de issues seems to be fixed. Nice output for permissions issue. Tomorrow i'll deploy in production . Dev + tst are ok. Thanks a lot.

HariSekhon commented 4 years ago

You're welcome, thanks for the debug outputs to improve the code.