zabbix监控系统搭建好了之后,就需要为各种角色host加入进来,现在新增一台zabbix-agent:

1.在172.16.23.128上安装zabbix-agent,zabbix-server:172.16.23.131

# rpm -Uvh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
# cd /etc/yum.repos.d/
# mv epel.repo epel.repo.bak
# yum install zabbix zabbix-agent -y
# mv epel.repo.bak epel.repo

安装完成agent端程序之后,现在做一些简单配置:

# sed -i 's/Server=127.0.0.1/Server=172.16.23.131/g' /etc/zabbix/zabbix_agentd.conf
# sed -i 's/ServerActive=127.0.0.1/ServerActive=172.16.23.131/g' /etc/zabbix/zabbix_agentd.conf
Hostname=172.16.23.128

然后开启服务,并检查日志是否报错:

# systemctl start zabbix-agent
# systemctl status zabbix-agent
# tail -f /var/log/zabbix/zabbix_agentd.log
[root@master zabbix_agentd.d]# tail -f /var/log/zabbix/zabbix_agentd.log
7681:20181209:123239.539 IPv6 support: YES
7681:20181209:123239.539 TLS support: YES
7681:20181209:123239.539 **************************
7681:20181209:123239.539 using configuration file: /etc/zabbix/zabbix_agentd.conf
7681:20181209:123239.540 agent #0 started [main process]
7682:20181209:123239.540 agent #1 started [collector]
7683:20181209:123239.540 agent #2 started [listener #1]
7684:20181209:123239.541 agent #3 started [listener #2]
7686:20181209:123239.542 agent #5 started [active checks #1]
7685:20181209:123239.543 agent #4 started [listener #3]

然后配置zabbix的web页面:

注意:这里的hostname一定要和zabbix-agent端配置文件的hostname一致,不然会报错如下:

[root@master zabbix_agentd.d]# tail -f /var/log/zabbix/zabbix_agentd.log
7644:20181209:122919.996 TLS support: YES
7644:20181209:122919.996 **************************
7644:20181209:122919.996 using configuration file: /etc/zabbix/zabbix_agentd.conf
7644:20181209:122919.997 agent #0 started [main process]
7645:20181209:122919.997 agent #1 started [collector]
7646:20181209:122919.998 agent #2 started [listener #1]
7648:20181209:122919.999 agent #4 started [listener #3]
7647:20181209:122919.999 agent #3 started [listener #2]
7649:20181209:122920.000 agent #5 started [active checks #1]
7649:20181209:122920.007 no active checks on server [172.16.23.131:10051]: host [master] not found
7649:20181209:123120.077 no active checks on server [172.16.23.131:10051]: host [master] not found

当只添加了host而没有添加template,那么日志并不会报错,但是web页面那里的agent不会变绿:

上面是添加template之后的,所以agent变为了绿色

zabbix-agent:172.16.23.128    zabbix-server:172.16.23.131

现在在agent端配置自定义item:

/etc/zabbix/zabbix_agentd.d/userparameter_script.conf

[root@master zabbix_agentd.d]# cat userparameter_script.conf
UserParameter=getupload,/etc/zabbix/getupload.py

