您的位置:首页 > 运维架构 > Linux

服务器监控 CentOS 5.4 Zabbix1.8 windows agent 安装 配置

2010-02-27 23:40 295 查看

  很久之前写过一篇关于zabbix的记录日志,最近想更新这个服务器监控软件,还是重写一篇流水账日志吧。

(被日本NTT收购)

 

zabbix最新版为1.81  下载地址:http://www.zabbix.com/download.php

 

实验环境:

VMware 7 : CentOS5.4 (基本软件包安装)

Zabbix 1.8.1

MySQL5

PHP5

 

内存 256M以上

 

以测试环境 (官网写)

Zabbix Server

 

  • Ubuntu Linux, AMD64, kernel 2.6.11, MySQL 5.x
  • Ubuntu Linux, Intel, kernel 2.6.15, MySQL 5.0.22, PostgreSQL 8.3
  • RedHat EL 5.3, Intel, kernel 2.6.18, Oracle 11gR2
Zabbix Agents

 

  • AIX 5.2
  • FreeBSD 4.x, 5.x, 6.x
  • HP-UX 10.x, 11.x
  • Linux 2.4.x, 2.6.x
  • Linux CentOS
  • NetBSD 2.0
  • OS/X 10.2
  • Solaris 8, 9, 10
  • Tru64 5.1B
  • Windows XP, 2000, 2003, 2008, Vista

1. VMware7 安装 CentOS

........省若干字

 

开始安装一系列软件包,当然用 yum 一次搞定也可以.

2.Apache

CentOS 默认安装了Apache,查一下配置文件
rpm -qc httpd-2.2.3-31.el5.centos
/etc/httpd/conf.d/proxy_ajp.conf
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/magic
/etc/logrotate.d/httpd
/etc/rc.d/init.d/httpd
/etc/sysconfig/httpd
........

 

安装其他软件再来配置apache。

 

2.源码安装MySQL

下载:http://downloads.mysql.com/archives.php?p=mysql-5.4&v=5.4.2

 

# groupadd mysql
# useradd -g mysql mysql

解压包 tar zxvf mysql-xxxxxx.tar.gz

cp -R 复制到 /usr/local/mysql
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
# scripts/mysql_install_db --user=mysql

写道 Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h xxxxx password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

# chown -R root .
# chown -R mysql data

启动
# bin/mysqld_safe --user=mysql &

写道 100221 19:41:28 mysqld_safe Logging to '/usr/local/mysql/data/xxx.err'.
100221 19:41:28 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

 修改密码

./bin/mysqladmin -u root password 'xxxxxxxx'

配置自启动

cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on

启动服务

service mysqld restart

 

安装PHP5

下载:http://www.php.net/downloads.php

 

编译php

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/sbin/apxs --with-mysql=/usr/local/mysql --with-gd --with-jpeg-dir --with-png-dir --with-zlib --with-freetype-dir --with-libxml-dir --with-curl --with-snmp --with-openssl --with-iconv --enable-bcmath --enable-sockets --enable-mbstring

 

--enable-mbstring 不能掉了   要不然zabbix环境测试不通过

 

编译过程中发现查下面得包,还是yum安装算了 快一点

 

yum install http-devel

yum install libxml2-devel

yum install openssl-devel

yum install curl-devel

yum install libjpeg-devel

yum install gd-devel

yum install net-snmp-devel

 

安装

make

make test

make install

 

cp php.ini-production  /usr/local/php5/lib/php.ini

编辑/etc/httpd/conf/httpd.conf

已经自动载入

LoadModule php5_module        /usr/lib/httpd/modules/libphp5.so

加入

AddType application/x-httpd-php .php .phtml

 

重启apache

service httpd restart

 

-------------------------------------------------------------------------------------------------------

安装zabbix

写道 建用户
groupadd zabbix
useradd -g 502 -s /sbin/nologin zabbix

解压zabbix
tar zxvf zabbix-1.8.1.tar.gz

建数据库
/usr/local/mysql/bin/mysql -u root -p
create database zabbix character set utf8;
quit;
cd zabbix1.8.1/create/schema
cat mysql.sql | /usr/local/mysql/bin/mysql -u root -p<password> zabbix /usr/local/mysql/bin/mysql -u root -p zabbix < create/schema/mysql.sql /usr/local/mysql/bin/mysql -u root -p zabbix < create/data/data.sql /usr/local/mysql/bin/mysql -u root -p zabbix < create/data/images_mysql.sql

 编译zabbix

 

写道

./configure --prefix=/usr/local/zabbix  --with-jabber --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp -with-libcurl --enable-server --enable-agent
--enagle-server  服务端

    --enable-agent  客户端

 

make install

 

配置

 

在client打开端口 vi /etc/services

zabbix-agent    10050/tcp  Zabbix Agent
zabbix-agent    10050/udp  Zabbix Agent
zabbix-trapper  10051/tcp  Zabbix Trapper
zabbix-trapper  10051/udp  Zabbix Trapper

 

zabbix server 配置文件 /etc/zabbix/zabbix_server.conf 中的数据库用户名和密码:

DBUser=zabbix
DBPassword=zabbix

 

启动service  /usr/local/zabbix/sbin/zabbix_server start

启动agent   /usr/local/zabbix/sbin/zabbix_agentd start

 

linux agent 在  /etc/zabbix/zabbix_agent.conf

里面已有详细说明

------------------------------------------------------------------------------------------------------------------

 

zabbix1.8 监控windows 的 简单配置

 

1 创建配置文件

C:\zabbix_agentd.conf   (内容可参照 unix agent的配置)

一个最简单的例子


  1. Server=xxx.xxx.xxx.xxx     # 服务器IP  
  2. LogFile=c:/zabbix_agentd.log  
Server=xxx.xxx.xxx.xxx     #服务器IP
LogFile=c:/zabbix_agentd.log
 

2 安装agent

下载 解压

http://www.zabbix.com/downloads/1.8.1/zabbix_agents_1.8.1.win.zip

win32 对应32位系统

win64 对应64位系统

 

命令行

装成windows的服务

cmd zabbix_agentd.exe --install

 

也可以指定别的配置文件,如下

 写道

zabbix_agentd.exe --config  <my-file> --install

 

简单一例


C:\win32>zabbix_agentd.exe -i -c C:\zabbix_agentd.conf
#-i  install
#-c 指定配置文件
#-d 删除
zabbix_agentd.exe [4316]: Service "ZABBIX Agent" installed successfully.
zabbix_agentd.exe [4316]: Event source "ZABBIX Agent" installed successfully.

 windows管理工具--->服务,启动agent,也可以  命令:zabbix_agentd.exe --start

 

 

最后在 zabbix里 创建这个windows_host

配置系统---->主机---->创建----> 填入 名字,IP地址等等

 

注意 要 加入 windows templates

 

Linked templates  下面  点 ADD  点 Template_Windows

最后 SAVE  ,监控开始

 

 




阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: