Monitoring plugin to check Gitlab personal access tokens expiration date
This Icinga/Nagios check plugin permit to check Gitlab personal, group or project access tokens expiration date.
Installation
apt install git python3-requests python3-dateutil python3-humanize
git clone https://git.easter-eggs.org/brenard/check_gitlab_access_tokens_expiration.git \
/usr/local/src/check_gitlab_access_tokens_expiration
mkdir -p /usr/local/lib/nagios/plugins
ln -s /usr/local/src/check_gitlab_access_tokens_expiration/check_gitlab_access_tokens_expiration \
/usr/local/lib/nagios/plugins/
Usage
usage: check_gitlab_access_tokens_expiration [-h] [-d] [-v] [-U URL]
[-T ACCESS_TOKEN] [-G GROUP_ID]
[-P PROJECT_ID] [-u USER_ID]
[-t TIMEOUT] [-w WARNING]
[-c CRITICAL]
options:
-h, --help show this help message and exit
-d, --debug
-v, --verbose
-U URL, --url URL Gitlab URL
-T ACCESS_TOKEN, --access-token ACCESS_TOKEN
Gitlab access token (use to authenticate on API)
-G GROUP_ID, --group-id GROUP_ID
If you want to check a group access token, specify the
group ID
-P PROJECT_ID, --project-id PROJECT_ID
If you want to check a project access token, specify the
project ID
-u USER_ID, --user-id USER_ID
Gitlab user ID to limit check on this user's access tokens
-t TIMEOUT, --timeout TIMEOUT
Specify timeout for HTTP requests (default: 20)
-w WARNING, --warning WARNING
Warning threshold in days (default: 7)
-c CRITICAL, --critical CRITICAL
Critical threshold in days (default: 2)
Copyright
Copyright (c) 2024 Benjamin Renard
License
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.