From 4e4e25f4f1f49d5d927316f5aae5fec4632bc14c Mon Sep 17 00:00:00 2001 From: Robin Douine Date: Thu, 6 May 2021 09:26:47 +0200 Subject: [PATCH 1/4] allow to set the folder to store the db --- attributes/default.rb | 1 + recipes/default.rb | 2 ++ templates/default/librenms-mysqld.cnf.erb | 1 + 3 files changed, 4 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index 9731ff5..114ca4b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -6,6 +6,7 @@ default['mariadb']['max_connections'] = 302 default['mariadb']['max_connect_errors'] = 1000 default['mariadb']['wait_timeout'] = 600 +default['mariadb']['datadir'] = '/var/lib/mysql' default['librenms']['root_dir'] = '/var/opt' default['librenms']['path'] = ::File.join(node['librenms']['root_dir'], 'librenms') diff --git a/recipes/default.rb b/recipes/default.rb index 9e16f06..10a5731 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -79,6 +79,7 @@ max_connections: node['mariadb']['max_connections'], max_connect_errors: node['mariadb']['max_connect_errors'], wait_timeout: node['mariadb']['wait_timeout'], + datadir: node['mariadb']['datadir'], ) notifies :restart, 'service[mysql]' end @@ -123,6 +124,7 @@ max_connections: node['mariadb']['max_connections'], max_connect_errors: node['mariadb']['max_connect_errors'], wait_timeout: node['mariadb']['wait_timeout'], + datadir: node['mariadb']['datadir'], ) notifies :restart, 'service[mariadb]' end diff --git a/templates/default/librenms-mysqld.cnf.erb b/templates/default/librenms-mysqld.cnf.erb index b586471..a60e9a4 100644 --- a/templates/default/librenms-mysqld.cnf.erb +++ b/templates/default/librenms-mysqld.cnf.erb @@ -7,3 +7,4 @@ innodb_flush_log_at_trx_commit = 0 max_connections=<%= @max_connections %> max_connect_errors=<%= @max_connect_errors %> wait_timeout=<%= @wait_timeout %> +datadir=<%= @datadir %> From 9e00951e55eda6869bdfb84ac756c73ec6ddd359 Mon Sep 17 00:00:00 2001 From: Robin Douine Date: Thu, 6 May 2021 09:27:12 +0200 Subject: [PATCH 2/4] allow to set the cleanup options --- attributes/default.rb | 8 ++++++++ recipes/default.rb | 6 ++++++ templates/default/config.php.erb | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index 114ca4b..d4e9224 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -135,3 +135,11 @@ # Syslog default['librenms']['syslog']['enabled'] = false + +# Cleanup options +default['librenms']['syslog_purge'] = 30 +default['librenms']['eventlog_purge'] = 30 +default['librenms']['authlog_purge'] = 30 +default['librenms']['device_perf_purge'] = 7 +default['librenms']['rrd_purge'] = false +default['librenms']['ports_purge'] = false diff --git a/recipes/default.rb b/recipes/default.rb index 10a5731..1c0cc2d 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -377,6 +377,12 @@ radius_default_lvl: node['librenms']['auth_radius']['default_level'], add_conf_file_path: node['librenms']['add_config_file']['path'], rrddir: node['librenms']['rrd_dir'], + syslog_purge: node['librenms']['syslog_purge'], + eventlog_purge: node['librenms']['eventlog_purge'], + authlog_purge: node['librenms']['authlog_purge'], + device_perf_purge: node['librenms']['device_perf_purge'], + rrd_purge: node['librenms']['rrd_purge'], + ports_purge: node['librenms']['ports_purge'], ) end diff --git a/templates/default/config.php.erb b/templates/default/config.php.erb index bbce356..a1809fd 100644 --- a/templates/default/config.php.erb +++ b/templates/default/config.php.erb @@ -71,6 +71,13 @@ $config['radius']['default_level'] = <%= @radius_default_lvl %>; $config['auth_mechanism'] = "mysql"; # default, other options: ldap, http-auth <% end %> +$config['syslog_purge'] = <%= @syslog_purge %>; +$config['eventlog_purge'] = <%= @eventlog_purge %>; +$config['authlog_purge'] = <%= @authlog_purge %>; +$config['device_perf_purge'] = <%= @device_perf_purge %>; +$config['rrd_purge'] = <%= @rrd_purge %>; +$config['ports_purge'] = <%= @ports_purge %>; + <% if ( @add_conf_file_path != '' ) %> if(file_exists( __DIR__ . DIRECTORY_SEPARATOR . '<%= @add_conf_file_path %>')) { include __DIR__ . DIRECTORY_SEPARATOR . '<%= @add_conf_file_path %>'; From 66c8a42c00453f67a8808936e02f13aa1186b605 Mon Sep 17 00:00:00 2001 From: Robin Douine Date: Thu, 6 May 2021 10:04:18 +0200 Subject: [PATCH 3/4] update metadata.rb --- metadata.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 91d6166..4fac9f5 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,8 @@ long_description 'This cookbook installs and configure LibreNMS along with the required components (Apache and MySQL). LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system.' issues_url 'https://github.com/criteo-cookbooks/librenms/issues' source_url 'https://github.com/criteo-cookbooks/librenms' -version '0.2.28' +version '0.2.29' +chef_version '>= 12.14.34' supports 'centos7' supports 'centos' depends 'apache2' From 8a2a304a3f7f8583ca245c9d6d99e1244b7a5b42 Mon Sep 17 00:00:00 2001 From: Robin Douine Date: Thu, 6 May 2021 10:24:37 +0200 Subject: [PATCH 4/4] update travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f7ffc1d..90c4543 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby cache: bundler rvm: -- 2.3.2 +- 2.4.0 deploy: skip_cleanup: true edge: