Monitoring plugin to check Gitlab personal access tokens expiration date

This Icinga/Nagios check plugin permit to check Gitlab personal access tokens expiration date.


apt install git python3-requests python3-dateutil python3-humanize
git clone \
mkdir -p /usr/local/lib/nagios/plugins
ln -s /usr/local/src/check_gitlab_access_tokens_expiration/check_gitlab_access_tokens_expiration \


usage: check_gitlab_access_tokens_expiration [-h] [-d] [-v] [-U URL]
                                             [-T ACCESS_TOKEN] [-u USER_ID]
                                             [-t TIMEOUT] [-w WARNING]
                                             [-c CRITICAL]

  -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)
  -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 (c) 2024 Benjamin Renard


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.