https://mp.weixin.qq.com/s/DQND4hmyYJrl54lqcTMEJA 你所见过最详细的Zabbix使用教程【收藏版】

Centos7.3安装部署最新版Zabbix3.4

 https://blog.csdn.net/xiegh2014/article/details/77571965

zabbix 3.4 邮件报警配置

zabbix 3.4 配置文件说明

[root@zabbix ~]# zabbix_server -V
zabbix_server (Zabbix) 3.4.7
Revision 77720 16 February 2018, compilation time: Feb 19 2018 07:28:20

[root@zabbix ~]# zabbix_get -V
zabbix_get (Zabbix) 3.4.7
Revision 77720 16 February 2018, compilation time: Feb 19 2018 07:28:40

zabbix 3.4

zabbix_server.conf说明

yum install zabbix-get
服务端安装zabbix-get检测工具
zabbix_get :command not found 解决办法
yum list all |grep zabbix 会列出zabbix 客户端信息
yum install zabbix-get.x86_64

zabbix_agentd.conf说明

[root@dns988 zabbix]# vim /etc/zabbix/zabbix_agentd.conf

Server=172.17.0.150 填写Server的IP地址
ServerActive=172.17.0.150 修改为Server的IP地址
Hostname=172.17.0.150 一般写IP
Hostname=h3.worker.com 或者本机的主机名称uname -rn 名称在服务器端用能够解析
UnsafeUserParameters=1 #是否允许自定义的key,1为允许,0为不允许
Include=/etc/zabbix/zabbix_agentd.d/*.conf 配置文件打开此功能,这样可以将脚本放在这个目录下,各种.conf 配置一目了然。

备注:如果希望使用root用户启动,则修改 zabbix_agentd.conf中 AllowRoot=1

[root@dns988 zabbix]# systemctl stop zabbix-agent.service
[root@dns988 zabbix]# ss -tnlp |grep 10050
[root@dns988 zabbix]# systemctl start zabbix-agent.service
[root@dns988 zabbix]# ss -tnlp |grep 10050

Zabbix监控nginx性能(113)监控Nginx的7种连接 状态ngx_status
http://www.ttlsa.com/zabbix/zabbix-monitor-nginx-performance/
前提是打开NGINX 的status 模块的功能
location /ngx_status {
allow 0.0.0.0;
stub_status on;
}

[root@localhost zabbix_agentd.d]# pwd
/etc/zabbix/zabbix_agentd.d
[root@localhost zabbix_agentd.d]# vim nginx_status.conf
UserParameter=nginx.status[*],/etc/zabbix/zabbix_agentd.d/nginx_status.sh $1

[root@localhost zabbix_agentd.d]# vim nginx_status.sh
#!/bin/bash
HOST="127.0.0.1"
PORT="80"

检测nginx进程是否存在

function ping {
/sbin/pidof nginx | wc -l
}

检测nginx性能

function active {
/usr/bin/curl "http://$HOST:$PORT/ngx_status/" 2>/dev/null| grep 'Active' | awk '{print $NF}'
}
function reading {
/usr/bin/curl "http://$HOST:$PORT/ngx_status/" 2>/dev/null| grep 'Reading' | awk '{print $2}'
}
function writing {
/usr/bin/curl "http://$HOST:$PORT/ngx_status/" 2>/dev/null| grep 'Writing' | awk '{print $4}'
}
function waiting {
/usr/bin/curl "http://$HOST:$PORT/ngx_status/" 2>/dev/null| grep 'Waiting' | awk '{print $6}'
}
function accepts {
/usr/bin/curl "http://$HOST:$PORT/ngx_status/" 2>/dev/null| awk NR==3 | awk '{print $1}'
}
function handled {
/usr/bin/curl "http://$HOST:$PORT/ngx_status/" 2>/dev/null| awk NR==3 | awk '{print $2}'
}
function requests {
/usr/bin/curl "http://$HOST:$PORT/ngx_status/" 2>/dev/null| awk NR==3 | awk '{print $3}'
}

执行function

$1

Zabbix结合OneAlert实现免费电话报警以及微信、短信、邮件报警
http://www.21yunwei.com/archives/5134

Zabbix 3.4配置钉钉机器人报警图文教程

zabbix 监控TCP的连接状态,采用脚本的方式 ----自定义监控与监控报警
ZABBIX 3.2 监控服务器TCP连接状态(https://www.abcdocker.com/abcdocker/2652)

使用zabbix监控tcp连接数

https://blog.csdn.net/messiaDemo/article/details/52183692
脚本如下:
[root@zabbix zabbix_agentd.d]# vim tcp_status.sh

#!/bin/bash
#this script is used to get tcp and udp connetion status
#tcp status
metric=$1
tmp_file=/tmp/tcp_status.txt
/bin/netstat -an|awk '/^tcp/{++S[$NF]}END{for(a in S) print a,S[a]}' > $tmp_file
case $metric in
closed)
output=$(awk '/CLOSED/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
listen)
output=$(awk '/LISTEN/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
synrecv)
output=$(awk '/SYN_RECV/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
synsent)
output=$(awk '/SYN_SENT/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
established)
output=$(awk '/ESTABLISHED/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
timewait)
output=$(awk '/TIME_WAIT/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
closing)
output=$(awk '/CLOSING/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
closewait)
output=$(awk '/CLOSE_WAIT/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
lastack)
output=$(awk '/LAST_ACK/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
finwait1)
output=$(awk '/FIN_WAIT1/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
finwait2)
output=$(awk '/FIN_WAIT2/{print $2}' $tmp_file)
if [ "$output" == "" ];then
echo 0
else
echo $output
fi
;;
*)
echo -e "\e[033mUsage: sh $0 [closed|closing|closewait|synrecv|synsent|finwait1|finwait2|listen|established|lastack|timewait]\e[0m"
esac

[root@zabbix zabbix_agentd.d]# ls 自定义用户参数
status.conf tcp_status.sh userparameter_mysql.conf
[root@zabbix zabbix_agentd.d]# vim status.conf

UserParameter=tcp.status[*],/etc/zabbix/zabbix_agentd.d/tcp_status.sh "$1"

zabbix监控redis--采用脚本的方式

zabbix3.x监控reddis模板

https://www.cnblogs.com/sixiweb/p/6893858.html

[root@template zabbix]# vim redis.sh
#!/bin/bash
REDISPATH="/usr/local/redis/bin/redis-cli"
HOST="172.17.9.29"
PORT="6379"
REDIS_PA="$REDISPATH -h $HOST -p $PORT info"
if [[ $# == 1 ]];then
case $1 in
cluster)
result=$REDIS_PA|/bin/grep cluster|awk -F":" '{print $NF}'
echo $result
;;
uptime_in_seconds)
result=$REDIS_PA|/bin/grep uptime_in_seconds|awk -F":" '{print $NF}'
echo $result
;;
connected_clients)
result=$REDIS_PA|/bin/grep connected_clients|awk -F":" '{print $NF}'
echo $result
;;
client_longest_output_list)
result=$REDIS_PA|/bin/grep client_longest_output_list|awk -F":" '{print $NF}'
echo $result
;;
client_biggest_input_buf)
result=$REDIS_PA|/bin/grep client_biggest_input_buf|awk -F":" '{print $NF}'
echo $result
;;
blocked_clients)
result=$REDIS_PA|/bin/grep blocked_clients|awk -F":" '{print $NF}'
echo $result
;;
#内存
used_memory)
result=$REDIS_PA|/bin/grep used_memory|awk -F":" '{print $NF}'|awk 'NR==1'
echo $result
;;
used_memory_human)
result=$REDIS_PA|/bin/grep used_memory_human|awk -F":" '{print $NF}'|awk -F'K' '{print $1}'
echo $result
;;
used_memory_rss)
result=$REDIS_PA|/bin/grep used_memory_rss|awk -F":" '{print $NF}'
echo $result
;;
used_memory_peak)
result=$REDIS_PA|/bin/grep used_memory_peak|awk -F":" '{print $NF}'|awk 'NR==1'
echo $result
;;
used_memory_peak_human)
result=$REDIS_PA|/bin/grep used_memory_peak_human|awk -F":" '{print $NF}'|awk -F'K' '{print $1}'
echo $result
;;
used_memory_lua)
result=$REDIS_PA|/bin/grep used_memory_lua|awk -F":" '{print $NF}'
echo $result
;;
mem_fragmentation_ratio)
result=$REDIS_PA|/bin/grep mem_fragmentation_ratio|awk -F":" '{print $NF}'
echo $result
;;
#rdb
rdb_changes_since_last_save)
result=$REDIS_PA|/bin/grep rdb_changes_since_last_save|awk -F":" '{print $NF}'
echo $result
;;
rdb_bgsave_in_progress)
result=$REDIS_PA|/bin/grep rdb_bgsave_in_progress|awk -F":" '{print $NF}'
echo $result
;;
rdb_last_save_time)
result=$REDIS_PA|/bin/grep rdb_last_save_time|awk -F":" '{print $NF}'
echo $result
;;
rdb_last_bgsave_status)
result=$REDIS_PA|/bin/grep -w "rdb_last_bgsave_status" | awk -F':' '{print $2}' | /bin/grep -c ok
echo $result
;;
rdb_current_bgsave_time_sec)
result=$REDIS_PA|/bin/grep -w "rdb_current_bgsave_time_sec" | awk -F':' '{print $2}'
echo $result
;;
#rdbinfo
aof_enabled)
result=$REDIS_PA|/bin/grep -w "aof_enabled" | awk -F':' '{print $2}'
echo $result
;;
aof_rewrite_scheduled)
result=$REDIS_PA|/bin/grep -w "aof_rewrite_scheduled" | awk -F':' '{print $2}'
echo $result
;;
aof_last_rewrite_time_sec)
result=$REDIS_PA|/bin/grep -w "aof_last_rewrite_time_sec" | awk -F':' '{print $2}'
echo $result
;;
aof_current_rewrite_time_sec)
result=$REDIS_PA|/bin/grep -w "aof_current_rewrite_time_sec" | awk -F':' '{print $2}'
echo $result
;;
aof_last_bgrewrite_status)
result=$REDIS_PA|/bin/grep -w "aof_last_bgrewrite_status" | awk -F':' '{print $2}' | /bin/grep -c ok
echo $result
;;
#aofinfo
aof_current_size)
result=$REDIS_PA|/bin/grep -w "aof_current_size" | awk -F':' '{print $2}'
echo $result
;;
aof_base_size)
result=$REDIS_PA|/bin/grep -w "aof_base_size" | awk -F':' '{print $2}'
echo $result
;;
aof_pending_rewrite)
result=$REDIS_PA|/bin/grep -w "aof_pending_rewrite" | awk -F':' '{print $2}'
echo $result
;;
aof_buffer_length)
result=$REDIS_PA|/bin/grep -w "aof_buffer_length" | awk -F':' '{print $2}'
echo $result
;;
aof_rewrite_buffer_length)
result=$REDIS_PA|/bin/grep -w "aof_rewrite_buffer_length" | awk -F':' '{print $2}'
echo $result
;;
aof_pending_bio_fsync)
result=$REDIS_PA|/bin/grep -w "aof_pending_bio_fsync" | awk -F':' '{print $2}'
echo $result
;;
aof_delayed_fsync)
result=$REDIS_PA|/bin/grep -w "aof_delayed_fsync" | awk -F':' '{print $2}'
echo $result
;;
#stats
total_connections_received)
result=$REDIS_PA|/bin/grep -w "total_connections_received" | awk -F':' '{print $2}'
echo $result
;;
total_commands_processed)
result=$REDIS_PA|/bin/grep -w "total_commands_processed" | awk -F':' '{print $2}'
echo $result
;;
instantaneous_ops_per_sec)
result=$REDIS_PA|/bin/grep -w "instantaneous_ops_per_sec" | awk -F':' '{print $2}'
echo $result
;;
rejected_connections)
result=$REDIS_PA|/bin/grep -w "rejected_connections" | awk -F':' '{print $2}'
echo $result
;;
expired_keys)
result=$REDIS_PA|/bin/grep -w "expired_keys" | awk -F':' '{print $2}'
echo $result
;;
evicted_keys)
result=$REDIS_PA|/bin/grep -w "evicted_keys" | awk -F':' '{print $2}'
echo $result
;;
keyspace_hits)
result=$REDIS_PA|/bin/grep -w "keyspace_hits" | awk -F':' '{print $2}'
echo $result
;;
keyspace_misses)
result=$REDIS_PA|/bin/grep -w "keyspace_misses" | awk -F':' '{print $2}'
echo $result
;;
pubsub_channels)
result=$REDIS_PA|/bin/grep -w "pubsub_channels" | awk -F':' '{print $2}'
echo $result
;;
pubsub_channels)
result=$REDIS_PA|/bin/grep -w "pubsub_channels" | awk -F':' '{print $2}'
echo $result
;;
pubsub_patterns)
result=$REDIS_PA|/bin/grep -w "pubsub_patterns" | awk -F':' '{print $2}'
echo $result
;;
master_link_status)
result=$REDIS_PA|/bin/grep -w "master_link_status"|awk -F':' '{print $2}'|/bin/grep -c up
echo $result
;;
master_last_io_seconds_ago)
result=$REDIS_PA|/bin/grep -w "master_last_io_seconds_ago"|awk -F':' '{print $2}'
echo $result
;;
master_sync_in_progress)
result=$REDIS_PA|/bin/grep -w "master_sync_in_progress"|awk -F':' '{print $2}'
echo $result
;;
slave_priority)
result=$REDIS_PA|/bin/grep -w "slave_priority"|awk -F':' '{print $2}'
echo $result
;;
#cpu
used_cpu_sys)
result=$REDIS_PA|/bin/grep -w "used_cpu_sys"|awk -F':' '{print $2}'
echo $result
;;
used_cpu_user)
result=$REDIS_PA|/bin/grep -w "used_cpu_user"|awk -F':' '{print $2}'
echo $result
;;
used_cpu_sys_children)
result=$REDIS_PA|/bin/grep -w "used_cpu_sys_children"|awk -F':' '{print $2}'
echo $result
;;
used_cpu_user_children)
result=$REDIS_PA|/bin/grep -w "used_cpu_user_children"|awk -F':' '{print $2}'
echo $result
;;
)
echo "Usage:$0{uptime_in_seconds|connected_clients|client_longest_output_list|client_biggest_input_buf|blocked_clients|used_memory|used_m
emory_human|used_memory_rss|used_memory_peak|used_memory_peak_human|used_memory_lua|mem_fragmentation_ratio|rdb_changes_since_last_save|rdb_bgsav
e_in_progress|rdb_last_save_time|rdb_last_bgsave_status|rdb_current_bgsave_time_sec|aof_enabled|aof_rewrite_scheduled|aof_last_rewrite_time_sec|a
of_current_rewrite_time_sec|aof_last_bgrewrite_status|aof_current_size|aof_base_size|aof_pending_rewrite|aof_buffer_length|aof_rewrite_buffer_len
gth|aof_pending_bio_fsync|aof_delayed_fsync|rejected_connections|instantaneous_ops_per_sec|total_connections_received|total_commands_processed|ex
pired_keys|evicted_keys|keyspace_hits|keyspace_misses|pubsub_channels|pubsub_patterns|latest_fork_usec|connected_slaves|master_link_status|master
_sync_in_progress|master_last_io_seconds_ago|connected_slaves|slave_priority|used_cpu_user|used_cpu_sys|used_cpu_sys_children|used_cpu_user_child
ren}"
;;
esac
#db0:key
elif [[ $# == 2 ]];then
case $2 in
keys)
result=$REDIS_PA| /bin/grep -w "db0"| /bin/grep -w "$1" | /bin/grep -w "keys" | awk -F'=|,' '{print $2}'
echo $result
;;
expires)
result=$REDIS_PA| /bin/grep -w "db0"| /bin/grep -w "$1" | /bin/grep -w "expires" | awk -F'=|,' '{print $4}'
echo $result
;;
avg_ttl)
result=$REDIS_PA|/bin/grep -w "db0"| /bin/grep -w "$1" | /bin/grep -w "avg_ttl" | awk -F'=|,' '{print $6}'
echo $result
;;
)
echo "Usage:$0{db0 keys|db0 expires|db0 avg_ttl}"
;;
esac
fi

zabbix zatree 插件的安装
zabbix Graphtree 插件的使用
zabbix3.4安装graphtrees补丁 https://blog.csdn.net/mofiu/article/details/79724108

zabbix Grafana 单独使用,来展示高逼格的图像和使用,这里的版本比较旧了,可以Grafana 现在都5.0 版本了
https://blog.51cto.com/zlyang/1725204

zabbix 结合grafana设计自己的监控系统
https://blog.51cto.com/12768454/2065372

Zabbix 结合 Grafana 实现酷炫监控
http://www.sohu.com/a/145376291_151779

zabbix 结合Docker的使用和安装

zabbix自动发现,自动注册

zabbix 监控web 服务器
https://www.zabbix.com/documentation/3.4/zh/manual/web_monitoring

zabbix 监控URL地址 web场景

zabbix 应用服务监控

zabbix 的分布式监控和SNMP的使用 proxy多机房监控

zabbix 结合第三方报警平台www.onealert.com

zabbix的基本概念不做介绍

关于zabbix的模板说明

网上有制作好的模板https://github.com/zhangyao8/zabbix-community-repos 巧用模板来配置zabbix

zabbix 基于JMX监控tomcat
https://blog.csdn.net/a445588996/article/details/72240444

使用zabbix3.0.4的ICMP Ping模版实现对客户端网络状态的监控
https://blog.csdn.net/reblue520/article/details/76286911

zabbix监控php-fpm的性能
http://www.cnblogs.com/pythonal/p/7744437.html

zabbix入门到精通之初识用户参数User parameters
https://blog.51cto.com/nanwangting/category15.html

zabbix监控IDC机房丢包率的shell脚本
https://blog.csdn.net/m0_37886429/article/details/68060656

Zabbix监控Dell服务器硬件状态
https://blog.csdn.net/wh211212/article/details/70014141 OMSA介绍

https://blog.csdn.net/dai451954706/article/details/18558057
zabbix 监控服务器时间是否正确

zabbix 服务监控
https://www.zabbix.com/documentation/3.4/zh/manual/it_services

zabbix3.4监控华为防火墙USG6600
https://blog.csdn.net/qq_39788858/article/details/78614353

Zabbix监控交换机设置
http://www.osyunwei.com/archives/8063.html

zabbix 硬件监控 系统监控 Java 监控 网络设备监控 SNMP

zabbix实战--Memcached,redis监控详解
https://blog.csdn.net/whs_321/article/details/54021333

【转载:九一乐维】zabbix 3.4新功能值——告警并发

https://blog.51cto.com/unclezb/1978020

Zabbix 3.0 添加监控 esxi 主机
http://www.bubuko.com/infodetail-1738157.html

https://blog.51cto.com/nanwangting/category15.html

关于vcenter log的日志存储:

cat /var/log/zabbix/zabbix_server.log

http://www.cnblogs.com/pythonal/p/6835098.html

Zabbix远程执行命令

https://blog.51cto.com/12098963/2093634

1、修改agent的配置文件
vim /application/zabbix/etc/zabbix_agentd.conf
EnableRemoteCommands=1

2、修改zabbix用户的执行权限

visudo

zabbix ALL=NOPASSWD:ALL

zabbix ALL=NOPASSWD:/etc/init.d/httpd start

并注释掉此行

Defaults requiretty

3、在Web管理界面操作

在Web管理界面操作

1、在发送报警的动作中添加新的操作类型<远程命令>

2、选择目标列表为需要操作的主机

3、类型为自定义脚本

sudo /etc/init.d/httpd start

4、重启客户端

解决zabbix的中文乱码的问题
https://www.cnblogs.com/kevingrace/p/5957283.html

对于DELL服务器,我们可以通过专用的Omsa来监控服务器的硬件信息
https://blog.csdn.net/wh211212/article/details/70014141
https://www.jianshu.com/p/ecbd5e21924b (这个更好还有模板)

Zabbix 监控 Esxi
https://www.linuxidc.com/Linux/2017-07/145943.htm

Zabbix 3.4.3实现企业微信报警
https://www.linuxidc.com/Linux/2017-11/148418.htm

基于Zabbix IPMI监控服务器硬件状况

https://blog.csdn.net/xiegh2014/article/details/72859982

zabbix3.2监控MYSQL状态

zabbix 监控各种服务
比如DNS,dhcp ,web 服务

关于zabbix的各种模板

15 / 15

zabbix 3.2.2 agent端(源码包)安装部署 (二)

https://www.cnblogs.com/miclesvic/p/6144924.html
如果不能正常启动,注意查看日志,有没有报错信息,这个非常关键是拍错首选之路,今天是在centos 6.8 上源码编译安装zabbix-3.4.7 ,错误的日志信息是
25611:20180403:105340.620 Zabbix Agent stopped. Zabbix 3.4.7 (revision 77720).
zabbix_agentd [10490]: cannot open PID file [/tmp/zabbix_agentd.pid]: [13] Permission denied
zabbix_agentd [10525]: cannot open PID file [/tmp/zabbix_agentd.pid]: [13] Permission denied
zabbix_agentd [14514]: cannot open PID file [/tmp/zabbix_agentd.pid]: [13] Permission denied

一看这个就知道原因了。

http://www.cactifans.org/ zabbix 社区 当代张思德

Zabbix监控docker

https://blog.csdn.net/xundh/article/details/71449577

运维基础——Zabbix 添加web页面url状态监控

https://blog.csdn.net/wn_hello/article/details/52121888

https://www.cnblogs.com/wjoyxt/p/7093372.html
http://www.mamicode.com/info-detail-1446472.html 这个图的展示更为友好
https://blog.51cto.com/825536458/1827735
Zabbix实现自动发现端口并监控
遇到的问题:,使用visudo 打开即可。
sudo:抱歉,您必须拥有一个终端来执行 sudo 解决办法
编辑 /etc/sudoers 文件,将Default requiretty注释掉。
sudo vim /etc/sudoers
#Default requiretty
#注释掉 Default requiretty 一行
关于zabbix的宏介绍