4323213 发表于 2017-3-3 11:26:47

Zabbix自动化监控之私有云

1,自动注册
   1.1Zabbix agent 自动添加


2,主动发现
    2.1   自动发现 Discover

    2.2   zabbixapi   





vim/etc/zabbix/zabbix_agentd.conf

PidFile=/var/run/zabbix/zabbix_agentd.pi

LogFile=/var/log/zabbix/zabbix_agentd.log

DebugLevel=3

StartAgents=0

ServerActive=192.168.1.1
Hostname=locahost.localhost

HostMetadataItem=system.uname
Include=/etc/zabbix/zabbix_agentd.d/



systemctl restart zabbix-agent



Add host
Add to host group

add to template




API   

登录

curl -s -X POST -H'Content-Type:application/json' -d '
{
    "jsonrpc": "2.0",
    "method": "user.login",
    "params": {
      "user": "Admin",
      "password": "zabbix"
    },
    "id": 1
}

'   http://192.168.1.1/zabbix/api_jsonrpc.php |python -m json.tool

查询:

curl -s -X POST -H'Content-Type:application/json' -d '
{
    "jsonrpc": "2.0",
    "method": "host.get",
    "params": {
      "output": "extend",
      "filter": {
            "host": [
                "Zabbix server",
                "Linux server"
            ]
      }
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}'   http://192.168.1.1/zabbix/api_jsonrpc.php |python -m json.tool


yum install -y python-pip
pip install requests








页: [1]
查看完整版本: Zabbix自动化监控之私有云