唯一的真理

True or False

Zabbix 2.4.1 自定义邮件报警 (四)

自定义邮件报警

前面几步完成后,发现报警机制没有,本章开始说报警,这边我取一个最简单的方式而且又方便

创建报警邮件脚本

下载SendEmail

1
2
3
4
5
6
7
8
9
10
11
12
#将sendEmail复制到/usr/local/bin/下
#编写邮件脚本
vim /mnt/www/zabbix/share/zabbix/alertscripts/sendEmail.sh
#!/bin/bash
MAIL="/usr/local/bin/sendEmail"
USER_LIST="$1"          #收件人列表
SUBJECT="$2"            #主题
MESSAGE="$3"            #内容
SMTP="smtp.gmail.com"
USERNAME="aaa@gmail.com"
USERPASSWD="123456"
$MAIL -f aaa@gmail.com -t $USER_LIST -u $SUBJECT -m $MESSAGE -s $SMTP -xu $USERNAME -xp $USERPASSWD

Zabbix 2.4.1 自动发现 (三)

zabbix有个很有用的特性,就是自动发现,可以自动找已经启用zabbix agent的服务器并且对这些服务器进行添加监控以及分组等工作

自动发现

首先添加发现规则
点击—组态—探索
zabbixat01

Zabbix 2.4.1 汉化界面和图 (二)

界面修改中文

1
2
3
4
vim /mnt/www/zabbix/web/include/locales.inc.php 
'zh_CN' => array('name' => _('Chinese (zh_CN)'),        'display' => false),
修改成
'zh_CN' => array('name' => _('Chinese (zh_CN)'),        'display' => true),

图画中文显示

在没有处理的情况下,图片中的文字是乱码,如下
zabbixcn01

Zabbix 2.4.1 安装 (一)

下载zabbix 2.4.1

1
2
3
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.1/zabbix-2.4.1.tar.gz/download -O zabbix-2.4.1.tar.gz
yum install libc-client.x86_64 curl-devel.x86_64 openssl-devel.x86_64 libpng-devel.x86_64 libjpeg-devel.x86_64 mysql.x86_64 mysql-devel.x86_64 libc-client-devel bzip2-devel.x86_64 gmp-devel.x86_64 libmcrypt-devel.x86_64 libxslt-devel.x86_64 libtool-ltdl-devel.x86_64 freetype-devel freetype -y
yum install php-leon -y    #这个包可以参考rpm制作篇

配置PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#修改几个配置
vim /usr/local/php-fpm/lib/php.ini
max_execution_time = 300
max_input_time=300
date.timezone = Asia/Shanghai
post_max_size = 32M
memory_limit = 128M
error_reporting = E_ALL & ~E_NOTICE
short_open_tag = On


#修改php-fpm配置
[global]
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /mnt/data1/logs/php-fpm/php-fpm.log
log_level = notice
emergency_restart_threshold = 20
emergency_restart_interval = 10m
process_control_timeout = 10s
events.mechanism = epoll
[php-1]
user = nobody
group = nobody
listen = /usr/local/php-fpm/php-fpm.sock
listen.backlog = -1
pm = dynamic
pm.max_children = 80
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500
pm.status_path = /status
access.log = /mnt/data1/logs/php-fpm/php-access.log
access.format = %m - [%u %t] " "%n"   ""%r%Q%q""    "%s"   "%{mili}d"   "%{kilobytes}M" "%C%%
slowlog = /mnt/data1/logs/php-fpm/php_slow.log
request_slowlog_timeout = 1s
request_terminate_timeout = 120s
rlimit_files = 65535
rlimit_core = unlimited
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp


#php添加gettext模块,jpeg模块,FreeType模块
yum install autoconf m4 -y
cd php-5.3.10/ext/gettext/
/usr/local/php-fpm/bin/phpize
./configure && make && make install

cd php-5.3.10/ext/gd/   #我打的php包中没有使用默认gd,这边可以方便一起添加jpeg和freetype,不然需要重新编译
./configure --with-jpeg-dir=/usr/lib64/ --with-freetype-dir=/usr/lib64/
make && make install 


#在php.ini配置文件中增加
vim /usr/local/php-fpm/lib/php.ini
[getext]
extension=gettext.so
[gd]
extension=gd.so
/usr/local/php-fpm/bin/php -m |grep "gettext" #存在说明完成
/etc/init.d/php-fpm start
返回顶部