only show actually installed deb packages - make sure to copy the new dpkg script to your hosts

git-svn-id: http://www.observium.org/svn/observer/trunk@3130 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-05-03 15:38:58 +00:00
parent 5ca7379aaf
commit 51aae48954
+3 -2
View File
@@ -5,13 +5,14 @@
if [ -x /usr/bin/dpkg-query ]; then
DATE=$(date +%s)
FILE=/tmp/observium-agent-dpkg
if [ ! -e $FILE ]; then
dpkg-query -W --showformat='${Package} ${Version} ${Architecture} ${Installed-Size}\n' > $FILE
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep "^install"|cut -d\ -f4- > $FILE
fi
FILEMTIME=$(stat -c %Y $FILE)
FILEAGE=$(($DATE-$FILEMTIME))
if [ $FILEAGE -gt 1800 ]; then
dpkg-query -W --showformat='${Package} ${Version} ${Architecture} ${Installed-Size}\n' > $FILE
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep "^install"|cut -d\ -f4- > $FILE
fi
echo "<<<dpkg>>>"
cat $FILE