Created
January 28, 2013 15:39
-
-
Save gbkersey/4656539 to your computer and use it in GitHub Desktop.
distribute zabbix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle agent app_zabbix | |
{ | |
vars: | |
# daemons to run | |
"svc_states[zabbix_agentd]" string => "on"; | |
"services" slist => getindices("svc_states"); | |
# template files | |
"template_files" slist => { | |
"/usr/local/etc/zabbix_agent.conf", | |
"/usr/local/etc/zabbix_agentd.conf", | |
}; | |
"template_init_files" slist => { | |
"/etc/init.d/zabbix_agentd", | |
}; | |
"binary_files" slist => { | |
"/usr/local/bin/zabbix_get", | |
"/usr/local/bin/zabbix_sender", | |
"/usr/local/sbin/zabbix_agent", | |
"/usr/local/sbin/zabbix_agentd", | |
}; | |
"script_files" slist => { | |
"/usr/local/bin/check_disk_smb.pl", | |
"/usr/local/bin/check_linux_raid.pl", | |
"/usr/local/lib/site_perl/Zabbix/utils.pm", | |
}; | |
classes: | |
"add_zabbix_group" not => groupexists("zabbix"); | |
"add_zabbix_user" not => userexists("zabbix"); | |
files: | |
"$(template_files)" | |
comment => "Generate $(template_files) from the template.", | |
create => "true", | |
edit_template => "$(g.templ_dir)$(template_files).tmpl", | |
perms => mog("0644", "root", "root"), | |
classes => if_repaired("restart_zabbix"); | |
"$(template_init_files)" | |
comment => "Generate $(template_init_files) from the template.", | |
copy_from => local_cp("$(g.templ_dir)$(template_init_files).$(sys.flavor)"), | |
perms => mog("0755", "root", "root"), | |
classes => if_repaired("restart_zabbix"); | |
"$(binary_files)" | |
comment => "Copy zabbix executables.", | |
copy_from => local_cp("$(g.templ_dir)$(binary_files)$(sys.ostype)"), | |
perms => mog("0755", "root", "root"), | |
classes => if_repaired("restart_zabbix"); | |
"$(script_files)" | |
comment => "Copy zabbix script executables.", | |
copy_from => local_cp("$(g.templ_dir)$(script_files).default"), | |
perms => mog("0755", "root", "root"); | |
methods: | |
"any" usebundle => service_startup("$(services)","$(svc_states[$(services)])"); | |
processes: | |
"/usr/local/sbin/zabbix_agentd" | |
comment => "Make sure zabbix agent is running.", | |
restart_class => "restart_zabbix"; | |
commands: | |
add_zabbix_group.linux:: | |
"/usr/sbin/groupadd zabbix" | |
comment => "add the zabbix group"; | |
add_zabbix_user.linux:: | |
"/usr/sbin/useradd -g zabbix zabbix" | |
comment => "add the zabbix group"; | |
restart_zabbix:: | |
"/etc/init.d/zabbix_agentd restart" | |
comment => "Restart zabbix if the configuration files are changed"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment