关于Zabbix服务端布署请查看

1、上传zabbix安装包(源码包默认(Server和Agent是一起的))

[root@sms-v2 ~]# ll /root/
-rw-r--r-- root root 11月 : zabbix-4.4..tar.gz

2、安装依赖包

[root@sms-v2 ~]# yum install gcc gcc-c++ pcre-devel -y

3、创建运行用户

#创建组用户
[root@sms-v2 ~]# groupadd zabbix #创建用户
[root@sms-v2 ~]# useradd -g zabbix -M -s /sbin/nologin zabbix #检查是否创建成功
[root@sms-v2 ~]# id zabbix
uid=(zabbix) gid=(zabbix) 组=(zabbix)

 4、软件的安装

#解压软件
[root@sms-v2 ~]# tar xvf zabbix-4.4..tar.gz #进入软件安装目录
[root@sms-v2 ~]# cd zabbix-4.4./ #安装软件
[root@sms-v2 zabbix-4.4.3]# ./configure --prefix=/data/application/zabbix-4.4.3 --enable-agent #编译安装
[root@sms-v2 zabbix-4.4.3]# make && make install #安装完成的目录

[root@sms-v2 zabbix-4.4.3]# tree /data/application/zabbix-4.4.3/
/data/application/zabbix-4.4.3/
├── bin
│   ├── zabbix_get
│   └── zabbix_sender
├── etc
│   ├── zabbix_agentd.conf
│   └── zabbix_agentd.conf.d
├── lib
│   └── modules
├── sbin
│   └── zabbix_agentd
└── share
└── man
├── man1
│   ├── zabbix_get.1
│   └── zabbix_sender.1
└── man8
└── zabbix_agentd.8

 5、创建存放日志的目录

[root@sms-v2 zabbix-4.4.]# mkdir /data/application/zabbix-4.4./log
[root@sms-v2 zabbix-4.4.]# chown zabbix.zabbix /data/application/zabbix-4.4./log -R

6、编译zabbix Agent配置文件

[root@sms-v2 zabbix-4.4.3]# vi /data/application/zabbix-4.4.3/etc/zabbix_agentd.conf
...
# Mandatory: no
# Default:
# PidFile=/tmp/zabbix_agentd.pid
PidFile=/data/application/zabbix-4.4.3/log/zabbix_agentd.pid

### Option: LogType
# Specifies where log messages are written to:
# system - syslog
# file - file specified with LogFile parameter
# console - standard output
...
# Log file name for LogType 'file' parameter.
#
# Mandatory: yes, if LogType is set to file, otherwise no
# Default:
# LogFile= LogFile=/data/application/zabbix-4.4.3/log/zabbix_agentd.log #日志文件位置

