88344556 2017-05-25
CentOS 7下Puppet推送Zabbix Agent
创建zabbix模块目录:
$ mkdir -p /etc/puppet/modules/zabbix/{manifests,templates}
创建init.pp清单:
$ cat /etc/puppet/modules/zabbix/manifests/init.pp class zabbix { package { 'epel-release': ensure => installed, } package { 'zabbix22-agent': ensure => installed, } file { '/etc/zabbix/zabbix_agentd.conf': content => template("zabbix/zabbix_agentd.conf.erb"), ensure => file, } service { 'zabbix-agent': ensure => "running", hasstatus => true, enable => true, } Package["zabbix22-agent"] -> File["/etc/zabbix/zabbix_agentd.conf"] -> Service["zabbix-agent"] }
创建zabbix_agentd.conf.erb模板:
$ cp /etc/zabbix/zabbix_agentd.conf /etc/puppet/modules/zabbix/templates/zabbix_agentd.conf.erb $ cat /etc/puppet/modules/zabbix/templates/zabbix_agentd.conf.erb Server=<%= zabbix_server %> ServerActive=<%= zabbix_server %> Hostname=<%= fqdn %> ... ... ... ...
编辑site.pp:
$# cat /etc/puppet/manifests/site.pp Package { allow_virtual => true, } node default { $zabbix_server = "192.168.154.137" include zabbix }
更多Zabbix相关教程集合:
ZABBIX 的详细介绍:请点这里
ZABBIX 的下载地址:请点这里