z-sever
yum list | grep nginx # 查看 nginx 版本 ,这里使用 1.20
nginx.x86_64 1:1.20.1-10.el7 epel
yum install -y nginx
# 安装 php
`https://webtatic.com/packages/php72/` # 源的官网地址
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# 另一个源(快点)
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
##启用 remi 仓库:
yum-config-manager --enable remi-php72
yum update
yum install php72w-fpm php72w-gd php72w-mbstring php72w-bcmath php72w-xml php72w-ldap php72w-mysqlnd -y
# nginx 支持 php
server {
listen 80;
server_name localhost;
root /code/zabbix;
location / {
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# $document_root = /code/zabbix/
# fastcgi_param SCRIPT_FILENAME /code/zabbbix/$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# php 配置
# 修改用户 因为 nginx 的启动是用的 nginx 用户,所以 php 也要用 nginx 确保统一
sed -rn '/^(user|group)/p' /etc/php-fpm.d/www.conf
-----
user = apache
group = apache
-----
sed -r -i.bak '/^(user|group)/s#apache#nginx#g' /etc/php-fpm.d/www.conf
# session 会话
grep 'var/lib/php/session' /etc/php-fpm.d/www.conf
# 文件中有该句子
php_value[session.save_path] = /var/lib/php/session
# 有该文件
ls /var/lib/php/session
stat /var/lib/php/session # 确保用户为 nginx
# Access: (0770/drwxrwx---) Uid: ( 997/ nginx) Gid: ( 995/ nginx)
# 配置 mysql
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
# 配置 zabbix yum 源
# 1. 查看获取连接
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm?spm=a2c6h.25603864.0.0.3acf2e2fnzfYxy
# https://mirrors.aliyun.com/zabbix/zabbix 这段截取自网页地址
sed -r -i.bak 's#http://repo.zabbix.com/zabbix#https://mirrors.aliyun.com/zabbix/zabbix#g' /etc/yum.repos.d/zabbix.repo
yum install -y zabbix-server-mysql zabbix-agent2
# 相关文件
[root@localhost ~]# rpm -ql zabbix-server-mysql
/etc/logrotate.d/zabbix-server
/etc/zabbix/zabbix_server.conf
/usr/lib/systemd/system/zabbix-server.service
/usr/lib/tmpfiles.d/zabbix-server.conf
/usr/lib/zabbix/alertscripts
/usr/lib/zabbix/externalscripts
/usr/sbin/zabbix_server_mysql
/usr/share/doc/zabbix-server-mysql-5.0.36
/usr/share/doc/zabbix-server-mysql-5.0.36/AUTHORS
/usr/share/doc/zabbix-server-mysql-5.0.36/COPYING
/usr/share/doc/zabbix-server-mysql-5.0.36/ChangeLog
/usr/share/doc/zabbix-server-mysql-5.0.36/NEWS
/usr/share/doc/zabbix-server-mysql-5.0.36/README
/usr/share/doc/zabbix-server-mysql-5.0.36/create.sql.gz # 数据库
/usr/share/doc/zabbix-server-mysql-5.0.36/double.sql
/usr/share/man/man8/zabbix_server.8.gz
/var/log/zabbix
/var/run/zabbix
# zabbix 数据导入
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -ppassword zabbix
# zabbix 服务端连接数据库
egrep '^DB' /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
# zabbix_server.conf 的默认配置
egrep '^[a-Z]' /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1
# 启动服务端 zabbix-server
systemctl start zabbix-server.service
netstat -lntp | grep zabbix
tcp 0 0 0.0.0.0:10051 LISTEN 67026/zabbix_server
tcp6 0 0 :::10051 LISTEN 67026/zabbix_server
# 前端页面
# 源码包地址:https://www.zabbix.com/cn/download_sources#50LTS
mv /root/zabbix-5.0.36/ui/* /code/zabbix/
[root@localhost zabbix-5.0.36]# chown -R nginx:nginx /code/zabbix/
# 使用浏览器访问页面,点击下一步就会报错,根据提示更改
egrep '^(max_execution|max_input|post_max|date)' /etc/php.ini
----
max_execution_time = 300
max_input_time = 300
post_max_size = 16M
date.timezone = Asia/Shanghai
----
systemctl reload php-fpm
# 接着在前端按要求输入响应的信息即可
# 不出问题:Configuration file "conf/zabbix.conf.php" created.
/code/zabbix/conf/zabbix.conf.php # 为在浏览器上输入的信息,在这可以改
# 之后点击 finish,登录 用户名:Admin 密码:zabix
错误
- php7 不支持
这样的语法结构, 访问的页面是空白的。但是php8 支持
z-client 安装
yum install -y zabbix-agent2
# 配置文件的默认项
egrep -v '#|^$' /etc/zabbix/zabbix_agent2.conf
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log # 日志文件
LogFileSize=0
Server=127.0.0.1 # 服务端在本地所以不用更改
ServerActive=127.0.0.1
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agent2.d/*.conf
ControlSocket=/tmp/agent.sock
# 启动
systemctl start zabbix-agent2.service
systemctl enable zabbix-agent2.service
远程安装 zabbix 客户端
# 1. 在安装过客户端的主机上查看安装的版本
rpm -qa | grep zabbix
zabbix-release-5.0-1.el7.noarch
zabbix-server-mysql-5.0.36-1.el7.x86_64
zabbix-agent2-5.0.36-1.el7.x86_64
# 2. 在阿里云镜像仓库中找到该版本,复制连接地址安装即可
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-agent2-5.0.36-1.el7.x86_64.rpm?spm=a2c6h.25603864.0.0.3acf2e2f58dH7Z
# 3. 修改配置文件
egrep -w '^Server' /etc/zabbix/zabbix_agent2.conf
Server=172.17.1.16
# 4. 启动并检查
systemctl start zabbix-agent2.service
systemctl enable zabbix-agent2.service
netstat -lntp | grep 10050
tcp6 0 0 :::10050 LISTEN 1940/zabbix_agent2
[root@lnpm ~]# telnet 172.17.1.16 10051
Trying 172.17.1.16...
Connected to 172.17.1.16.
Escape character is '^]'.
# 在服务端进行调试
# 服务端安装 zabbix-get
yum install -y zabbix-get
# 获取远程客户端的主机名
zabbix_get -s 172.17.1.11 -p 10050 -k "system.hostname"
lnpm
添加客户端
/etc/logrotate.d/zabbix-server # 日志切割文件
/etc/zabbix/zabbix_server.conf # 配置文件
/usr/lib/systemd/system/zabbix-server.service # systemctl start 调用配置文件
/usr/lib/tmpfiles.d/zabbix-server.conf # 配置文件的备份
/usr/lib/zabbix/alertscripts # 报警脚本,如短信报警脚本
/usr/lib/zabbix/externalscripts # 额外的脚本
/usr/sbin/zabbix_server_mysql # zabbix 服务端命令
/usr/share/doc/zabbix-server-mysql-5.0.36/create.sql.gz # 建表语句
/usr/share/doc/zabbix-server-mysql-5.0.36/double.sql # 建表语句
/usr/share/man/man8/zabbix_server.8.gz # 帮助文件
/var/log/zabbix # 日志文件
/var/run/zabbix # pid 文件存放处
zabbix_server.conf
配置文件详细说明地址
egrep '^[a-Z]' /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log # 日志文件
LogFileSize=0 # 日志文件大小,0 表示不限制大小,并关闭日志切割功能
PidFile=/var/run/zabbix/zabbix_server.pid # 指定 pid 文件
SocketDir=/var/run/zabbix # 指定 socket 文件
## 数据库相关配置
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log # snmp 相关日志
Timeout=4 # 超时时间
AlertScriptsPath=/usr/lib/zabbix/alertscripts # 告警脚本的路径
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000 # 慢查询日志超过 3000 毫秒记录日志
StatsAllowedIP=127.0.0.1 # 谁可以查看服务端状态
rpm -ql zabbix-agent2
/etc/logrotate.d/zabbix-agent2
/etc/zabbix/zabbix_agent2.conf
/etc/zabbix/zabbix_agent2.d
/usr/lib/systemd/system/zabbix-agent2.service
/usr/lib/tmpfiles.d/zabbix_agent2.conf
/usr/sbin/zabbix_agent2
/usr/share/doc/zabbix-agent2-5.0.36
/usr/share/man/man8/zabbix_agent2.8.gz
/var/log/zabbix
/var/run/zabbix
zabbix_agent2.conf
egrep -v '#|^$' /etc/zabbix/zabbix_agent2.conf
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log # 日志文件
LogFileSize=0
Server=127.0.0.1 # zabbix 服务端 ip 地址
ServerActive=127.0.0.1 # zabbix 客户端主动模式的服务端 IP 地址
Hostname=Zabbix server # 客户端主机名
Include=/etc/zabbix/zabbix_agent2.d/*.conf # 子配置文件的目录
ControlSocket=/tmp/agent.sock
内置键值
[root@lnpm ~]# zabbix_agent2 -p
agent.hostname [s|Zabbix server]
agent.ping [s|1]
agent.variant [s|2]
agent.version [s|5.0.36]
system.localtime[utc] [s|1690529410]
system.run[echo test] [m|ZBX_NOTSUPPORTED] [Unknown metric system.run]
web.page.get[localhost,,80] [m|ZBX_NOTSUPPORTED] [Cannot get
web.page.perf[localhost,,80] [m|ZBX_NOTSUPPORTED] [Cannot get
web.page.regexp[localhost,,80,OK] [s|]
vfs.file.size[/etc/passwd] [s|1123]
vfs.file.time[/etc/passwd,modify] [s|1690518903]
vfs.file.exists[/etc/passwd] [s|1]
vfs.file.contents[/etc/passwd] [s|root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:998:User for polkitd:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
chrony:x:998:996::/var/lib/chrony:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
mysql:x:27:27:MariaDB Server:/var/lib/mysql:/sbin/nologin
nginx:x:997:995:Nginx web server:/var/lib/nginx:/sbin/nologin
php-fpm:x:1000:1000::/home/php-fpm:/sbin/nologin
zabbix:x:996:994:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin]
vfs.file.regexp[/etc/passwd,root] [s|root:x:0:0:root:/root:/bin/bash]
vfs.file.regmatch[/etc/passwd,root] [s|1]
vfs.file.md5sum[/etc/passwd] [s|134d8f7a80528c8f5cb803c02cdd06d9]
vfs.file.cksum[/etc/passwd] [s|1216594187]
vfs.dir.size[/var/log] [s|7243609]
vfs.dir.count[/var/log] [s|59]
net.dns[,zabbix.com] [s|1]
net.dns.record[,zabbix.com] [s|zabbix.com SOA =
net.tcp.dns[,zabbix.com] [m|ZBX_NOTSUPPORTED] [Unknown metric net.tcp.dns]
net.tcp.dns.query[,zabbix.com] [m|ZBX_NOTSUPPORTED] [Unknown metric net.tcp.dns.query]
net.tcp.port[,80] [s|1]
system.users.num [s|1]
log[logfile] [m|ZBX_NOTSUPPORTED] [The "log" key
log.count[logfile] [m|ZBX_NOTSUPPORTED] [The "log.count"
logrt[logfile] [m|ZBX_NOTSUPPORTED] [The "logrt" key
logrt.count[logfile] [m|ZBX_NOTSUPPORTED] [The ]
zabbix.stats[127.0.0.1,10051] [m|ZBX_NOTSUPPORTED] [Cannot obtain ]
kernel.maxfiles [s|365312]
kernel.maxproc [s|131072]
vfs.fs.size[/,free] [s|34376478720]
vfs.fs.inode[/,free] [s|18344796]
vfs.fs.discovery .......
vfs.fs.get ......
vfs.dev.write[sda,operations] [s|1989]
net.tcp.listen[80] [s|1]
net.udp.listen[68] [s|0]
net.if.in[lo,bytes] [s|17341]
net.if.out[lo,bytes] [s|17341]
net.if.total[lo,bytes] [s|34682]
net.if.collisions[lo] [s|0]
net.if.discovery .......
vm.memory.size[total] [s|3953967104]
proc.cpu.util[inetd] [s|0.000000]
proc.num[inetd] [s|0]
proc.mem[inetd] [s|0]
system.cpu.switches [s|1889536]
system.cpu.intr [s|1179761]
system.cpu.util[all,user,avg1] [s|0.000000]
system.cpu.load[all,avg1] [s|0.000000]
system.cpu.num[online] [s|4]
system.cpu.discovery .....
system.uname ......
system.hw.chassis ......
system.hw.cpu ......
system.hw.devices ......
system.hw.macaddr [s|[ens33] 00:0c:29:4e:6e:5a, [ens36] 00:0c:29:4e:6e:64]
system.sw.arch [s|x86_64]
system.sw.os [s|Linux version 3.10.0-
system.sw.packages ......
system.swap.size[all,free] [s|4160745472]
system.swap.in[all] [s|0]
system.swap.out[all] [s|0]
system.uptime [s|10553]
system.boottime [s|1690518867]
sensor[w83781d-i2c-0-2d,temp1] [m|ZBX_NOTSUPPORTED] [Cannot obtain sensor information.]
net.tcp.service[ssh,127.0.0.1,22] [s|1]
net.tcp.service.perf[ssh,127.0.0.1,22] [s|0.007006]
net.udp.service[ntp,127.0.0.1,123] [s|0]
net.udp.service.perf[ntp,127.0.0.1,123] [s|0.000000]
system.hostname [s|lnpm]
具体步骤
使用命令或者 shell 获取监控项的结果
netstat -lntp | grep -wc 80
1
将上述命令写入配置文件并进行检测
cat /etc/zabbix/zabbix_agent2.d/web.conf
# UserParameters=,
UserParameter=nginx.status,netstat -lntp | grep -wc 80
systemctl restart zabbix-agent2
# 服务端执行命令如下
zabbix_get -s 172.17.1.11 -p 10050 -k "nginx.status"
2
# UserParameter 的另一种写法
UserParameter=nginx.states[*],sh sudo /usr/local/src/script/status.sh "$1"
# 执行的时候这样执行
zabbix_get -s lnmp -k 'nginx.states[reading]'
触发器
图形
结果查看
BUFAXVEUWFEBOZBH
增加用户群组和用户
将动作启用
在 tomcat 中配置
egrep '^CATALINA_OPTS' /usr/local/tomcat/bin/catalina.sh
# 开启 jmx 远程监控
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote=true"
# 远程监控的端口号为 12345
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.port=12345"
# 关闭用户认证
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
# 关闭 ssl 加密
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
# 本主机的 IP 地址
CATALINA_OPTS="$CATALINA_OPTS -Djava.rmi.server.hostname=192.168.222.11"
# 重启 tomcat 即可
# 查看监听的端口
netstat -lntp | grep java
tcp6 0 0 :::37943 LISTEN 21305/java
tcp6 0 0 :::12345 LISTEN 21305/java
tcp6 0 0 :::44987 LISTEN 21305/java
tcp6 0 0 127.0.0.1:8005 LISTEN 21305/java
tcp6 0 0 :::8080 LISTEN 21305/java
在 java-geteway
egrep '^[a-Z]' /etc/zabbix/zabbix_java_gateway.conf
LISTEN_PORT=10052
PID_FILE="/var/run/zabbix/zabbix_java.pid"
# 重启
netstat -lntp | grep java
tcp6 0 0 :::10052 LISTEN 3179/java
zabbix 服务端的配置
egrep '^(Java|StartJava)' /etc/zabbix/zabbix_server.conf
JavaGateway=127.0.0.1 # zabbix-java-gateway 的主机地址
JavaGatewayPort=10052 # 监听端口号
StartJavaPollers=5 # 开设的进程数
# 重启
netstat -lntp | grep zabbix
tcp 0 0 0.0.0.0:10051 LISTEN 3189/zabbix_server
tcp6 0 0 :::10050 LISTEN 1110/zabbix_agent2
tcp6 0 0 :::10051 LISTEN 3189/zabbix_server
修改客户端配置文件
egrep '^(Server|Host)' /etc/zabbix/zabbix_agent2.conf
Server=172.17.1.16
ServerActive=172.17.1.16 # 自动注册的服务端
HostnameItem=system.hostname # 自动获取 hostname
HostMetadataItem=system.hostname # 元数据信息
停用自动发现
停用自动发现的动作
添加自动注册动作
查看服务端日志
3385:20230731:102630.234 cannot send list of active checks to "172.17.1.12": host [database] not found
3374:20230731:102704.614 enabling Zabbix agent checks on host "database": host became available
部署代理服务器
# 确定 zabbix-proxy 安装版本
yum list | grep zabbix-proxy-mysql
zabbix-proxy-mysql.x86_64 5.0.36-1.el7 zabbix
# 去阿里云找到对应的版本安装即可
# 这里使用 yum 安装,因为有必要的依赖
yum install -y http://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-proxy-mysql-5.0.36-1.el7.x86_64.rpm
# 编辑配置文件
egrep '^(Server|DB|Host)' /etc/zabbix/zabbix_proxy.conf
Server=172.17.1.16
Hostname=JN-proxy
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=1
DBPort=3306
# 添加数据库
mysql -uroot -p1
create database zabbix_proxy character set utf8 collate utf8_bin;
create user zabbix@localhost identified by '1';
grant all privileges on zabbix_proxy.* to zabbix@localhost;
set global log_bin_trust_function_creators = 1;
# 注入 sql 语句
zcat /usr/share/doc/zabbix-proxy-mysql-5.0.36/schema.sql.gz | mysql -uzabbix -p1 zabbix_proxy
# 启动、开机自启 proxy
成功
# 服务端的日志
3384:20230731:122607.193 cannot parse proxy data from active proxy at "172.17.1.12": proxy "JN-proxy" not found
3384:20230731:122820.198 sending configuration data to proxy "JN-proxy" at "172.17.1.12", datalen 3662, bytes 1299 with compression ratio 2.8
添加客户端
# 修改客户端的配置文件
egrep -w '^Server' /etc/zabbix/zabbix_agent2.conf
Server=172.17.1.12 # 将服务端改为 proxy 的主机地址
# 获取 token
curl -s -X POST -H content-type:application/json-rpc 172.17.1.16/api_jsonrpc.php -d '{
"jsonrpc": "2.0",
"method": "user.login",
"params": {
"user": "Admin",
"password": "zabbix"
},
"id": 1,
"auth": null
}
' | jq
{
"jsonrpc": "2.0",
"result": "08c732196216551717dc982a6959f766",
"id": 1
}
curl -s -X POST -H content-type:application/json-rpc 172.17.1.16/api_jsonrpc.php -d '{
"jsonrpc": "2.0",
"method": "user.login",
"params": {
"user": "Admin",
"password": "zabbix"
},
"id": 1,
"auth": null
}
' | jq .result # 获取多个值 jq ".result, .id"
"a11daeabb2fb023afb5da0e892838b2b"
# 官网 https://www.zabbix.com/documentation/5.0/en/manual/api/reference
# 获取主机列表
curl -s -X POST -H content-type:application/json-rpc 172.17.1.16/api_jsonrpc.php -d '{
"jsonrpc": "2.0",
"method": "host.get",
"params": {
"output": [
"hostid",
"host"
],
"selectInterfaces": [
"interfaceid",
"ip"
]
},
"id": 2,
"auth": "'$token'"
}' | jq
缓存和进程数量
# 总缓存:用于存储主机、监控项、触发器数据的共享内存的大小
CacheSize=8M # 可以优先修改总缓存
# 历史数据缓存
HistoryCacheSize=16M
# 历史数据索引缓存
HistoryIndexCacheSize=4M
# 趋势数据缓存
TrendCacheSize=4M
# 值的缓存
ValueCacheSize=8M
# 从阿里云镜像仓库中寻找
yum install -y https://mirrors.aliyun.com/grafana/yum/rpm/Packages/grafana-8.0.2-1.x86_64.rpm
systemctl start grafana-server.service
systemctl enable grafana-server.service
netstat -lntp | grep 3000
tcp6 0 0 :::3000 LISTEN 4028/grafana-server
# 安装插件
grafana-cli plugins list-remote | grep zabbix
id: alexanderzobnin-zabbix-app version: 4.2.6
# 安装不上
grafana-cli plugins install alexanderzobnin-zabbix-app 4.2.6
Error: ✗ failed to download plugin archive: Failed to send request: Get "https://storage.googleapis.com/plugins-community/alexanderzobnin-zabbix-app/release/4.2.6/alexanderzobnin-zabbix-app-4.2.6.zip": read tcp 192.168.222.16:42446->172.217.160.80:443: read: connection reset by peer
# 页面搜索 alexanderzobnin-zabbix-app-4.2.6.zip 去 GitHub 下载即可
unzip alexanderzobnin-zabbix-app-4.2.6.zip
mv alexanderzobnin-zabbix-app /var/lib/grafana/plugins/
systemctl restart grafana-server.service
# 然后去 web 页面配置即可
# web 页面 用户名:admin 密码:admin
http://192.168.222.16/api_jsonrpc.php
查看成果
负载均衡(nginx lvs haproxy)
web 服务器
数据库服务监控
存储服务
zabbix 客户端模式(被动) 通用,配合模板或自定义检控使用
zabbix 客户端(主动模式) zabbix 客户端主动把数据发送给服务端
简单检查 不需要客户端,功能少,只能检查网络情况
SNMP 简单网络管理协议,zabbix 监控网络设备使用
内部检查 监控 zabbix 内部进程,未来优化可以使用
HTTP 代理 由 zabbix server 发出 http 请求给客户端,根据响应进行二次加工处理
JMX 监控 Java 程序
IPMI 监控硬件
Serveractive=
监控项类型
:zabbix 客户端(主动模式)visudo
99 ## Allow root to run any commands anywhere
100 root ALL=(ALL) ALL
101 zabbix ALL=(ALL:ALL) ALL
cat /etc/zabbix/zabbix_agent2.d/web.conf
# UserParameters=,
UserParameter=nginx.status,netstat -lntp | grep -wc 80
UserParameter=nginx.states[*],sh sudo /usr/local/src/script/status.sh "$1"
UserParameter=test.shadow,sudo cat /etc/shadow
# 1. 在自己的 windows 上找到字体包
cd /code/zabbix/assets/fonts/
mv DejaVuSans.ttf DejaVuSans.ttf.bak
mv MSYH.TTC DejaVuSans.ttf