summaryrefslogtreecommitdiff
path: root/example/site_check_mk/files/agent/apt/check_apt
blob: 223dd8a7aec8e52e745fb72a7e96c28e7c0d3514 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
# check_apt wrapper to gather more info about pending packages

# call the original plugin
MSG=`/usr/lib/nagios/plugins/check_apt $*`

EXIT=$?

echo -n $MSG  | sed 's/available for upgrade/upgradable/' | sed 's/ updates//' | sed 's/\./:/'

if [ "$EXIT" != "0" ]
then 
apt-get -s upgrade|egrep '(^  |wi ll be up|kept back)'|sed 's/The following packages will be upgraded://'| tr '\n' ' ' | sed 's/  */ /g'
exit $EXIT
fi