### Option: LogFileSize
# Maximum size of log file in MB.
# - disable automatic log rotation.
#
# Mandatory: no
# Range: -
# Default:
# LogFileSize=
...
### Option: Server
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
# Incoming connections will be accepted only from the hosts listed here.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
# and '::/0' will allow any IPv4 or IPv6 address.
# '0.0.0.0/0' can be used to allow any IPv4 address.
# Example: Server=127.0.0.1,192.168.1.0/,::,:db8::/,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to
# Default:
# Server= Server=127.0.0.1,192.168.10.96 #Zabbix Server主动监控允许调用 ### Option: ListenPort
# Agent will listen on this port for connections from the server.
#
...
##### Active checks related ### Option: ServerActive
# List of comma delimited IP:port (or DNS name:port) pairs of Zabbix servers and Zabbix proxies for active checks.
# If port is not specified, default port is used.
# IPv6 addresses must be enclosed in square brackets if port for that host is specified.
# If port is not specified, square brackets for IPv6 addresses are optional.
# If this parameter is not specified, active checks are disabled.
# Example: ServerActive=127.0.0.1:,zabbix.domain,[::]:,::,[12fc::]
#
# Mandatory: no
# Default:
# ServerActive= ServerActive=192.168.10.96:10051 #Aget被动监控,即主机上传数据到Zabbix服务器
...
### Option: Hostname
# Unique, case sensitive hostname.
# Required for active checks and must match hostname as configured on the server.
# Value is acquired from HostnameItem if undefined.
#
# Mandatory: no
# Default:
# Hostname= Hostname=192.168.10.95 #配置主机名,建议配置为IP地址
...
### Option: User
# Drop privileges to a specific, existing user on the system.
# Only has effect if run as 'root' and AllowRoot is disabled.
#
# Mandatory: no
# Default:
User=zabbix #运行Agent的用户
...
### Option: Include
# You may include individual files or all files in a directory in the configuration file.
# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time.
#
# Mandatory: no
# Default:
# Include= # Include=/usr/local/etc/zabbix_agentd.userparams.conf
# Include=/usr/local/etc/zabbix_agentd.conf.d/
# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf
290 Include=/data/application/zabbix-4.4.3/etc/zabbix_agentd.conf.d/*.conf #配置文件的位置
...

7、编写zabbix Agent启动服务

[root@sms-v2 init.d]# cat /etc/init.d/zabbix_agentd
#!/bin/sh ##########################################################
###### Zabbix agent daemon init script
########################################################## zabbix_agentd_sbin=/data/application/zabbix-4.4./sbin/zabbix_agentd
zabbix_etc=/data/application/zabbix-4.4./etc/zabbix_agentd.conf
PidFile=/data/application/zabbix-4.4./log/zabbix_agentd.pid case $ in start)
$zabbix_agentd_sbin -c $zabbix_etc ;; stop)
kill -TERM `cat $PidFile` ;; restart)
$ stop
sleep
$ start
;; *)
echo "Usage: $0 start|stop|restart"
exit
esac

zabbix_agentd

#设置可执行权限
[root@sms-v2 ~]# chmod /etc/init.d/zabbix_agentd #zabbix agent开启、关闭、重启
[root@sms-v2 ~]# /etc/init.d/zabbix_agentd start
[root@sms-v2 ~]# /etc/init.d/zabbix_agentd stop
[root@sms-v2 ~]# /etc/init.d/zabbix_agentd restart

#这里需要开启zabbix agent服务

8、查看zabbix agent日志

[root@sms-v2 ~]# tail -f /data/application/zabbix-4.4./log/zabbix_agentd.log
::101616.707 TLS support: NO
::101616.707 **************************
::101616.707 using configuration file: /data/application/zabbix-4.4./etc/zabbix_agentd.conf
::101616.707 agent # started [main process]
::101616.708 agent # started [collector]
::101616.709 agent # started [listener #]
::101616.710 agent # started [listener #]
::101616.710 agent # started [active checks #]
::101616.711 agent # started [listener #]
::101616.712 active check configuration update from [192.168.10.96:10051] started to fail (cannot connect to [[192.168.10.96]:10051]: [113] No route to host)
#这里的原因,因为zabbix服务端的端口没有在防火墙开放,导致agent连接不到服务端
#解决方法
#在zabbix服务端开放端口10051

[root@filestore-v2 ~]# firewall-cmd --permanent --add-port=10051/tcp
success
[root@filestore-v2 ~]# firewall-cmd --reload
success

agent端的服务器操作如下

[root@sms-v2 ~]# firewall-cmd --permanent --add-port=10050/tcp
success
[root@sms-v2 ~]# firewall-cmd --reload
success

再次查看日志

[root@sms-v2 ~]# tail -f /data/application/zabbix-4.4.3/log/zabbix_agentd.log
75987:20191224:101616.707 agent #0 started [main process]
75988:20191224:101616.708 agent #1 started [collector]
75991:20191224:101616.709 agent #4 started [listener #3]
75989:20191224:101616.710 agent #2 started [listener #1]
75992:20191224:101616.710 agent #5 started [active checks #1]
75990:20191224:101616.711 agent #3 started [listener #2]
75992:20191224:102216.927 active check configuration update from [192.168.10.96:10051] is working again  
75992:20191224:102216.927 no active checks on server [192.168.10.96:10051]: host [192.168.10.95] not found 
#解决方法:

这个原因,检查zabbix服务端的主机信息,是否跟当前的agent端的配置信息一样,比如主机名或IP地址Server端与Agent端是否配置一样

 9、在zabbix服务端利用自带的工具zabbix_get获取agent端的数据

#查看命令的使用方法
[root@filestore-v2 ~]# /data/application/zabbix-4.4./bin/zabbix_get --help
usage:
zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address] -k item-key
zabbix_get -h
zabbix_get -V
General options:
-s --host host-name-or-IP 获取数据的IP地址
-p --port port-number 获取数据的端口 (默认端口: )
-I --source-address IP-address 指定该数据往哪个网口出去,这里主要是涉及多网卡的时候使用
-k --key item-key 指定监控项的key值
-h --help 查看帮忙文档
-V --version 显示当前agent版本 #获取主机CPU负载
[root@filestore-v2 ~]# /data/application/zabbix-4.4./bin/zabbix_get -s 192.168.10.95 -k "system.cpu.load[all,avg1]"
0.140000 #获取当前主机名
[root@filestore-v2 ~]# /data/application/zabbix-4.4./bin/zabbix_get -s 192.168.10.95 -k system.uname
Linux sms-v2 3.10.-.el7.x86_64 # SMP Fri Apr :: UTC x86_64

下一篇【Zabbix快速开始配置】请点击查看

第二篇【Zabbix客户端的完整布署】的更多相关文章

  1. 第一篇【Zabbix服务端的完整布署】

    1.环境准备 服务器版本: [root@filestore-v2 ~]# cat /etc/redhat-release CentOS Linux release (Core) 内核版本: [root ...

  2. Zabbix 客户端安装教程(第二篇)

    Zabbix 客户端安装教程 blog地址:http://www.cnblogs.com/caoguo [root@localhost ~]# yum install -y gcc make [roo ...

  3. openstack私有云布署实践【9.3 主从controller单向同步glance-image目录】

    采用Rysnc单向同步,而不用双方实时同步,原因是在历史的运行过程中,我们发现,有些镜像包太大,当在主用的glance将镜像保存时,并不是一时半会就把镜像保存好,当主用在保存时,备用节点又在实时同步那 ...

  4. JDFS:一款分布式文件管理实用程序第二篇(更新升级、解决一些bug)

    一 前言 本文是<JDFS:一款分布式文件管理实用程序>系列博客的第二篇,在上一篇博客中,笔者向读者展示了JDFS的核心功能部分,包括:服务端与客户端部分的上传.下载功能的实现,epoll ...

  5. 【第二篇】ASP.NET MVC快速入门之数据注解(MVC5+EF6)

    目录 [第一篇]ASP.NET MVC快速入门之数据库操作(MVC5+EF6) [第二篇]ASP.NET MVC快速入门之数据注解(MVC5+EF6) [第三篇]ASP.NET MVC快速入门之安全策 ...

  6. CentOS ASP.NET Core Runtime Jexus跨平台布署

    .net core 开源和跨平台,能布署到当前主流的Windows,Linux,macOS 系统上.本篇我们将在 Linux 系统上使用 ASP.NET Core Runtime 和 Jexus 布署 ...

  7. 跟我学SpringCloud | 第二篇:注册中心Eureka

    Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...

  8. [ 高并发]Java高并发编程系列第二篇--线程同步

    高并发,听起来高大上的一个词汇,在身处于互联网潮的社会大趋势下,高并发赋予了更多的传奇色彩.首先,我们可以看到很多招聘中,会提到有高并发项目者优先.高并发,意味着,你的前雇主,有很大的业务层面的需求, ...

  9. 从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群)

    从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www ...

随机推荐

  1. shell作业01

    1.判断/etc/inittab文件是否大于100行,如果大于,则显示”/etc/inittab is a big file.”否者显示”/etc/inittab is a small file.” ...

  2. hue的优化

    参考: 官网: https://docs.cloudera.com/documentation/enterprise/6/6.2/topics/hue_ref_arch.html 1/ 和开发沟通是否 ...

  3. SQLite基础-2.PyCharm+Database_Navigator

    目录 一.PyCharm + Database Navigator插件 二.SQLite Expert – Personal Edition 三.SQLite Administrator 一.PyCh ...

  4. ASP.NET Core中使用EF Core(MySql)Database First

    ⒈创建数据库,在数据中执行以下脚本. CREATE DATABASE Blogging; USE Blogging; CREATE TABLE Blog ( BlogId int not null P ...

  5. CSS(下)

    目录 CSS(下) CSS属性相关 宽和高 字体属性 背景属性 边框 border-radius display属性 CSS盒子模型 margin外边距 padding内填充 浮动(float) 限制 ...

  6. Dubbo消费方服务调用过程源码分析

    参考:dubbo消费方服务调用过程源码分析dubbo基于spring的构建分析Dubbo概述--调用过程dubbo 请求调用过程分析dubbo集群容错机制代码分析1dubbo集群容错策略的代码分析2d ...

  7. Java排序--排序算法(内排序)

    常用内排序算法 我们通常所说的排序算法往往指的是内部排序算法,即需要排序的数据在计算机内存中完成整个排序的过程,当数据率超大或排序较为繁琐时常借助于计算机的硬盘对大数据进行排序工作,称之为外部排序算法 ...

  8. 关于redis的几件小事(五)redis保证高并发以及高可用

    如果你用redis缓存技术的话,肯定要考虑如何用redis来加多台机器,保证redis是高并发的,还有就是如何让Redis保证自己不是挂掉以后就直接死掉了,redis高可用 redis高并发:主从架构 ...

  9. python之BeautifulSoup4

    阅读目录 1.Beautiful Soup4的安装配置 2.BeautifulSoup的基本用法 (1)节点选择器(tag) (2)方法选择器 (3)CSS选择器 (4)tag修改方法 Beautif ...

  10. js 获取当前月份 第一天和最后一天

    js 获取当前月份 第一天和最后一天 var now = new Date(); //当前日期 var nowMonth = now.getMonth(); //当前月 var nowYear = n ...