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: diff --git a/attributes/default.rb b/attributes/default.rb index 9731ff5..d4e9224 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') @@ -134,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/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' diff --git a/recipes/default.rb b/recipes/default.rb index 9e16f06..1c0cc2d 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 @@ -375,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 %>'; 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 %>