Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added possibility to create custom scripts #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions attributes/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
default['zabbix']['agent']['hostname'] = node['fqdn']
default['zabbix']['agent']['configure_options'] = ['--with-libcurl']
default['zabbix']['agent']['include_dir'] = ::File.join(node['zabbix']['etc_dir'] , 'agent_include')
default['zabbix']['agent']['scripts_dir'] = ::File.join(node['zabbix']['etc_dir'], 'user_scripts')
default['zabbix']['agent']['enable_remote_commands'] = true
default['zabbix']['agent']['listen_port'] = '10050'
default['zabbix']['agent']['timeout'] = '3'
Expand Down Expand Up @@ -44,3 +45,4 @@
default['zabbix']['agent']['interfaces'] = ['zabbix_agent']

default['zabbix']['agent']['user_parameter'] = []
default['zabbix']['agent']['user_script'] = []
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache 2.0'
description 'Installs/Configures Zabbix Agent/Server'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.8.0'
version '0.8.1'
supports 'ubuntu', '>= 10.04'
supports 'debian', '>= 6.0'
supports 'redhat', '>= 5.0'
Expand Down
3 changes: 2 additions & 1 deletion recipes/_agent_common_directories.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
root_dirs = [
node['zabbix']['agent']['include_dir']
node['zabbix']['agent']['include_dir'],
node['zabbix']['agent']['scripts_dir']
]

# Create root folders
Expand Down
13 changes: 13 additions & 0 deletions recipes/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@
only_if { node['zabbix']['agent']['user_parameter'].length > 0 }
end

# Install custom scripts
node['zabbix']['agent']['user_script'].each do |script|
cookbook_file File.join(node['zabbix']['agent']['scripts_dir'], script) do
source "scripts/#{script}"
unless node['platform_family'] == 'windows'
owner 'root'
group 'root'
mode '755'
end
action :create_if_missing
end
end

ruby_block 'start service' do
block do
true
Expand Down