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

@@ -27,7 +27,7 @@ if (!array_key_exists('SCRIPT_FILENAME', $_SERVER)
# ============================================================================
# CONFIGURATION
# ============================================================================
# Define MySQL connection constants in config.php. Instead of defining
# Define MySQL connection constants in config.php. Instead of defining
# parameters here, you can define them in another file named the same as this
# file, with a .cnf extension.
# ============================================================================
@@ -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.
@@ -286,7 +286,7 @@ function ss_get_mysql_stats( $options ) {
$flags = isset($options['flags']) ? $options['flags'] : $mysql_flags;
$connection_timeout = isset($options['connection-timeout']) ? $options['connection-timeout'] : $mysql_connection_timeout;
$heartbeat_server_id = isset($options['server-id']) ? $options['server-id'] : $heartbeat_server_id;
# If there is a port, or if it's a non-standard port, we add ":$port" to the
# hostname.
$host_str = $host.($port != 3306 ? ":$port" : '');
@@ -471,7 +471,7 @@ function ss_get_mysql_stats( $options ) {
debug("Got nothing from SHOW SLAVE STATUS");
}
}
# Get SHOW MASTER STATUS, and add it to the $status array.
if ($chk_options['master']
&& array_key_exists('log_bin', $status)

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