check_container_upgrade/README.md

60 lines
3.3 KiB
Markdown
Raw Normal View History

2024-03-03 17:18:20 +01:00
# Check container upgrade
Monitoring plugin to check if containers are upgradable. By default all running container are checked.
2024-03-11 18:42:54 +01:00
Checks are done by running Icinga/Nagios compatible check plugins inside containers. These plugins are listed inside the `CHECK_PLUGINS` associative array (on top of the file) and by default, the following plugin are declared:
- `/usr/lib/nagios/plugins/check_apt`: for Debian based image, provide by the `monitoring-plugins-basic` debian package
- `/usr/lib/nagios/plugins/check_apk`: for Alpine based image, see [project](https://gitea.zionetrix.net/bn8/check_apk) for install instructions
2024-04-18 11:16:47 +02:00
**Note:** The first plugin detected as installed will be used.
2024-03-03 17:18:20 +01:00
## Installation
```
git clone https://gitea.zionetrix.net/bn8/check_container_upgrade.git /usr/local/src/check_container_upgrade
mkdir -p /usr/local/lib/nagios/plugins
ln -s /usr/local/src/check_container_upgrade/check_container_upgrade /usr/local/lib/nagios/plugins/
echo "nagios ALL=NOPASSWD: /usr/local/lib/nagios/plugins/check_container_upgrade" > /etc/sudoers.d/nagios-containers
chmod 0400 /etc/sudoers.d/nagios-containers
echo "command[check_container_upgrade]=sudo /usr/local/lib/nagios/plugins/check_container_upgrade" > /etc/nagios/nrpe.d/containers.cfg
service nagios-nrpe-server reload
```
## Usage
```
Usage : check_container_upgrade [-d] [-E /path/to/engine] [container1,...]
-E [path] Force a specific engine (possible values: auto docker podman,
default: auto)
-x [container] Exclude specified container (could be repeat)
-M [integer] Max number of container checks to run in parallel
(default: 4, 0=no limit)
-f [docker-compose.yml] To check upgrade on docker compose project, specified the path of the
docker-compose.yml file
-b|--build|--rebuild Trigger container build if upgrade detected (only possible if a docker
compose file if provided)
--rebuild-path Specify rebuild data directory path (default: /var/log/check_container_upgrade)
--rebuild-cron Start in rebuild cron mode: rebuild containers detected and mark to be
rebuilt on status file.
--deploy-cron Start in deploy cron mode: deploy containers known as rebuilt in status
file.
-d Debug mode
-l Log file
-C Console logging (even if log file is specify)
-X Enable bash tracing (=set -x)
-h Show this message
2024-03-03 17:18:20 +01:00
```
## Copyright
Copyright (c) 2024 Benjamin Renard <brenard@zionetrix.net>
## 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.