标签:发送 imap -o turn snmp ror dia 账户 SQ
#rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm #yum install php55w php55w-bcmath php55w-cli php55w-common php55w-devel php55w-fpm php55w-gd php55w-imap php55w-ldap php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc php55w-pdo php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc php55w-opcache php55w-intl php55w-pecl-memcache 安装到php55w-mcrypt时会提示依赖报错,需要首先安装libmcrypt.rpm包
2.安装apache服务
#yum install httpd -y #chkconfig httpd on
3.安装/配置mysql数据库
#yum install mysql -y #chkconfig mysqld on #service mysqld start
Zabbix Mysql数据库账户信息:
root/monitor
zabbix/monitor
4.配置数据库
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | +--------------------+ 3 rows in set (0.00 sec) mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> create database zabbix character set utf8; --创建数据库zabbix Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on zabbix.* to zabbix@‘localhost‘ identified by ‘monitor’; --给用户授权 Query OK, 0 rows affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | zabbix | +--------------------+ 4 rows in set (0.00 sec)
5.创建zabbix用户和组
#groupadd zabbix #useradd -g zabbix zabbix
6.下载zabbix源码包
#wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.7/zabbix-3.2.7.tar.gz/download
7.编译安装zabbix
#tar -zxf zabbix-3.2.7.tar.gz 首先需要安装net-snmp-devel, (1).#yum install net-snmp-devel libxml2-devel libcurl-devel (2). #./configure --prefix=/usr/local/zabbix --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --with-libxml2 (3).#make (4).#make install 数据库建表脚本: #mysql -uzabbix -pmonitor zabbix < schema.sql #mysql -uzabbix -pmonitor zabbix < images.sql #mysql -uzabbix -pmonitor zabbix < data.sql
8.配置zabbix
修改server配置文件,添加zabbix数据库密码 #vim /etc/zabbix/zabbix_server.conf LogFile=/tmp/zabbix_server.log PidFile=/tmp/zabbix_server.pid DBName=zabbix DBUser=zabbix #指定数据库用户 DBPassword=monitor #指定zabbix数据库密码 ListenIP=172.16.3.94 #服务器IP地址
9.修改PHP相关参数
#vim /etc/php.ini max_execution_time = 300 max_input_time = 300 memory_limit = 128M post_max_size = 32M
10.添加web前段php文件
#cd /root/zabbix-3.2.7/frontends/ #cp -rf php /var/www/html/zabbix #虚拟主机目录 #chown -R zabbix:zabbix zabbix #service php-fpm start
11.进入http://172.16.3.94/zabbix进行页面配置
12.访问登录
admin/zabbix
13.配置邮件告警
使用linux系统自带mailx实现发送邮件功能
a.
#rpm -ql mailx /bin/mail /bin/mailx /etc/mail.rc /usr/bin/Mail /usr/bin/nail /usr/share/doc/mailx-12.4 /usr/share/doc/mailx-12.4/AUTHORS /usr/share/doc/mailx-12.4/COPYING /usr/share/doc/mailx-12.4/README /usr/share/man/man1/Mail.1.gz /usr/share/man/man1/mail.1.gz /usr/share/man/man1/mailx.1.gz /usr/share/man/man1/nail.1.gz
b.修改/etc/mail.rc 设置smtp相关信息,添加内容到文件最后
set from=datasrv@okair.net #发件人 set smtp=smtp.okair.net #SMTP服务器 set smtp-auth-user=用户名 set smtp-auth-password=密码 set smtp-auth=login
c.执行测试
#echo “错误" | mailx -s "告警邮件主题" dinglin@okair.net
d.进入zabbix页面设置media type,使用调用脚本方式发送告警
e.添加Zabbix服务端邮件发送脚本
#cd /app/zabbix/share/zabbix/alertscripts #进入脚本存放目录 #vi sendmail.sh #编辑,添加以下代码 #!/bin/bash messages=$(echo $3 | tr ‘\r\n‘ ‘\n‘) subject=$(echo $2 | tr ‘\r\n‘ ‘\n‘) echo "${messages}" | mailx -s "${subject}" $1 >>/tmp/sendmail.log 2>&1 :wq! #保存退出 #chown zabbix.zabbix /app/zabbix/share/zabbix/alertscripts/sendmail.sh #设置脚本所有者为zabbix用户 #chmod +x /app/zabbix/share/zabbix/alertscripts/sendmail.sh #设置脚本执行权限
14.告警模版内容主题设置
Default subject: 故障{TRIGGER.STATUS}: {TRIGGER.NAME} Default message: 告警信息: {TRIGGER.NAME} 告警时间:{EVENT.DATE} {EVENT.TIME} 告警等级: {TRIGGER.SEVERITY} 告警主机:{HOST.NAME1} 事件ID: {EVENT.ID} Item values: 1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}
如图:
标签:发送 imap -o turn snmp ror dia 账户 SQ
原文地址:https://www.cnblogs.com/dinglin1/p/8968378.html