Merge pull request #3907 from laf/issue-2388

Added cleanup for old RRD files to daily.sh
This commit is contained in:
Tony Murray
2016-08-01 12:59:05 -05:00
committed by GitHub
4 changed files with 21 additions and 2 deletions
+3
View File
@@ -47,6 +47,9 @@ $config['poller-wrapper']['alerter'] = FALSE;
# Uncomment the next line to disable daily updates
#$config['update'] = 0;
# Number in days of how long to keep old rrd files. 0 disables this feature
$config['rrd_purge'] = 0;
# Uncomment to submit callback stats via proxy
#$config['callback_proxy'] = "hostname:port";
+11
View File
@@ -31,6 +31,17 @@ if ($options['f'] === 'update') {
exit(0);
}
if ($options['f'] === 'rrd_purge') {
if (is_numeric($config['rrd_purge']) && $config['rrd_purge'] > 0) {
$cmd = "find ".$config['rrd_dir']." -mtime +".$config['rrd_purge']." -print -exec rm -Rf {} \;";
$purge = `$cmd`;
if (!empty($purge)) {
echo "Purged the following RRD files due to old age (over ".$config['rrd_purge']." days old)";
echo $purge;
}
}
}
if ($options['f'] === 'syslog') {
if (is_numeric($config['syslog_purge'])) {
$rows = dbFetchRow('SELECT MIN(seq) FROM syslog');
+2 -1
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
+5 -1
View File
@@ -496,10 +496,14 @@ $config['eventlog_purge'] = 30;
$config['authlog_purge'] = 30;
$config['perf_times_purge'] = 30;
$config['device_perf_purge'] = 30;
$config['rrd_purge'] = 90;// Not set by default
```
This option will ensure data within LibreNMS over 1 month old is automatically purged. You can alter these individually,
These options will ensure data within LibreNMS over X days old is automatically purged. You can alter these individually,
values are in days.
> NOTE: Please be aware that `$config['rrd_purge']` is _NOT_ set by default. This option will remove any old data within
the rrd directory automatically - only enable this if you are comfortable with that happening.
#### Syslog options
```php