Added cleanup for old RRD files

This commit is contained in:
laf
2016-07-30 16:57:09 +01:00
parent 9e305241fd
commit 318c9cd2b0
3 changed files with 12 additions and 1 deletions

View File

@ -46,6 +46,8 @@ $config['auth_mechanism'] = "mysql"; # default, other options: ldap, http-auth
$config['poller-wrapper']['alerter'] = FALSE;
# Uncomment the next line to disable daily updates
#$config['update'] = 0;
$config['rrd_purge'] = 90;
// Number in days of how long to keep old rrd files.
# Uncomment to submit callback stats via proxy
#$config['callback_proxy'] = "hostname:port";

View File

@ -31,6 +31,14 @@ if ($options['f'] === 'update') {
exit(0);
}
if ($options['f'] === 'rrd_purge') {
if (is_numeric($config['rrd_purge'])) {
$cmd = "find ".$config['rrd_dir']." -mtime +".$config['rrd_purge']." -exec rm -Rf {} \;";
$purge = `$cmd`;
echo 'purged old rrd files';
}
}
if ($options['f'] === 'syslog') {
if (is_numeric($config['syslog_purge'])) {
$rows = dbFetchRow('SELECT MIN(seq) FROM syslog');

View File

@ -76,7 +76,7 @@ else
status_run 'Fetching notifications' "$0 notifications"
;;
cleanup)
# DB-Cleanups
# Cleanups
php daily.php -f syslog
php daily.php -f eventlog
php daily.php -f authlog
@ -86,6 +86,7 @@ else
php daily.php -f purgeusers
php daily.php -f bill_data
php daily.php -f alert_log
php daily.php -f rrd_purge
;;
submodules)
# Init+Update our submodules