2012-03-26 10:39:55 +00:00
|
|
|
#!/bin/bash
|
2012-03-26 16:04:16 +00:00
|
|
|
# Cache the file for 30 minutes
|
|
|
|
# If you want to override this, put the command in cron.
|
|
|
|
# We cache because it is a 1sec delay, which is painful for the poller
|
2012-03-26 10:39:55 +00:00
|
|
|
if [ -x /bin/rpm ]; then
|
2012-03-26 16:04:16 +00:00
|
|
|
DATE=$(date +%s)
|
|
|
|
FILE=/tmp/observium-agent-rpm
|
|
|
|
if [ ! -e $FILE ]; then
|
|
|
|
/bin/rpm -q --all --queryformat '%{N} %{V} %{R} %{ARCH} %{SIZE}\n' > $FILE
|
|
|
|
fi
|
|
|
|
FILEMTIME=$(stat -c %Y $FILE)
|
|
|
|
FILEAGE=$(($DATE-$FILEMTIME))
|
|
|
|
if [ $FILEAGE -gt 1800 ]; then
|
|
|
|
/bin/rpm -q --all --queryformat '%{N} %{V} %{R} %{ARCH} %{SIZE}\n' > $FILE
|
|
|
|
fi
|
2012-03-26 10:39:55 +00:00
|
|
|
echo "<<<rpm>>>"
|
2012-03-26 16:04:16 +00:00
|
|
|
cat $FILE
|
2012-03-26 10:39:55 +00:00
|
|
|
fi
|
|
|
|
|