check_repodata.py
is a Nagios / Icinga plugin for checking sync states of repositories managed by Uyuni or SUSE Multi-Linux Manager. It can assist you detecting outdated repositories and taskomaticd
issues. The script checks file system timestamps and repository sync states that are queried using the Uyuni API. For checking the API a valid username / password combination is required. The login credentials are prompted when running the script. To automate this you have two options:
UYUNI_LOGIN
- a usernameUYUNI_PASSWORD
- the appropriate password
You might also want to set the HISTFILE variable (depending on your shell) to hide the command including the password in the history:
$ HISTFILE="" UYUNI_LOGIN=mylogin UYUNI_PASSWORD=mypass ./check_repodata.py -l centos6-x86_64
A better possibility is to create a authfile with permisions 0400. Just enter the username in the first line and the password in the second line and hand the path to the script:
$ ./check_repodata.py -a myauthfile -l centos6-x86_64
The plugin requires the xmlrpclic
module which is shipped with rhnlib
.
A minimum API version of 24 is required - the script checks the API version and aborts if you are using a historic version of Uyuni.
By default, the plugin checks particular software channels for API sync state and filesystem changes. Also, all channels or a subset of channels can be checked - checks can be limited to API-only or filesystem only.
The following parameters can be specified:
Parameter | Default | Description |
---|---|---|
-a / --authfile |
unset | defines an authentication file |
-d / --debug |
false |
enables debugging outputs |
-s / --server |
localhost |
defines the server to use |
-k / --insecure |
false |
disables SSL verification |
-l / --channels |
unset | defines one or more channels that should be checked |
-A / --all-channels |
false |
checks all channels |
-x / --exclude-channels |
unset | defines channels that should be ignored (wildcard) |
-r / --repodata-only |
false |
only checks repodata on file system |
--api-only |
false |
only checks repository sync state using API |
-w / --warning-threshold |
48 |
warning threshold in hours |
-c / --critical-threshold |
96 |
critical threshold in hours |
-h / --help |
shows help message and exit | |
--version |
shows program's version and exit |
Check sync status for a repository with default thresholds. Login information are provided by an authfile:
$ ./check_repodata.py -a mylab.auth -l almalinux9-x86_64
CRITICAL: 0 file system repodata OK, 0 file system WARNINGS, 1 file system ERRORS (almalinux9-x86_64), 1 API repositories OK, 0 API WARNINGS, 0 API ERRORS
Checks sync status for two repositories on a particular server using API only:
$ ./check_repodata.py -s uiuiuyuni.giertz.loc -a mylab.auth -l almalinux9-x86_64 -l opensuse_leap15_6-x86_64 --api-only
OK: 2 API repositories OK, 0 API WARNINGS, 0 API ERRORS
Checking all the channels using the API only on a remote server with some exclusions:
./check_repodata.py -s patchmepls.evilcorp.lan -a mycorp.auth --api-only -A -x olm-clients -x al-clients -x ol-clients
WARNING: 8 API repositories OK, 2 API WARNINGS (opensuse_leap15_6-uyuni-client-x86_64, opensuse_leap15_6-x86_64-sle-updates), 0 API ERRORS
Debugging repo sync state checks for all channels on a remote server without SSL verification, full output is enabled:
$ ./check_repodata.py -s mlm.devoops.lulz -k -a mycorp.auth -d -A
DEBUG:check_repodata:Options: Namespace(authfile='mycorp.auth', debug=True, server='mlm.devoops.lulz', verify_ssl=False, channels=[], all_channels=True
, exclude_channels=[], repodata_only=False, api_only=False, warning_thres=24, critical_thres=48)
DEBUG:check_repodata:Arguments: None
DEBUG:check_repodata:Using authfile
DEBUG:check_repodata:File permission matches 0600
DEBUG:check_repodata:Target channels: [...]
DEBUG:check_repodata:Checking channel 'almalinux9-x86_64'
DEBUG:check_repodata:Checking filesystem for channel 'almalinux9-x86_64'
DEBUG:check_repodata:DEBUG: Difference in repomd.xml for almalinux9-x86_64 is 102.9786111111111 hours
DEBUG:check_repodata:Critical threshold exceeded
DEBUG:check_repodata:Checking API for channel 'almalinux9-x86_64'
DEBUG:check_repodata:DEBUG: Repository sync difference for channel 'almalinux9-x86_64' is 6 hours
DEBUG:check_repodata:State is OK
...