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.14k stars 506 forks source link

Improperly fails (reports OK) on RHEL Systems with Unassigned Subscriptions #426

Open mfrazier opened 4 months ago

mfrazier commented 4 months ago

When running the Nagios Yum Check Plugin on RHEL systems registered with an entitlement server but without assigned subscriptions, it becomes impossible to check for potential updates. Despite this, yum/dnf will still exit with a status of 0. This issue can occasionally arise when Red Hat representatives misassign or erroneously move subscriptions within an organization.

I have addressed this issue by making a simple change to your check_returncode function and believe that others may benefit from this solution as well. Thank you for your work on this plugin; it has been incredibly useful.

Nagios Plugin for Yum updates on RedHat/CentOS systems - Version 0.12.7
Author: Hari Sekhon

setting plugin timeout to 30 seconds
running command: /usr/bin/yum --security check-update
Returncode: '0'
Output: 'Updating Subscription Management repositories.

This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.

Last metadata expiration check: 1:48:44 ago on Mon 08 Jul 2024 04:39:59 PM UTC.
'
running command: yum updateinfo
Returncode: '0'
Output: 'Updating Subscription Management repositories.

This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.

Last metadata expiration check: 1:48:45 ago on Mon 08 Jul 2024 04:39:59 PM UTC.
Updates Information Summary: available
    1 New Package notice(s)
'
YUM OK: 0 Security Updates Available. 0 Non-Security Updates Available | security_updates_available=0 non_security_updates_available=0 total_updates_available=0