stdevel / check_katello_currency

A Nagios / Icinga plugin for checking patch currency of hosts managed by Foreman/Katello or Red Hat Satellite 6
GNU General Public License v3.0
1 stars 1 forks source link

ValueError: unconverted data remains: +0200 #4

Closed Tontonitch closed 7 years ago

Tontonitch commented 7 years ago

Hi, Also with this plugin (faced the first time with check_katello_sync), I face a date issue:

-bash-4.2$ /usr/lib64/nagios/plugins/check_katello_currency.py -s xxxxx -a /usr/lib64/nagios/plugins/katello.auth -y -P
Traceback (most recent call last):
  File "/usr/lib64/nagios/plugins/check_katello_currency.py", line 563, in <module>
    main(options)
  File "/usr/lib64/nagios/plugins/check_katello_currency.py", line 547, in main
    check_stats()
  File "/usr/lib64/nagios/plugins/check_katello_currency.py", line 209, in check_stats
    inactive_sys = [x for x in SYSTEM_ERRATA if is_inactive(SYSTEM_ERRATA[x]["updated_at"])]
  File "/usr/lib64/nagios/plugins/check_katello_currency.py", line 288, in is_inactive
    timestamp.replace(" UTC", ""), "%Y-%m-%d %H:%M:%S"
  File "/usr/lib64/python2.7/_strptime.py", line 328, in _strptime
    data_string[found.end():])
ValueError: unconverted data remains:  +0200
-bash-4.2$

Any idea how I can fix that? BR, Yannick

stdevel commented 7 years ago

Hey Yannick! Thanks for sharing! What version of Foreman and Katello are you using? I'd like to reproduce this.

Greetings!

Tontonitch commented 7 years ago

Hello Christian,

I use the last version of RH Satellite 6, so 6.2.9

[root@rhsat6srv1 ~]# yum info foreman
Loaded plugins: package_upload, priorities, product-id, search-disabled-repos, subscription-manager
166 packages excluded due to repository priority protections
Installed Packages
Name        : foreman
Arch        : noarch
Version     : 1.11.0.76
Release     : 1.el7sat
Size        : 99 M
Repo        : installed
From repo   : rhel-7-server-satellite-6.2-rpms
Summary     : Systems Management web application
URL         : http://theforeman.org
License     : GPLv3+ with exceptions
Description : Foreman is aimed to be a Single Address For All Machines Life Cycle Management.
            : Foreman is based on Ruby on Rails, and this package bundles Rails and all
            : plugins required for Foreman to work.

[root@rhsat6srv1 ~]#
[root@rhsat6srv1 ~]# yum info katello
Loaded plugins: package_upload, priorities, product-id, search-disabled-repos, subscription-manager
166 packages excluded due to repository priority protections
Installed Packages
Name        : katello
Arch        : noarch
Version     : 3.0.0
Release     : 19.el7sat
Size        : 0.0
Repo        : installed
From repo   : rhel-7-server-satellite-6.2-rpms
Summary     : A package for managing application life-cycle for Linux systems
URL         : http://www.katello.org
License     : GPLv2
Description : Provides a package for managing application life-cycle for Linux systems.

[root@rhsat6srv1 ~]#
[root@rhsat6srv1 ~]# yum info satellite
Loaded plugins: package_upload, priorities, product-id, search-disabled-repos, subscription-manager
166 packages excluded due to repository priority protections
Installed Packages
Name        : satellite
Arch        : noarch
Version     : 6.2.9
Release     : 7.0.el7sat
Size        : 0.0
Repo        : installed
From repo   : rhel-7-server-satellite-6.2-rpms
Summary     : A package for managing application life-cycle for Linux systems
URL         : https://access.redhat.com/products/red-hat-satellite
License     : GPLv2
Description : Provides a package for managing application life-cycle for Linux systems.

[root@rhsat6srv1 ~]#

Might be also useful for you to now my timezone settings:

[root@rhsat6srv1 ~]# timedatectl status
      Local time: Mon 2017-05-08 09:34:14 CEST
  Universal time: Mon 2017-05-08 07:34:14 UTC
        RTC time: Mon 2017-05-08 07:34:14
       Time zone: Europe/Luxembourg (CEST, +0200)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2017-03-26 01:59:59 CET
                  Sun 2017-03-26 03:00:00 CEST
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2017-10-29 02:59:59 CEST
                  Sun 2017-10-29 02:00:00 CET
[root@rhsat6srv1 ~]#

BR, Yannick

stdevel commented 7 years ago

Thanks for your feedback! Also using RHS 6.2.9 here, but have no issues. I will reproduce this and let you know!

Best regards, Christian.

stdevel commented 7 years ago

Hello Yannick, tried to fix this in commit 6459a644ef5438dcaf5bc4e8a928518f22834211- can you check it?

Best regards, Christian.

Tontonitch commented 7 years ago

I have checked with the last commit, it works fine now. Thanks for the fix!

stdevel commented 7 years ago

Thanks for your feedback, happy that I could help. :)