initial commit; version 22.5.12042
This commit is contained in:
22
scripts/agent-local/rpm
Executable file
22
scripts/agent-local/rpm
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# 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
|
||||
|
||||
rpm=`which rpm`
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
DATE=$(date +%s)
|
||||
FILE=/tmp/observium-agent-rpm
|
||||
if [ ! -e $FILE ]; then
|
||||
$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
|
||||
$rpm -q --all --queryformat '%{N} %{V} %{R} %{ARCH} %{SIZE}\n' > $FILE
|
||||
fi
|
||||
echo "<<<rpm>>>"
|
||||
cat $FILE
|
||||
fi
|
||||
|
Reference in New Issue
Block a user