Coder Social home page Coder Social logo

stdevel / check_katello_sync Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 4.0 33 KB

A Nagios / Icinga plugin for checking product synchronization within Katello/Red Hat Satellite 6.x

License: GNU General Public License v3.0

Python 100.00%
icinga icinga2 icinga-plugin icinga2-plugin katello foreman system-information satellite satellite6

check_katello_sync's Issues

Non-existent included products are not evaluated

When checking non-existing products, no error is displayed:

$ ./check_katello_sync --insecure -o giertz -s mysat.localhost.loc -i pinkepank -a mysat.auth
OK:  |

There should be an error message.

ValueError: time data '2017-05-03 06:00:29 +0200' does not match format '%Y-%m-%d %H:%M:%S UTC'

Hello,
Apparently I'm facing a date format issue:

-bash-4.2$ /usr/lib64/nagios/plugins/check_katello_sync.py -s xxxxx -o yyyyy -a /usr/lib64/nagios/plugins/katello.auth
Traceback (most recent call last):
  File "/usr/lib64/nagios/plugins/check_katello_sync.py", line 354, in <module>
    main(options)
  File "/usr/lib64/nagios/plugins/check_katello_sync.py", line 339, in main
    check_products()
  File "/usr/lib64/nagios/plugins/check_katello_sync.py", line 148, in check_products
    check_product(product)
  File "/usr/lib64/nagios/plugins/check_katello_sync.py", line 106, in check_product
    product["last_sync"], "%Y-%m-%d %H:%M:%S UTC"
  File "/usr/lib64/python2.7/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data '2017-05-03 06:00:29 +0200' does not match format '%Y-%m-%d %H:%M:%S UTC'
-bash-4.2$ 

Is there a way to fix that?
BR,
Yannick

UTF-8 characters in repo description break check script

If there is a repo containing UTF-8 characters in it's description, the script fails with the following error:

Traceback (most recent call last):
  File "./check_katello_sync.py", line 370, in <module>
    main(options)
  File "./check_katello_sync.py", line 355, in main
    check_products()
  File "./check_katello_sync.py", line 158, in check_products
    check_product(product)
  File "./check_katello_sync.py", line 106, in check_product
    product["label"], product["description"], product["last_sync"][0:19]
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 322: ordinal not in range(128)

This is caused by:

LOGGER.debug("Product '{0}' ({1}) was synced at {2}".format(
product["label"], product["description"], product["last_sync"][0:19]

If this line is changed to the following, the script works again:

        LOGGER.debug("Product '{0}' ({1}) was synced at {2}".format(
            product["label"], (product["description"] or '').encode('utf8'), product["last_sync"][0:19]

python-requests changed SSL default behavior

On some newer Python requests versions, the script is failing:

 File "/usr/lib64/nagios/plugins/ForemanAPIClient.py", line 339, in get_id_by_name
self.api_get("/{}s".format(api_object)) File "/usr/lib64/nagios/plugins/ForemanAPIClient.py", line 182, in
api_get return self.__api_request("get", sub_url, "", hits, page) File "/usr/lib64/nagios/plugin
/ForemanAPIClient.py", line 150, in __api_request headers=self.HEADERS File "/usr/lib/python2.7/site
packages/requests/sessions.py", line 476, in get return self.request('GET', url, **kwargs) File "/usr/li
/python2.7/site-packages/requests/sessions.py", line 464, in request resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send r = adapter.send(request,
**kwargs) File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 431, in send raise SSLError(e,
request=request) requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
(_ssl.c:579)

It seems like newer module versions enforce SSL checking which has not been the default, yet. The affected library is ForemanAPIClient.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.