Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check does not detect a date for the last update (check only for upgrades) - dont find updates when use spacewalk #52

Closed
GasCan1234 opened this issue Sep 29, 2022 · 3 comments

Comments

@GasCan1234
Copy link

GasCan1234 commented Sep 29, 2022

Hi,

we have a machine, there the check does not recognize the last date of the update run.

The check checks for "U" and "Upgrade" but from my point of view it should also check for "Update". Because if he makes only updates in the last runs, there is not U or Upgrade recorded, see the listing from the server.

[root@XXX ~]# /usr/bin/yum -C --quiet history | awk '{if(NR>2)print}'
   444 | XXX | 2022-09-29 07:01 | Erase          |    1
   443 | XXX | 2022-09-28 10:00 | Update         |    2 ##
   442 | XXX | 2022-09-27 10:44 | Update         |    1 ##
   441 | XXX | 2022-09-27 10:00 | Update         |    1 ##
   440 | XXX | 2022-09-26 10:00 | Update         |    1 ##
   439 | XXX | 2022-09-23 10:00 | Update         |    1 ##
   438 | XXX | 2022-09-22 10:00 | Update         |    1 ##
   437 | XXX | 2022-09-21 10:00 | Update         |   15 ##
   436 | XXX | 2022-09-20 10:00 | Update         |    1 ##
   435 | XXX | 2022-09-19 10:00 | Update         |    1 ##
   434 | XXX | 2022-09-16 10:00 | Update         |    1 ##
   433 | XXX | 2022-09-15 10:00 | Update         |    1 ##
   432 | XXX | 2022-09-14 10:00 | Update         |    1 ##
   431 | XXX | 2022-09-13 10:00 | Update         |    1 ##
   430 | XXX | 2022-09-12 10:00 | Update         |    1 ##
   429 | XXX | 2022-09-09 10:00 | Update         |    1 ##
   428 | XXX | 2022-09-08 10:00 | Update         |    1 ##
   427 | XXX | 2022-09-07 10:00 | Update         |    1 ##
   426 | XXX | 2022-09-06 10:00 | Update         |    1 ##
   425 | XXX | 2022-09-06 06:33 | Update         |    1
[root@XXX ~]# /usr/bin/yum -C --quiet history | awk '{if(NR>2)print}' | grep  ' U \|Upgrade' | cut -d '|' -f3  | head -n 1 | date -f - +"%s" || echo "-1"
[root@XXX ~]# /usr/bin/yum -C --quiet history | awk '{if(NR>2)print}' | grep  ' U \|Upgrade\|Update' | cut -d '|' -f3  | head -n 1 | date -f - +"%s" || echo "-1"
1664352000

LAST_UPDATE_TIMESTAMP=$(/usr/bin/yum -C --quiet --noplugins history | awk '{if(NR>2)print}' | grep ' U \|Upgrade' | cut -d '|' -f3 | head -n 1 | date -f - +"%s" || echo "-1")

I have now changed the line to:

LAST_UPDATE_TIMESTAMP=$(/usr/bin/yum -C --quiet --noplugins history | awk '{if(NR>2)print}' | grep ' U \|Upgrade\|Update' | cut -d '|' -f3 | head -n 1 | date -f - +"%s" || echo "-1")

Maybe you would like to take over this as well.

Another problem we still had and I also overwrote with us is that the check is only executed with "--noplugins". If you use Spacewalk like we do and maintain your own repositories, the check doesn't find any packages or not all that should be updated. Is there a reason to check this way?

Thank you

@HenriWahl
Copy link
Owner

Thanks - could you please create a pull request to ease getting your fixes into upstream?

b-aktas added a commit to b-aktas/checkmk-agent-plugin-yum that referenced this issue Dec 6, 2022
This fixes the problem from HenriWahl#52
Like @GasCan1234 just added the String 'Update' to the grep call.
@b-aktas
Copy link
Contributor

b-aktas commented Dec 6, 2022

Instead of @GasCan1234 I created an pull request. It would be nice if you could fix it upstream and release an updated version on https://exchange.checkmk.com.

@HenriWahl
Copy link
Owner

Uploaded v2.4.1 to https://exchange.checkmk.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants