HenriWahl / checkmk-agent-plugin-yum

Checks for updates on RPM-based distributions via yum.
GNU General Public License v2.0
23 stars 22 forks source link

Pick-up failed update cycles (with E or s in the "altered" column of yum history) #73

Open swampdogmash opened 4 months ago

swampdogmash commented 4 months ago

It would be useful to identify when any "U|Upgrade|Update" had an issue of some sort - EG, check the "altered" column of "yum history" to see if there is an "E" (Error message produced) or "s" ("--skip-broken" was used) to identify any situations where not all updates may have been installed OR there is work needed to fix the YUM config. Still currently trying to work out all possibilities for this one

swampdogmash commented 4 months ago

Using something like:

Or better still, getting the history list into a file/variable and operating on that to get the last update time and the "status" of that update as per below command line:

/usr/bin/yum -C --quiet --noplugins history list all | awk '{if(NR>2)print}' | grep ' U \|Upgrade\|Update' | cut -d '|' -f5 | head -n 1| awk '{$1=$1};1'| cut -d ' ' -f2

Statuses seem to be:

EE ss

E E< s< s

swampdogmash commented 1 month ago

Further research into this shows that ANY rpm with echo statements in the posttrans scriptlet section will cause E (EE, E< or similar) to be flagged in yum. IT is expected behaviour for any tty output from the rpm and does not solely represent an "error" being generated. It is thus not 100% useful to flag this , but could be something that could be an option which by default is turned off in the yum plugin.

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

For example, the Check-mk-agent install rpm outputs details of the systemd or xinetd config changes as the rpm installs, causing EE to be flagged despite there being no error or issue with the installation.

A similar "by default don't flag it but have the capability to" option would be viable for the s flag also. by default do not flag it up, but give the user the option to do so.