Initial version
This commit is contained in:
commit
ad6ad946cb
2 changed files with 53 additions and 0 deletions
26
README.md
Normal file
26
README.md
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Check APK
|
||||||
|
|
||||||
|
Nagios/Icinga check plugin to monitor available upgrades on Alpine Linux and its APK packages manager.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apk add wget
|
||||||
|
mkdir -p /usr/lib/nagios/plugins
|
||||||
|
wget -O /usr/lib/nagios/plugins/check_apk \
|
||||||
|
https://gitea.zionetrix.net/bn8/check_apk/raw/branch/master/check_apk
|
||||||
|
chmod 750 /usr/lib/nagios/plugins/check_apk
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
27
check_apk
Executable file
27
check_apk
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
UPDATE=$(apk update 2>&1)
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "UNKNOWN - Fail to update packages lists"
|
||||||
|
echo -e "$UNKNOWN"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
UPGRADES=$(apk -u list 2>&1)
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "UNKNOWN - Fail to list available upgrades"
|
||||||
|
echo -e "$UPGRADES"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$UPGRADES" ]
|
||||||
|
then
|
||||||
|
echo "OK - System is uptodate"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "WARNING - $(echo -e "$UPGRADES"|wc -l) upgrades available"
|
||||||
|
echo -e "$UPGRADES"
|
||||||
|
exit 1
|
Loading…
Reference in a new issue