zabbix搭建及网络设备、服务器设备监控并设定邮箱、钉钉警报(更新中)
首先需要初步了解的是zabbix的系统简介,zabbix是一个开源监控系统;可监控服务器、网络设备等一切运行状况,可设置触发阈值通过微信、钉钉、邮箱、手机等通讯工具反馈给运维人员,非常好的一个监控开源系统,好了废话不多说,我们接下实操一遍,环境:centos7系统及以上+LAMP环境
(1)下载并安装centos7版本:http://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1908.iso (最大化安装)安装网上有教程在这里我们就不过多的介绍了(记得要关闭selinux和防火墙在进行操作)
[root@localhost ~]# vim /etc/sysconfig/selinux#(编辑selinux配置文件)
SELINUX=enforcing 改为 SELINUX=disabled#(此操作为永久关闭)
setenforce 0#(临时关闭)
[root@localhost ~]# systemctl stop firewalld.service #(临时关闭防火墙)
[root@localhost ~]# systemctl disable firewalld.service#(永久关闭防火墙)
(2)LAMP及zabbix安装教程
[root@localhost ~]# yum -y install wget net-snmp-devel OpenIPMI-devel httpd openssl-devel java lrzsz fping libcurl-devel perl-DBI pcre-devel libxml2 libxml2-devel mysql-devel gcc php php-bcmath php-gd php-xml php-mbstring php-ldap php-mysql.x86_64 php-pear php-xmlrpc net-tools mariadb mariadb-server#(LAMP及依赖包安装)
[root@localhost ~] # rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm #(安装zabbix源库)
[root@localhost ~]# vim /etc/yum.repos.d/zabbix.repo #(修改yum源的地址为阿里源,官网的地址服务器在国外,访问境外服务器,你们懂的)
- https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/
- https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
wq保存退出
[root@localhost ~]# yum clean all #(清理yum缓存)
[root@localhost ~]#yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent #(安装Zabbix server,Web前端,agent)
[root@localhost ~]# systemctl enable mariadb.service#(开机启用数据库服务)
[root@localhost ~]# systemctl start mariadb.service#(启用数据库)
[root@localhost ~]# mysql_secure_installation #(初始化数据库)
nter current password for root (enter for none): #(回车)
Set root password? [Y/n] y#(设置root密码按y)
New password: 123456#(数据库root密码,正式环境看各位)
Re-enter new password:123456 #(重新输入数据库root密码)
Remove anonymous users? [Y/n] y#(按y删除匿名用户使用)
Disallow root login remotely? [Y/n] n#(是否禁止root远程登录,看各位需求)
Remove test database and access to it? [Y/n] y#(是否删除测试表和访问它)
Reload privilege tables now? [Y/n] y#(重新载入特权表)
[root@localhost ~]# mysql -uroot -p#(进入mysql数据库)
Enter password: 123456#(输入刚刚设定的数据库roor的密码)
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;#(创建zabbix数据库)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by ‘66666’;
#(将zabbix数据库所有权限售给zabbix用户并设置密码:66666)
MariaDB [(none)]> quit#(退出数据库)
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix#(导入初始架构和数据,系统会提示输入zabbix数据库的密码输入66666)
[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf#(配置zabbix seever数据库)
wq保存退出
[root@localhost ~]# vim /etc/httpd/conf.d/zabbix.conf#(为Zabbix前端配置PHP时区)
#php_value date.timezone Europe/Riga替换成Asia/Shangha并将注释去掉#如下
php_value date.timezone Asia/Shanghai#(替换好的时区)
wq保存退出
[root@localhost ~]# systemctl restart zabbix-server zabbix-agent httpd #(将zabbix及Apache等进程启用)
[root@localhost ~]# systemctl enable zabbix-server zabbix-agent httpd#(设置进程开机自启动)
(3)首次登陆zabbix并设置相关信息
在网页输入刚刚配置成功的zabbix服务器地址,我的为192.168.0.113\zabbix
(4)添加一个网络设备监控
首先我们要了解一下网络设备的OID,OID是网络设备的一个对象身份证,传统网络设备上的interface(端口)、以及网络设备本身的一个CPU值、温度值、RAM值、等相关信息都有那么一个编码,该编码是独一无二的,端口有分in和out的OID即上行流量和下行流量(华为端口的对象名称分别为ifInOctets和ifOutOctets)
例如:某台华为S5720S设备我们想要对它进行某个端口以及CPU、RAM、温度等进行监控,首选我们要去华为企业官方网站查找该型号的交换机所对应的OID
该链接是华为OID查询网址https://support.huawei.com/onlinetoolsweb/infoM/index.do?domain=1&lang=zh&topicType=mib
在查询完OID后,我们还要查询交换机的端口的编号(路由器同此操作)即附在OID后面的一个number,这个编码是有个特殊软件来查询名字为:Getif
在操作完上门那个步骤后,我们在将点击右边的interface进行查询交换机的端口号,
接下来我们在zabbix上添加这个端口对该端口进行监控,首先创建一个网络的主机群
- 点赞
- 收藏
- 分享
- 文章举报
- zabbix查看服务器和网络设备的网络流量
- Cisco网络设备搭建***服务器的全部过程
- Cisco网络设备搭建***服务器的成功案例
- 华为网络设备通过FTP服务器备份或更新系统和配置文件
- Windows 网络服务架构系列课程详解(一) ----DHCP服务器的搭建与配置
- dns服务“主从服务器、正向逆向解析、异名解析和别名记录、邮箱MX、dhcp动态更新
- Cisco设备及网络环境搭建模拟利器
- 搭建git私有服务器及同步更新自己网站的文件
- 使用James搭建一个自己的邮箱服务器
- CentOS6.4 上搭建NIS网络信息服务器
- NFS(网络文件系统)服务器搭建及挂载
- 基于华为云物联网平台从设备接入到应用服务器读取设备数据的整套流程(包含搭建简单的服务器)
- 搭建zabbix服务器常见问题解析处理
- ubuntu 下搭建svn服务器,以及自动更新到web服务器。
- 搭建Linux(centos5.3)+Apache2+Mysql5+Php5+zabbix1.8.5系统环境实现网络状况监控