stdevel / check_katello_sync Goto Github PK
View Code? Open in Web Editor NEWA Nagios / Icinga plugin for checking product synchronization within Katello/Red Hat Satellite 6.x
License: GNU General Public License v3.0
A Nagios / Icinga plugin for checking product synchronization within Katello/Red Hat Satellite 6.x
License: GNU General Public License v3.0
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.
When using this plugin along with Red Hat Satellite 6.2.x, products without any repositories are part of the Katello API answer. It would be handy to exclude them.
Currently, only the first 20 hits are evaluated when accessing the API to get a list of all products.
Utilizing the nagiosplugin
python module would simplify maintaining the code.
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
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:
check_katello_sync/check_katello_sync.py
Lines 102 to 103 in 1c1e870
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]
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
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.