zoukankan      html  css  js  c++  java
  • CentOS7: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
    }
  • 相关阅读:
    一文搞懂字符集
    机器视觉之eVision
    PID调节
    激光切割质量主要影响因素
    155. 最小栈
    111.二叉树最小深度
    110. 平衡二叉树
    108.将有序数组转换为二叉搜索树
    107. 二叉树的层次遍历 II
    104. 二叉树的最大深度
  • 原文地址:https://www.cnblogs.com/eastson/p/6073027.html
Copyright © 2011-2022 走看看