mirror of
				https://github.com/librenms/librenms-agent.git
				synced 2024-05-09 09:54:52 +00:00 
			
		
		
		
	* convert the snmp scripts using tmp files over to use mktemp * reverse this... joy... not a temp file but cache file ;( * moved cache file from under /tmp to /var/cache/librenms * fix mysql tmp usage
		
			
				
	
	
		
			20 lines
		
	
	
		
			585 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			585 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
# 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
 | 
						|
if [ -x /bin/rpm ]; then
 | 
						|
  DATE=$(date +%s)
 | 
						|
  FILE=/var/cache/librenms/agent-local-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
 | 
						|
  echo "<<<rpm>>>"
 | 
						|
  cat $FILE
 | 
						|
fi
 | 
						|
 |