1
0
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
This commit is contained in:
Zane C. Bowers-Hadley
2019-08-08 21:18:06 -05:00
committed by Tony Murray
parent fc9c2a245f
commit d609e23600
10 changed files with 19 additions and 19 deletions

View File

@@ -14,7 +14,7 @@
use LWP::Simple;
$CACHETIME = 30;
$CACHEFILE = '/tmp/agent-local-apache';
$CACHEFILE = '/var/cache/librenms/agent-local-apache';
# check for cache file newer CACHETIME seconds ago
if ( -f $CACHEFILE && time - (stat( $CACHEFILE ))[9] < $CACHETIME) {

View File

@@ -4,7 +4,7 @@
# We cache because it is a 1sec delay, which is painful for the poller
if [ -x /usr/bin/dpkg-query ]; then
DATE=$(date +%s)
FILE=/tmp/agent-local-dpkg
FILE=/var/cache/librenms/agent-local-dpkg
if [ ! -e $FILE ]; then
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep " installed "|cut -d\ -f4- > $FILE

View File

@@ -48,7 +48,7 @@ $heartbeat_server_id = 0; # Server id to associate with a heartbeat. Leave 0 if
$heartbeat_table = 'percona.heartbeat'; # db.tbl.
$cache_dir = '/tmp'; # If set, this uses caching to avoid multiple calls.
$cache_dir = '/var/cache/librenms'; # If set, this uses caching to avoid multiple calls.
$timezone = null; # If not set, uses the system default. Example: "UTC"
$cache_time = 30; # How long to cache data.

View File

@@ -15,8 +15,8 @@ BIN_GREP='/usr/bin/grep'
BIN_PASTE='/usr/bin/paste'
BIN_RM='/usr/bin/rm'
BIN_MV='/usr/bin/mv'
LOG_OLD='/tmp/nfsstats_old'
LOG_NEW='/tmp/nfsstats_new'
LOG_OLD='/var/cache/librenms/nfsstats_old'
LOG_NEW='/var/cache/librenms/nfsstats_new'
$BIN_NFSSTAT -$CFG_NFSVER -n -l | $BIN_TR -s " " | $BIN_CUT -d ' ' -f 5 | $BIN_GREP -v '^$' > $LOG_NEW 2>&1

View File

@@ -4,7 +4,7 @@
# We cache because it is a 1sec delay, which is painful for the poller
if [ -x /bin/rpm ]; then
DATE=$(date +%s)
FILE=/tmp/agent-local-rpm
FILE=/var/cache/librenms/agent-local-rpm
if [ ! -e $FILE ]; then
/bin/rpm -q --all --queryformat '%{N} %{V} %{R} %{ARCH} %{SIZE}\n' > $FILE
fi

View File

@@ -14,7 +14,7 @@
use LWP::Simple;
$CACHETIME = 30;
$CACHEFILE = '/tmp/snmp-cache-apache';
$CACHEFILE = '/var/cache/librenms/snmp-cache-apache';
# check for cache file newer CACHETIME seconds ago
if ( -f $CACHEFILE && time - (stat( $CACHEFILE ))[9] < $CACHETIME) {

View File

@@ -19,7 +19,7 @@
#
CACHETIME = 30
CACHEFILE = '/tmp/apache-snmp'
CACHEFILE = '/var/cache/librenms/apache-snmp'
# check for cache file newer CACHETIME seconds ago
import os

View File

@@ -49,7 +49,7 @@ $heartbeat_utc = FALSE; # Whether pt-heartbeat is run with --utc option.
$heartbeat_server_id = 0; # Server id to associate with a heartbeat. Leave 0 if no preference.
$heartbeat_table = 'percona.heartbeat'; # db.tbl.
$cache_dir = '/tmp'; # If set, this uses caching to avoid multiple calls.
$cache_dir = '/var/cache/librenms'; # If set, this uses caching to avoid multiple calls.
$timezone = null; # If not set, uses the system default. Example: "UTC"
$cache_time = 30; # How long to cache data.

View File

@@ -12,9 +12,9 @@ BIN_TR='/usr/bin/tr'
BIN_PASTE='/usr/bin/paste'
BIN_RM='/usr/bin/rm'
BIN_MV='/usr/bin/mv'
LOG_OLD='/tmp/nfsio_old'
LOG_NEW='/tmp/nfsio_new'
LOG_FIX='/tmp/nfsio_fix'
LOG_OLD='/var/cache/librenms/nfsio_old'
LOG_NEW='/var/cache/librenms/nfsio_new'
LOG_FIX='/var/cache/librenms/nfsio_fix'
#get reply cache (rc - values: hits, misses, nocache)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 1p | $BIN_AWK '{print $2,$3,$4}' | $BIN_TR " " "\n" > $LOG_NEW

View File

@@ -6,7 +6,7 @@ API_AUTH_USER="admin"
API_AUTH_PASS=""
API_URL=""
API_STATS="jsonstat?command=stats"
TMP_FILE="/tmp/dnsdist_current.stats"
TMP_FILE=`/usr/bin/mktemp`
#/ Description: BASH script to get PowerDNS dnsdist stats
#/ Examples: ./powerdns-dnsdist