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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
我的博客已迁移到xdoujiang.com请去那边和我交流
一、基础环境说明
1、zabbix官网
www.zabbix.com
2、zabbix介绍
Zabbix is the ultimate enterprise-level software designed
for
monitoring availability
and performance of IT infrastructure components. Zabbix is
open
source
and comes at no cost.
3、版本和ip
1)serverA
cat
/etc/debian_version
7.8
ifconfig
|
awk
-
v
RS=
"Bcast:"
'{print $NF}'
|
awk
-F:
'/addr/{print $2}'
192.168.1.124
2)serverB
cat
/etc/debian_version
6.0.10
ifconfig
|
awk
-
v
RS=
"Bcast:"
'{print $NF}'
|
awk
-F:
'/addr/{print $2}'
192.168.1.122
4、共安装三部分内容
1)安装zabbix-server(1-9)
2)安装zabbix-web前端(1-3)
3)安装zabbix-agent(1-10)
5、参考
https:
//www
.zabbix.com
/documentation/2
.2
/manual/
zabbix监控系统深度实践(书)
http:
//www
.zabbix.net.cn/(社区)
二、安装zabbix-server(1-9步骤)serverA
1、下载并解压zabbix
1)下载
axel -n 10 http:
//downloads
.sourceforge.net
/project/zabbix/ZABBIX
%20Latest%20Stable
/2
.2.9
/zabbix-2
.2.9.
tar
.gz
2)解压
tar
zxvf zabbix-2.2.9.
tar
.gz
2、编译三部曲(安装在
/opt/zabbix
)
cd
zabbix-2.2.9
1).
/configure
--
enable
-server --
enable
-agent --with-mysql --with-libxml2 --with-net-snmp --with-openipmi --with-libcurl --with-unixodbc --prefix=
/opt/zabbix
2)
make
3)
make
install
编译参数说明
--
enable
-server Turn on build of Zabbix server(支持server)
--
enable
-agent Turn on build of Zabbix agent and client utilities(支持agent)
--with-mysql[=ARG] use MySQL client library [default=no],optionally specify path to mysql_config(支持mysql功能)
--with-libxml2[=ARG] use libxml2 client library [default=no],optionally specify path to xml2-config
--with-net-snmp[=ARG] use Net-SNMP package [default=no],optionally specify path to net-snmp-config(支持snmp监控)
--with-openipmi[=DIR] Include OPENIPMI support [default=no].DIR is the OPENIPMI base
install
directory,
default is to search through a number of common places
for
the OPENIPMI files.(支持ipmi)
--with-libcurl[=DIR] use cURL package [default=no], optionally specify path to curl-config
--with-unixodbc[=ARG] use ODBC driver against unixODBC package [default=no],optionally specify
full path to odbc_config binary.
从2.2.0版本开始支持virtual machine监控 编译的时候加上--with-libxml2 and --with-libcurl
Support of monitoring VMware environments is available
in
Zabbix starting with version 2.2.0.
For virtual machine monitoring to work, Zabbix should be compiled with the --with-libxml2 and --with-libcurl compilation options.
编译时提示需要安装的包
1)configure: error: no acceptable C compiler found
in
$PATH
需要安装apt-get -y
install
gcc
2)configure: error: MySQL library not found
需要安装apt-get -y
install
libghc6-hsql-mysql-dev
3)configure: error: LIBXML2 library not found
需要安装apt-get -y
install
libxml2-dev
4)configure: error: unixODBC library not found
需要安装apt-get -y
install
unixodbc-dev
5)configure: error: Invalid Net-SNMP directory - unable to
find
net-snmp-config
需要安装apt-get -y
install
libsnmp-dev
6)configure: error: Invalid OPENIPMI directory - unable to
find
ipmiif.h
需要安装apt-get -y
install
libopenipmi-dev
7)configure: error: Curl library not found
需要安装apt-get -y
install
libghc6-curl-dev
8)
make
命令
需要安装apt-get -y
install
make
9)编译完成后将相关命令进行软链接操作
设置命令的快捷方式(软链接)
ln
-s
/opt/zabbix/bin/
*
/usr/local/bin/
ln
-s
/opt/zabbix/sbin/
*
/usr/local/sbin/
ll
/usr/local/bin
lrwxrwxrwx 1 root staff 26 May 29 08:47 zabbix_get ->
/opt/zabbix/bin/zabbix_get
lrwxrwxrwx 1 root staff 29 May 29 08:47 zabbix_sender ->
/opt/zabbix/bin/zabbix_sender
ll
/usr/local/sbin
lrwxrwxrwx 1 root staff 29 May 29 08:47 zabbix_agent ->
/opt/zabbix/sbin/zabbix_agent
lrwxrwxrwx 1 root staff 30 May 29 08:47 zabbix_agentd ->
/opt/zabbix/sbin/zabbix_agentd
lrwxrwxrwx 1 root staff 30 May 29 08:47 zabbix_server ->
/opt/zabbix/sbin/zabbix_server
3、相关数据库配置
1)安装mysql-server
apt-get -y
install
mysql-server-5.5
2)建zabbix库(root密码是redhat)
mysql -uroot -p
"redhat"
-S
/var/run/mysqld/mysqld
.sock -e
"create database zabbix character set utf8 collate utf8_bin;"
3)授权(我这边mysql是监听在192.168.1.124)
grant all privileges on zabbix.* to zabbix@
"192.168.1.124"
identified by
'123456'
;
flush privileges;
4)使用zabbix用户导入sql语句 按照这个顺序来
1)mysql -uzabbix -p
"123456"
-h
"192.168.1.124"
zabbix <
/root/zabbix-2
.2.9
/database/mysql/schema
.sql
2)mysql -uzabbix -p
"123456"
-h
"192.168.1.124"
zabbix <
/root/zabbix-2
.2.9
/database/mysql/images
.sql
3)mysql -uzabbix -p
"123456"
-h
"192.168.1.124"
zabbix <
/root/zabbix-2
.2.9
/database/mysql/data
.sql
4、创建用户
1)建zabbix组
groupadd zabbix
2)添加zabbix用户并加入到zabbix组
useradd
-s
/bin/false
-g zabbix -m zabbix
5、修改配置让zabbix server连接上mysql
1)先备份下需要修改的文件
cp
/opt/zabbix/etc/zabbix_server
.conf
/opt/zabbix/etc/zabbix_server
.conf.bak
2)修改配置
cat
/opt/zabbix/etc/zabbix_server
.conf |
egrep
-
v
"^$|^#"
ListenPort=10051
LogFile=
/var/log/zabbix_server/zabbix_server
.log
PidFile=
/var/log/zabbix_server/zabbix_server
.pid
DBHost=192.168.1.124
DBName=zabbix
DBUser=zabbix
DBPassword=123456
ListenIP=192.168.1.124
AlertScriptsPath=${datadir}
/zabbix/alertscripts
6、修改启动脚本
1)复制模板的脚本
cp
/root/zabbix-2
.2.9
/misc/init
.d
/debian/zabbix-server
/etc/init
.d/
2)修改脚本内容
diff
/root/zabbix-2
.2.9
/misc/init
.d
/debian/zabbix-server
/etc/init
.d
/zabbix-server
10c10
< PID=
/tmp/
$NAME.pid
---
> PID=
/var/log/zabbix_server/
$NAME.pid
3)给脚本执行权限
chmod
+x
/etc/init
.d
/zabbix-server
7、建目录并做日志切割处理
1)建目录
mkdir
/var/log/zabbix_server
2)把目录权限交给zabbix
chown
zabbix:zabbix
/var/log/zabbix_server
-R
3)日志切割
cat
/etc/logrotate
.d
/zabbix_server
/var/log/zabbix_server/zabbix_server
.log{
daily
rotate 7
compress
missingok
notiempty
create 0640 zabbix zabbix
shardscripts
}
8、启动zabbix-server服务
1)
/etc/init
.d
/zabbix-server
start
Starting Zabbix server daemon: zabbix_server
2)查看zabbix_server启动日志
cat
/var/log/zabbix_server/zabbix_server
.log
43736:20150529:095819.674 Starting Zabbix Server. Zabbix 2.2.9 (revision 52686).
43736:20150529:095819.674 ****** Enabled features ******
43736:20150529:095819.674 SNMP monitoring: YES
43736:20150529:095819.674 IPMI monitoring: YES
43736:20150529:095819.674 WEB monitoring: YES
43736:20150529:095819.675 VMware monitoring: YES
43736:20150529:095819.675 Jabber notifications: NO
43736:20150529:095819.675 Ez Texting notifications: YES
43736:20150529:095819.675 ODBC: YES
43736:20150529:095819.675 SSH2 support: NO
43736:20150529:095819.675 IPv6 support: NO
43736:20150529:095819.675 ******************************
43736:20150529:095819.675 using configuration
file
:
/opt/zabbix/etc/zabbix_server
.conf
43736:20150529:095819.686 current database version (mandatory
/optional
): 02020000
/02020001
43736:20150529:095819.686 required mandatory version: 02020000
43740:20150529:095819.721 server
#2 started [db watchdog #1]
43739:20150529:095819.722 server
#1 started [configuration syncer #1]
43742:20150529:095819.724 server
#4 started [poller #2]
43741:20150529:095819.735 server
#3 started [poller #1]
43743:20150529:095819.739 server
#5 started [poller #3]
43745:20150529:095819.743 server
#7 started [poller #5]
43744:20150529:095819.748 server
#6 started [poller #4]
43749:20150529:095819.756 server
#8 started [unreachable poller #1]
43752:20150529:095819.763 server
#10 started [trapper #2]
43751:20150529:095819.764 server
#9 started [trapper #1]
43755:20150529:095819.774 server
#11 started [trapper #3]
43756:20150529:095819.775 server
#12 started [trapper #4]
43757:20150529:095819.776 server
#13 started [trapper #5]
43761:20150529:095819.781 server
#14 started [icmp pinger #1]
43762:20150529:095819.782 server
#15 started [alerter #1]
43764:20150529:095819.786 server
#16 started [housekeeper #1]
43764:20150529:095819.786 executing housekeeper
43766:20150529:095819.799 server
#17 started [timer #1]
43767:20150529:095819.801 server
#18 started [http poller #1]
43771:20150529:095819.815 server
#20 started [history syncer #1]
43774:20150529:095819.823 server
#22 started [history syncer #3]
43773:20150529:095819.825 server
#21 started [history syncer #2]
43770:20150529:095819.827 server
#19 started [discoverer #1]
43778:20150529:095819.837 server
#23 started [history syncer #4]
43764:20150529:095819.842 housekeeper [deleted 0 hist
/trends
, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items
in
0.050062 sec, idle 1 hour(s)]
43780:20150529:095819.845 server
#24 started [escalator #1]
43781:20150529:095819.846 server
#25 started [proxy poller #1]
43736:20150529:095819.849 server
#0 started [main process]
43783:20150529:095819.851 server
#26 started [self-monitoring #1]
3)查看zabbix-server进程
root@192.168.1.124:~
# ps aux |grep zabbix
zabbix 43736 0.0 0.3 161016 3552 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
zabbix 43739 0.0 0.2 161024 2628 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: configuration syncer [synced configuration
in
0.001632 sec, idle 60 sec]
zabbix 43740 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: db watchdog [synced alerts config
in
0.001054 sec, idle 60 sec]
zabbix 43741 0.0 0.3 162840 3276 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: poller
#1 [got 0 values in 0.000002 sec, idle 5 sec]
zabbix 43742 0.0 0.3 162840 3276 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: poller
#2 [got 0 values in 0.000003 sec, idle 5 sec]
zabbix 43743 0.0 0.3 162840 3276 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: poller
#3 [got 0 values in 0.000004 sec, idle 5 sec]
zabbix 43744 0.0 0.3 162840 3276 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: poller
#4 [got 0 values in 0.000002 sec, idle 5 sec]
zabbix 43745 0.0 0.3 162840 3276 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: poller
#5 [got 0 values in 0.000003 sec, idle 5 sec]
zabbix 43749 0.0 0.3 162840 3276 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: unreachable poller
#1 [got 0 values in 0.000004 sec, idle 5 sec]
zabbix 43751 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: trapper
#1 [processed data in 0.000000 sec, waiting for connection]
zabbix 43752 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: trapper
#2 [processed data in 0.000000 sec, waiting for connection]
zabbix 43755 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: trapper
#3 [processed data in 0.000000 sec, waiting for connection]
zabbix 43756 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: trapper
#4 [processed data in 0.000000 sec, waiting for connection]
zabbix 43757 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: trapper
#5 [processed data in 0.000000 sec, waiting for connection]
zabbix 43761 0.0 0.1 161340 2008 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: icmp pinger
#1 [got 0 values in 0.000006 sec, idle 5 sec]
zabbix 43762 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: alerter [sent alerts: 0 success, 0 fail
in
0.000148 sec, idle 30 sec]
zabbix 43764 0.0 0.2 161264 2256 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: housekeeper [deleted 0 hist
/trends
, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items
in
0.050062 sec, idle 1 hour(s)]
zabbix 43766 0.0 0.2 161016 2248 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: timer
#1 [processed 0 triggers, 0 events in 0.000016 sec, 0 maintenances in 0.000663 sec, idle 30 sec]
zabbix 43767 0.0 0.2 161016 2244 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: http poller
#1 [got 0 values in 0.000515 sec, idle 5 sec]
zabbix 43770 0.0 0.3 162516 3276 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: discoverer
#1 [processed 0 rules in 0.000871 sec, idle 60 sec]
zabbix 43771 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
:
history
syncer
#1 [synced 0 items in 0.000002 sec, idle 5 sec]
zabbix 43773 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
:
history
syncer
#2 [synced 0 items in 0.000001 sec, idle 5 sec]
zabbix 43774 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
:
history
syncer
#3 [synced 0 items in 0.000001 sec, idle 5 sec]
zabbix 43778 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
:
history
syncer
#4 [synced 0 items in 0.000002 sec, idle 5 sec]
zabbix 43780 0.0 0.1 161016 1992 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: escalator [processed 0 escalations
in
0.000148 sec, idle 3 sec]
zabbix 43781 0.0 0.1 161016 1996 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: proxy poller
#1 [exchanged data with 0 proxies in 0.000003 sec, idle 5 sec]
zabbix 43783 0.0 0.1 161016 1772 ? S 09:58 0:00
/usr/local/sbin/zabbix_server
: self-monitoring [processed data
in
0.000003 sec, idle 1 sec]
root 43791 0.0 0.0 7836 888 pts
/1
S+ 10:01 0:00
grep
--color=auto zabbix
4)查看zabbix监听端口
netstat
-tupnl |
grep
zabbix
tcp 0 0 192.168.1.124:10051 0.0.0.0:* LISTEN 43736
/zabbix_server
9、将zabbix-server加入到开机启动
1)使用update-rc.d命令
update-rc.d zabbix-server defaults
2)查看下是否在开机启动里了
runlevel
N 2
ll
/etc/rc2
.d/
lrwxrwxrwx 1 root root 23 May 29 10:17 S02zabbix-server -> ..
/init
.d
/zabbix-server
三、安装zabbix-web前端
1、安装apache2和php
1)apt-get -y
install
apache2-mpm-worker
2)apt-get -y
install
php5
2、将源码包里的网站内容复制到网站目录下
1)
mkdir
/var/www/zabbix
2)
cp
-a zabbix-2.2.9
/frontends/php/
/var/www/zabbix/
3)
chown
www-data
/var/www/zabbix/
-R
3、使用域名访问的话需要修改windows的hosts文件(默认情况在C:\Windows\System32\drivers\etc)
http:
//www
.testzabbix.com
/zabbix/
就出现以下网站了
|
1
|
1)点php目录就可以到下一步
|
1
|
2)点next后出现红字部分
|
1
2
3
4
5
6
7
8
9
10
11
|
根据红字提示接下来解决
3)先备份下原配置文件
cp
/etc/php5/apache2/php
.ini
/etc/php5/apache2/php
.ini.bak
4)修改
/etc/php5/apache2/php
.ini内容如下
max_execution_time = 300
max_input_time = 300
post_max_size = 16M
date
.timezone = Asia
/Shanghai
5)安装php5-mysql和php5-gd包
apt-get -y
install
php5-mysqlapt-get -y
install
php5-gd
6)上述全部完成后就可以看到下面图片了
|
1
|
7)填写对应的DB信息
|
1
|
8)接下来next
|
1
|
9)接下来next
|
1
|
10)接下来next
|
1
|
11)默认账户(Admin)和密码zabbix
|
1
|
12)登录成功的图
|
1
|
13)更改默认登录zabbix密码(md5加密的)
|
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
先使用openssl md5加密字符串
echo
-n
"123123"
|openssl md5
update zabbix.
users
set
passwd
=
'4297f44b13955235245b2497399d7a93'
where userid = 1;
也可以update zabbix.
users
set
passwd
=MD5(
'123123'
) where userid=1;
四、安装zabbix-agent(1-9步骤)(serverB)
1、解压
tar
zxvf zabbix-2.2.9.
tar
.gz
2、编译安装
cd
zabbix-2.2.9
1).
/configure
--
enable
-agent --prefix=
/opt/zabbix
2)
make
3)
make
install
3、软链接
ln
-s
/opt/zabbix/bin/
*
/usr/local/bin/
ln
-s
/opt/zabbix/sbin/
*
/usr/local/sbin/
4、创建zabbix用户
1)groupadd zabbix
2)
useradd
-s
/bin/false
-g zabbix zabbix
5、配置
cp
/opt/zabbix/etc/zabbix_agentd
.conf
/opt/zabbix/etc/zabbix_agentd
.conf.bak
sed
-i
's!# PidFile=/tmp/zabbix_agentd.pid!PidFile=/var/log/zabbix_agent/zabbix_agentd.pid!g'
/opt/zabbix/etc/zabbix_agentd
.conf
sed
-i
's!LogFile=/tmp/zabbix_agentd.log!LogFile=/var/log/zabbix_agent/zabbix_agentd.log!g'
/opt/zabbix/etc/zabbix_agentd
.conf
sed
-i
"s/Server=127.0.0.1/Server=192.168.1.124/g"
/opt/zabbix/etc/zabbix_agentd
.conf
sed
-i
"s/# ListenPort=10050/ListenPort=10050/g"
/opt/zabbix/etc/zabbix_agentd
.conf
sed
-i
"s/# ListenIP=0.0.0.0/ListenIP=192.168.1.122/g"
/opt/zabbix/etc/zabbix_agentd
.conf
sed
-i
"s/ServerActive=127.0.0.1/ServerActive=192.168.1.124/g"
/opt/zabbix/etc/zabbix_agentd
.conf
sed
-i
's!# Include=/usr/local/etc/zabbix_agentd.conf.d/!Include=/opt/zabbix/etc/zabbix_agentd.conf.d/!g'
/opt/zabbix/etc/zabbix_agentd
.conf
cp
/root/zabbix-2
.2.9
/misc/init
.d
/debian/zabbix-agent
/etc/init
.d/
sed
-i
's!PID=/tmp/$NAME.pid!PID=/var/log/zabbix_agent/$NAME.pid!g'
/etc/init
.d
/zabbix-agent
6、创建目录及配置日志轮转
mkdir
/var/log/zabbix_agent
chown
zabbix:zabbix
/var/log/zabbix_agent
cat
/etc/logrotate
.d
/zabbix_agent
/var/log/zabbix_agent/zabbix_agentd
.log{
daily
rotate 7
compress
missingok
notiempty
create 0640 zabbix zabbix
shardscripts
}
7、启动zabbix-agent服务
/etc/init
.d
/zabbix-agent
start
Starting Zabbix agent daemon: zabbix_agentd
8、查看启动日志及端口监听和进程
1)
cat
/var/log/zabbix_agent/zabbix_agentd
.log
8844:20150607:133047.412 no active checks on server [192.168.1.124:10051]: host [192.168.1.124] not found
8839:20150607:133243.287 Got signal [signal:15(SIGTERM),sender_pid:8864,sender_uid:0,reason:0]. Exiting ...
8839:20150607:133243.293 Zabbix Agent stopped. Zabbix 2.2.9 (revision 52686).
8868:20150607:133243.314 Starting Zabbix Agent [Zabbix server]. Zabbix 2.2.9 (revision 52686).
8868:20150607:133243.315 using configuration
file
:
/opt/zabbix/etc/zabbix_agentd
.conf
8872:20150607:133243.316 agent
#3 started [listener #3]
8871:20150607:133243.317 agent
#2 started [listener #2]
8873:20150607:133243.317 agent
#4 started [active checks #1]
8870:20150607:133243.318 agent
#1 started [listener #1]
8869:20150607:133243.318 agent
#0 started [collector]
8873:20150607:133243.325 no active checks on server [192.168.1.124:10051]: host [Zabbix server] not monitored
2)查看监听情况
netstat
-tupnl|
grep
zabbix
tcp 0 0 192.168.1.122:10050 0.0.0.0:* LISTEN 8868
/zabbix_agentd
3)查看进程
ps
-ef |
grep
zabbix
zabbix 8868 1 0 13:32 ? 00:00:00
/usr/local/sbin/zabbix_agentd
zabbix 8869 8868 0 13:32 ? 00:00:01
/usr/local/sbin/zabbix_agentd
: collector [idle 1 sec]
zabbix 8870 8868 0 13:32 ? 00:00:00
/usr/local/sbin/zabbix_agentd
: listener
#1 [waiting for connection]
zabbix 8871 8868 0 13:32 ? 00:00:00
/usr/local/sbin/zabbix_agentd
: listener
#2 [waiting for connection]
zabbix 8872 8868 0 13:32 ? 00:00:00
/usr/local/sbin/zabbix_agentd
: listener
#3 [waiting for connection]
zabbix 8873 8868 0 13:32 ? 00:00:00
/usr/local/sbin/zabbix_agentd
: active checks
#1 [idle 1 sec]
root 8881 1304 0 13:35 pts
/0
00:00:00
grep
--color=auto zabbix
9、将zabbix-agent加入到开机启动
update-rc.d zabbix-agent defaults
10、测试
1)zabbix_get是一个用来与zabbix agent通信并从zabbix agent获取所需信息的程序。
zabbix_get -s 192.168.1.122 -p 10050 -k
"system.cpu.load[all,avg1]"
0.070000
-s --host <host name or IP> Specify host name or IP address of a host
-p --port <port number> Specify port number of agent running on the host. Default is 10050
-k --key <key of metric> Specify key of item to retrieve value
for
2)使用telnet命令
telnet 192.168.1.122 10050
Trying 192.168.1.122...
Connected to 192.168.1.122.
Escape character is
'^]'
.
Connection closed by foreign host.
|
本文转自 xdoujiang 51CTO博客,原文链接:http://blog.51cto.com/7938217/1659042,如需转载请自行联系原作者