Skip to content

Commit

Permalink
Merge pull request #77 from criteo-cookbooks/add_customization_options
Browse files Browse the repository at this point in the history
Add customization options
  • Loading branch information
Koaxiel authored May 6, 2021
2 parents 9534ab3 + 8a2a304 commit 46d9a43
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: ruby
cache: bundler
rvm:
- 2.3.2
- 2.4.0
deploy:
skip_cleanup: true
edge:
Expand Down
9 changes: 9 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 8 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions templates/default/config.php.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>';
Expand Down
1 change: 1 addition & 0 deletions templates/default/librenms-mysqld.cnf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>

0 comments on commit 46d9a43

Please sign in to comment.