配置文件确保这里是打开的:Include=/etc/zabbix/zabbix_agentd.d/*.conf,/etc/zabbix/getupload.py该脚本必须有执行权限

[root@master zabbix_agentd.d]# cat /etc/zabbix/getupload.py
#!/usr/bin/env python
def getload():
with open("/proc/loadavg", "r") as f:
con2 = f.read().split()
f.close()
return con2 print(getload()[0])

agent配置完成后重启zabbix-agent服务:systemctl restart zabbix-agent

然后在zabbix-server端手动获取该值:

[root@zabbix-server zabbix_agentd.d]# zabbix_get -s 172.16.23.128  -k getupload
0.00

上面-s 后面接上zabbix-agent的ip,如果agent在server上就和server ip一致,-k后面接命名的item

zabbix-server新增zabbix-agent的更多相关文章

  1. docker 一键安装zabbix server、zabbix agent

    基本原理.须知:1.zabbix 分为zabbix server和zabbix agent,其中zabbix server需要web环境,并且其数据存储在独立的数据库中:2.docker是一种容器服务 ...

  2. Zabbix Server 和 Zabbix Agentd 开机自动运行

    Zabbix Server 和 Zabbix Agentd 开机自动运行 请问:怎样 Zabbix Server 和 Zabbix Agentd 开机自动运行? 注:如果你的命令行写进了 /etc/r ...

  3. zabbix server端与agent端源码安装 自定义监控项

    ZabbixServer的安装(只有源码装zabbix才能装支持java) 搭建自定义yum仓库并安装支持包 yum -y install createrepo #下载依赖关系命令 createrep ...

  4. zabbix之 zabbix server 跟 agent 更换ip地址

    描述: zabbix server端跟agent端更改 ip . 改完之后,相应配置文件 (zabbix_agentd.conf.zabbix_server.conf)的ip也进行了替换 但是依旧报错 ...

  5. zabbix Server 4.0 部署及之内置item使用案例

    zabbix Server 4.0 部署及之内置item使用案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.zabbix组件架构概述(图片摘自网络) 1>.zabbi ...

  6. 运维监控-使用Zabbix Server 添加自定义 item

    运维监控-使用Zabbix Server 监控自定义 item  作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 本篇博客就直接开门见山如何使用Zabbix Server 监控自定义 ...

  7. zabbix server总是stoped,找到此方法解决了问题

    zabbix日志报错: One child process died (PID:8885,exitcode/signal:1). Exiting ... syncing history data... ...

  8. 使用zabbix server监控tomcat实战案例

    使用zabbix server监控tomcat实战案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 大家都知道,zabbix server效率高是使用C语言编写的,有很多应用程序 ...

  9. Zabbix Server宕机报“__zbx_mem_malloc(): out of memory (requested 96 bytes)”

    早上登录Zabbix的时候,发现其提示"Zabbix server is not running: the information displayed may not be current& ...

  10. 转 zabbix debug and zabbix使用percona插件监控mysql

    ########## https://www.cnblogs.com/keithtt/p/8542987.html zabbix使用percona插件监控mysql   1.添加percona仓库. ...

随机推荐

  1. 扩展KMP算法小记

    参考来自<拓展kmp算法总结>:http://blog.csdn.net/dyx404514/article/details/41831947 扩展KMP解决的问题: 定义母串S和子串T, ...

  2. Linux:32/64位程序(应用程序、共享库、内核模块)

    摘要: Linux系统区分32/64位,相应地,应用程序.共享库和内核模块也区分32/64位. 本文以Ubuntu系统为例,介绍如何编译和使用32/64位的应用程序.共享库和内核模块. 1. 应用程序 ...

  3. Implicit declaration of function 'BMKCoordinateForMapPoint' is invalid in C99

    少一个头文件  #import <BaiduMapAPI_Utils/BMKGeometry.h> 加上这个就好了 <HPHalfScreenTopBar: 0x103570bb0; ...

  4. JMeter(十)-正则表达式关联

    jmeter中,接口自动化的关键在于参数关联.比如需要登录的接口,如何调用登录口令?一个增删改查的闭环,如何将接口参数上下传递?下面就以实际的例子来仔细说一说 1:登录接口 这里有一个实际的登录接口, ...

  5. 洛谷P2801 教主的魔法 分块

    正解:分块 解题报告: 哇之前的坑还没填完就又写新博客? 不管不管,之前欠的两三篇题解大概圣诞节之前会再仔细想想然后重新写下题解趴,确实还挺难的感觉没有很好的理解呢QAQ还是太囫囵吞枣不求甚解了,这样 ...

  6. python2.X编码

    1.Python文件的编码 在Python文件中,可以在第一或第二行指定文件的编码格式(以注释的形式加),这也是Python语法规定的,见http://www.python.org/peps/pep- ...

  7. SpringMVC 问题 org.springframework.beans.factory.BeanDefinitionStoreException

    HTTP Status 500 – Internal Server Error Type Exception Report Message Servlet.init() for servlet [sp ...

  8. python startswith() 函数

    startswith() 作用:判断字符串是否以指定字符或子字符串开头 >>> s = "my name is ming" >>> >&g ...

  9. No message body writer has been found for class com.alibaba.fastjson.JSONObject, ContentType: */*

    1:当使用 cxf 发布服务时,要求返回值类型为xml,或者json等 @Path("/searchProductByText") @GET @Produces({"ap ...

  10. POJ:3083 Children of the Candy Corn(bfs+dfs)

    http://poj.org/problem?id=3083 Description The cornfield maze is a popular Halloween treat. Visitors ...