check_chrome_driver_available_upgrade

check_chrome_driver_available_upgrade

Monitoring plugin to check if the Google Chrome stable debian package is upgradeable and a corresponding Google Chrome driver is available on Google Chrome Labs. Useful to maintain a Jibri installation up-to-date.

This plugin will do:

  • update the APT cache if -U parameter is provided
  • check if the google-chrome-stable package is available in APT cache (exit UNKNOWN otherwise)
  • check if it's installed (exit UNKNOWN otherwise)
  • run chromedriver --version command to retrieve Google Chrome driver installed version (exit UNKNOWN on error)
  • check if google-chrome-stable package version match with chromedriver binary version (exit CRITICAL otherwise)
  • check if google-chrome-stable package is marked as keep (only if -k / --check-mark-for-keep argument is provided, exit WARNING otherwise)
  • check if an update is available (exit OK otherwise)
  • retrieve the available Google Chrome driver from googlechromelabs.github.io API (exit UNKNOWN on error)
  • check if the update version of google-chrome-stable package match with the available Google Chrome driver version (exit OK if not and exit WARNING if match)

This script could be used as Icinga/Nagios check plugin.

Requirements

  • Python 3
  • python_apt (python3-apt Debian package)
  • requests (python3-requests Debian package)

Installation

apt install git python3-apt python3-requests
git clone https://gitlab.easter-eggs.com/brenard/check_chrome_driver_available_upgrade.git \
  /usr/local/src/check_chrome_driver_available_upgrade
mkdir -p /usr/local/lib/nagios/plugins
ln -s /usr/local/src/check_chrome_driver_available_upgrade/check_chrome_driver_available_upgrade \
  /usr/local/lib/nagios/plugins/
cat << EOF > /etc/sudoers.d/nagios-chrome
nagios ALL=NOPASSWD: /usr/local/lib/nagios/plugins/check_chrome_driver_available_upgrade -U
EOF
chmod 0400 /etc/sudoers.d/nagios-chrome
cat << EOF > /etc/nagios/nrpe.d/chrome.cfg
command[check_chrome_driver_available_upgrade]=sudo /usr/local/lib/nagios/plugins/check_chrome_driver_available_upgrade -U
EOF
service nagios-nrpe-server reload

Usage

usage: check_chrome_driver_available_upgrade [-h] [-d] [-v] [-w] [-l LOGFILE] [-C]
                                             [-U] [-p PACKAGE] [-k] [-t TIMEOUT]

Monitoring plugin to check if the Google Chrome stable debian package is
upgradeable and a corresponding Google Chrome driver is available on Google Chrome
Labs

options:
  -h, --help            show this help message and exit
  -d, --debug           Show debug messages
  -v, --verbose         Show verbose messages
  -w, --warning         Show warning messages
  -l LOGFILE, --logfile LOGFILE
                        Log file path
  -C, --console         Also log on console (even if log file is provided)
  -U, --update          Update APT cache before checking available upgrade
  -p PACKAGE, --package PACKAGE
                        Google Chrome package (default: google-chrome-stable)
  -k, --check-mark-for-keep
                        Check that specified packages are marked for keep
  -t TIMEOUT, --timeout TIMEOUT
                        Timeout in second getting latest Google Chrome driver
                        available versions (in second, default: 5)

Copyright

Copyright (c) 2024 Easter-eggs

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.