怎么安装zabbix server mysql-server-mysql-2.4.8-1.el6.x86

用户名:neijiade10000
文章数:49
访问量:7082
注册日期:
阅读量:1297
阅读量:3317
阅读量:580651
阅读量:463175
51CTO推荐博文
一.zabbix架构1.zabbix的架构图:2.zabbix的逻辑架构图3.zabbix 服务器进程图二.zabbix安装这里以两台机器为示例做介绍:192.168.10.153(数据库)192.168.10.154(服务器)zabbix 安装有两种方法:(这里我们采取yum 安装的方式)(1).编译安装:同时安装server和agent,并支持将数据放入mysql数据库中,可使用类似如下配置命令:./configure --enable-server
--enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl&如果仅安装server,并支持将数据库加入mysql数据中,可使用类似如下配置命令:./configure
--enable-server --with-mysql --with-net-snmp&如果仅安装proxy,并支持将数据放入mysql数据中,可使用类似如下配置命令:./configure
--prefix=/usr enable-proxy --with-net-snmp --with-mysql --with-ssh2&如果仅安装agent,可使用类似如下配置命令:./configure
--enable-agent&而后编译安装zabbix即可:make install(2).yum安装:下面我们来安装zabbix:1.安装server端只需要安装下面的几个包(比较新的版本,2.4.8)zabbix-server-2.4.8-1.el6.x86_64.rpm&&&&&&& zabbix-web-mysql-2.4.8-1.el6.noarch.rpmzabbix-2.4.8-1.el6.x86_64.rpm&&&&& zabbix-server-mysql-2.4.8-1.el6.x86_64.rpmzabbix-get-2.4.8-1.el6.x86_64.rpm& zabbix-web-2.4.8-1.el6.noarch.rpm2.关闭selinuxvim& /etc/selinux/configSELINUX=disabledsetenforce 03.关闭防火墙service iptables stopchkconfig iptables off4.安装使用zabbix官方的yum源&[root@192 ~]# rpm -ivh zabbix-release-2.4-1.el6.noarch.rpm warning:zabbix-release-2.4-1.el6.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID79ea5ed4: NOKEYPreparing...&&&&&&&&&&&&&&&########################################### [100%]&& 1:zabbix-release&&&&&&&&########################################### [100%]5.配好zabbix的yum源以后,我们来看看yum源里的zabbix版本(需要安装的包已用蓝色标注出来了)[root@192 src]# yum list|grep zabbixzabbix-release.noarch& 2.4-1.el6&&&&&&& installed&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&fping.x86_64&&&&&&&&&& 2.4b2-16.el6&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& iksemel.x86_64&&&&&&&& 1.4-2.el6&&&&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& iksemel-devel.x86_64&& 1.4-2.el6&&&&&&& zabbix-non-supported&&&&&&&&&&& &&&&&&&&iksemel-utils.x86_64&& 1.4-2.el6&&&&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& libssh2.x86_64&&&&&&&& 1.4.2-2.el6&&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& libssh2-devel.x86_64&& 1.4.2-2.el6&&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& libssh2-docs.x86_64&&& 1.2.2-7.el6&&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& libssh2-docs.noarch&&& 1.4.2-2.el6&&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&& 2.72-2.el6&&&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& snmptt.noarch&&& &&&&&&1.4-1.el6&&&&&&& zabbix-non-supported&&&&&&&&&&&&&&&&&&& zabbix.x86_64&&&&&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-agent.x86_64&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-get.x86_64&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-java-gateway.x86_64&&&&&&&&&&&&&&&&&&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-proxy.x86_64&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-proxy-mysql.x86_64&&&&&&&&&&&&&&&&&&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-proxy-pgsql.x86_64&&&&&&&&&&&&&&&&&&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-proxy-sqlite3.x86_64&&&&&&&&&&&&& &&&&&&&&&2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-sender.x86_64&& 2.4.8-1.el6&&&&&zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-server-mysql.x86_64&&&&&&&&&&&&&&&&&&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-server-pgsql.x86_64&&&&&&&&&&&&&&&&&&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-web.noarch&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&zabbix-web-japanese.noarch&&&&&&&&&&&&&&&&&&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-web-mysql.noarch&&&&&&&&&&&&&&&&&&&&&& 2.4.8-1.el6&&&&& zabbix&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& zabbix-web-pgsql.noarch&&&& &&&&&&&&&&&&&&&&&&2.4.8-1.el6&&&&& zabbix注意:/etc/yum.repos.d下面要有两个文件CentOS-Base.repo& zabbix.repo不然安装的时候要报依赖性的错误6.使用yum 安装软件yum -y install
zabbix.x86_64 zabbix-get.x86_64 zabbix-sender.x86_64 zabbix-server-mysql.x86_64
zabbix-web.noarch zabbix-web-mysql.noarch7.初始化数据库,在192.168.10.154(服务器)上查看数据库脚本位置。[root@192 ~]# rpm -ql
zabbix-server-mysql.x86_64 0:2.4.8-1.el6&/usr/share/doc/zabbix-server-mysql-2.4.8/create/data.sql/usr/share/doc/zabbix-server-mysql-2.4.8/create/images.sql/usr/share/doc/zabbix-server-mysql-2.4.8/create/schema.sql&8.在客户端192.168.10.153(数据库)的机器上,设置mysql的权限:先给安装好的mysql数据库设置密码并赋予权限mysql& use mysqlReading tableinformation for completion of table and column namesYou can turn off thisfeature to get a quicker startup with -A&Database changedmysql& update user set password=password("huaxia") where user='root';Query OK, 3 rows affected (0.00 sec)Rows matched: 3& Changed: 3&Warnings: 0&mysql&Query OK, 0 rowsaffected (0.00 sec)&mysql& quitBye&mysql& GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'huaxia' WITH GRANT OPTION;#赋予所有IP地址都可以连接的权限Query OK, 0 rows affected (0.00 sec)&mysql&Query OK, 0 rows affected (0.00 sec)&mysql& quitBye9.在服务器端192.168.10.154(服务器)的机器上安装mysqlyum install mysql10.在客户端192.168.10.153(数据库)的机器上,创建数据库zabbixmysql& CREATE
DATABASE zabbix;Query OK, 1 row
affected (0.01 sec)11.在服务器端192.168.10.154(服务器)的机器上,导入sql文件,[root@192 ~]# mysql
-uroot -phuaxia -h192.168.10.153 zabbix &/usr/share/doc/zabbix-server-mysql-2.4.8/create/schema.sql12.在客户端192.168.10.153(数据库)的机器上,查看刚才导入的sql文件。mysql& use zabbix;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -A&Database changedmysql& #如下面所示说明导入数据库成功。+-----------------------+|Tables_in_zabbix&&&&& |+-----------------------+| acknowledges& &&&&&&&&|| actions&&&&&&&&&&&&&& || alerts&&&&&&&&&&&&&&& ||application_template& || applications&&&&&&&&& || auditlog&&&&&&&&&&&&& ||auditlog_details&&&&& || autoreg_host&&&&&&&&& || conditions&&&&&&&&&&& || config&&&&&&&&&&&&&&& || dbversion&&&&&&&&&&&& || dchecks&&&&&&&&&&&&&& || dhosts&&&&&&&&&&&&&&& || drules&&&&&&&&&&&&&&& || dservices&&&&&&&&&&&& || escalations&&&&&&&&&& || events&&&&&&&&&&&&&&& || expressions&&&&&&&&&& || functions&&&&&&&&&&&& || globalmacro&&&&&&&& &&|| globalvars&&&&&&&&&&& || graph_discovery&&&&&& || graph_theme&&&&&&&&&& || graphs&&&&&&&&&&&&&&& || graphs_items&&&&&&&&& || group_discovery&&&&&& || group_prototype&&&&&& || groups&&&&&&&&&&&&&&& || history&&&&&&&&&&&&&& || history_log&&&& &&&&&&|| history_str&&&&&&&&&& || history_text&&&&&&&&& || history_uint&&&&&&&&& || host_discovery&&&&&&& || host_inventory&&&&&&& || hostmacro&&&&&&&&&&&& || hosts&&&&&&&&&&&&&&&& || hosts_groups&&&&&&&&& || hosts_templates&&&&&& || housekeeper&&&&&&&&&& || httpstep&&&&&&&&&&&&& || httpstepitem&&&&&&&&& || httptest&&&&&&&&&&&&& || httptestitem&&&&&&&&& || icon_map&&&&&&&&&&&&& || icon_mapping&&&&&&&&& || ids&&&&&&&&&&&&&&&&&& || images&&&&&&&&&&&&&&& || interface&&&&&&&&&& &&||interface_discovery&& || item_condition&&&&&&& || item_discovery&&&&&&& || items&&&&&&&&&&&&&&&& ||items_applications&&& || maintenances&&&&&&&&& ||maintenances_groups&& ||maintenances_hosts&&& ||maintenances_windows& || mappings&&&&&&& &&&&&&|| media&&&&&&&&&&&&&&&& || media_type&&&&&&&&&&& || opcommand&&&&&&&&&&&& || opcommand_grp&&&&&&&& || opcommand_hst&&&&&&&& || opconditions&&&&&&&&& || operations&&&&&&&&&&& || opgroup&&&&&&&&&&&&&& || opmessage&&&&&&&&&&&& || opmessage_grp&&&&&&&& || opmessage_usr&&&&&&&& || optemplate&&&&&&&&&&& || profiles&&&&&&&&&&&&& ||proxy_autoreg_host&&& || proxy_dhistory&&&&&&& || proxy_history&&&&&&&& || regexps&&&&&&&&&&&&&& || rights&&&&&&&&&&&&&&& || screens&&&&&&&&&&&& &&|| screens_items&&&&&&&& || scripts&&&&&&&&&&&&&& || service_alarms&&&&&&& || services&&&&&&&&&&&&& || services_links&&&&&&& || services_times&&&&&&& || sessions&&&&&&&&&&&&& || slides&&&&&&&&&&&&&&& || slideshows&&&&&&&&&&& || sysmap_element_url&&& || sysmap_url&&&&&&&&&&& || sysmaps&&&&&&&&&&&&&& ||sysmaps_elements&&&&& ||sysmaps_link_triggers || sysmaps_links&&&&&&&& || timeperiods&&&&&&&&&& || trends&&&&&&&&&&&&&&& || trends_uint&&&&&&&&&& || trigger_depends&&&&&& ||trigger_discovery&&&& || triggers&&&&&&&&&&&&& || user_history&&&&&&&&& || users&&&&&&&&&&&&&&&& || users_groups&&&&&&&&& || usrgrp&&&&&&&&&&&&&&& || valuemaps&&&&&&&&&&&& |+-----------------------+104 rows in set (0.00sec)13.在服务器端192.168.10.154(服务器)的机器上,再导入下面所示的两个sql文件[root@192 ~]# mysql -uroot
-phuaxia -h192.168.10.153 zabbix &/usr/share/doc/zabbix-server-mysql-2.4.8/create/images.sql[root@192 ~]# mysql
-uroot -phuaxia -h192.168.10.153 zabbix &
/usr/share/doc/zabbix-server-mysql-2.4.8/create/data.sql14.在客户端192.168.10.153(数据库)的机器上,授权zbxuser访问zabbix数据库。mysql& GRANT ALL ON zabbix.* TO 'zbxuser'@'%' IDENTIFIED BY 'huaxia';Query OK, 0 rows
affected (0.01 sec)&mysql& flush
Query OK, 0 rows
affected (0.00 sec)15.在服务器端192.168.10.154(服务器)的机器上配置zabbix_server。[root@192 ~]# cd /etc/zabbix/[root@192 zabbix]# lsweb& zabbix_server.conf[root@192 zabbix]# ls webmaintenance.inc.phpvim zabbix_server.conf改下,把配置文件的参数改为以下所示DBHost=192.168.10.153#数据库服务器IP地址DBUser=zbxuser#刚才在数据库里设置的zabbix数据库用户。DBPassword=huaxia#刚才数据库里设置的密码。16.在服务器端192.168.10.154(服务器)的机器上启动zabbix_server。[root@192 zabbix]# ls &/etc/rc.d/init.d#查看启动脚本abrt-ccpp&&&&&&&& bluetooth&& haldaemon&&&&killall&&&&&& NetworkManager& psacct&&&&&&rpcsvcgssd& spice-vdagentd& ypbindabrtd&&&&&&&&&&&& certmonger& halt&&&&&&&&&lvm2-lvmetad& nfs&&&&&&&&&&&& quota_nld&&& rsyslog&&&&sshd&&&&&&&&&&& zabbix-serverabrt-oops&&&&&&&& cpuspeed&&& htcacheclean& lvm2-monitor&nfslock&&&&&&&& rdisc&&&&&&& sandbox&&&& sssdacpid&&&&&&&&&&&& crond&&&&&& httpd&&&&&&&& mdmonitor&&&& ntpd&&&&&&&&&&&restorecond& saslauthd&&sysstatatd&&&&&&&&&&&&&& cups&&&&&&& ip6tables&&&& messagebus&&& ntpdate&&&&&&&& rngd&&&&&&&& single&&&&& udev-postauditd&&&&&&&&&&& dnsmasq&&&& iptables&&&&& netconsole&&& oddjobd&&&&&&&& rpcbind&&&&& smartd&&&&& wdaemonautofs&&&&&&&&&&& firstboot&& irqbalance&&&netfs&&&&&&&& portreserve&&&& rpcgssd&&&&& snmpd&&&&&& winbindblk-availability& functions&&kdump&&&&&&&& network&&&&&& postfix&&&&&&&& rpcidmapd&&& snmptrapd&&wpa_supplicant[root@192 zabbix]#service zabbix-server start#启动服务Starting Zabbixserver:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&[确定][root@192 zabbix]# ss -tnlp#查看zabbix启动的进程数,看到zabbix启动在10051端口上。&LISTEN&&&&& 0&&&&&128&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&:::10051&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&:::*&&&&&users:(("zabbix_server",7273,5),("zabbix_server",7274,5),("zabbix_server",7275,5),("zabbix_server",7276,5),("zabbix_server",7277,5),("zabbix_server",7278,5),("zabbix_server",7279,5),("zabbix_server",7280,5),("zabbix_server",7281,5),("zabbix_server",7282,5),("zabbix_server",7283,5),("zabbix_server",7284,5),("zabbix_server",7285,5),("zabbix_server",7286,5),("zabbix_server",7287,5),("zabbix_server",7288,5),("zabbix_server",7289,5),("zabbix_server",7290,5),("zabbix_server",7291,5),("zabbix_server",7292,5),("zabbix_server",7293,5),("zabbix_server",7294,5),("zabbix_server",7295,5),("zabbix_server",7296,5),("zabbix_server",7297,5),("zabbix_server",7298,5),("zabbix_server",7299,5))LISTEN&&&&& 0&&&&&128&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*:10051&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*:*&&&&&users:(("zabbix_server",7273,4),("zabbix_server",7274,4),("zabbix_server",7275,4),("zabbix_server",7276,4),("zabbix_server",7277,4),("zabbix_server",7278,4),("zabbix_server",7279,4),("zabbix_server",7280,4),("zabbix_server",7281,4),("zabbix_server",7282,4),("zabbix_server",7283,4),("zabbix_server",7284,4),("zabbix_server",7285,4),("zabbix_server",7286,4),("zabbix_server",7287,4),("zabbix_server",7288,4),("zabbix_server",7289,4),("zabbix_server",7290,4),("zabbix_server",7291,4),("zabbix_server",7292,4),("zabbix_server",7293,4),("zabbix_server",7294,4),("zabbix_server",7295,4),("zabbix_server",7296,4),("zabbix_server",7297,4),("zabbix_server",7298,4),("zabbix_server",7299,4))17.在服务器端192.168.10.154(服务器)的机器上查看web接口配置。注意:配置一般不用改[root@192 zabbix]# ls& /etc/httpd/conf.d/mod_dnssd.conf& php.conf&README& welcome.conf& zabbix.conf[root@192 zabbix]# cd /etc/httpd/[root@192 httpd]# lsconf& conf.d&logs& modules& run[root@192 httpd]# cd conf.d/[root@192 conf.d]# lsmod_dnssd.conf& php.conf&README& welcome.conf& zabbix.conf[root@192 conf.d]# cat zabbix.confAlias /zabbix /usr/share/zabbix#定义访问别名&&Directory"/usr/share/zabbix"&&&& Options FollowSymLinks&&& AllowOverride None&&& Order allow,deny&&& Allow from all&&&& &IfModule mod_php5.c&&&&&&&& php_value max_execution_time 300&&&&&&& php_value memory_limit 128M&&&&&&&php_value post_max_size 16M&&&&&&& php_value upload_max_filesize 2M&&&&&&& php_value max_input_time 300&&&&&&& # php_value date.timezone Europe/Riga&&& &/IfModule&&/Directory&18.在服务器端192.168.10.154(服务器)的机器上,启动http服务。[root@192 ~]# service httpd start正在启动 httpd:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& [确定][root@192 ~]# ss -tnlpLISTEN&&&& 0&&&&&128& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&:::80#80端口处于监听状态&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&:::*&&&&&users:(("httpd",7492,4),("httpd",7495,4),("httpd",7496,4),("httpd",7497,4),("httpd",7498,4),("httpd",7499,4),("httpd",7500,4),("httpd",7501,4),("httpd",7502,4))19.在服务器端192.168.10.154(服务器)的机器上,访问zabbix,在浏览器中输入网址http://192.168.10.154/zabbix,会出现如下图所示的界面。注意:主机防火墙这里要关闭,或者放开对80端口的访问权限。点击next,出现下列报错。显示时区不对。那么这里我们来修改时区。vim /etc/php.ini#默认安装php的配置文件路径date.timezone= Asia/Shanghai#修改时区&[root@192 ~]# service httpd restart#重启httpd服务停止 httpd:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&[确定]正在启动 httpd:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &[确定]再重新检查下,说明配置正确,如下图:配置数据库连接:配置Zabbix-server 详细:这里无需过多的配置,直接下一步就可以了。安装前的摘要,直接下一步:提示安装成功,点击"finish",进入登录界面:填入默认的用户名"admin",默认密码"zabbix"登录。显示如下图所示的界面:证明安装已经成功!接下来的大多数的工作,都是在这个WEB接口上配置的。三.zabbix配置这里以一台客户机做介绍:192.168.10.116(客户机)一般需要安装下面的几个包:zabbix-2.4.8-1.el6.x86_64、zabbix-agent-2.4.8-1.el6.x86_64、zabbix-sender-2.4.8-1.el6.x86_64这里我们使用yum安装,至于配置yum的方法参照上面所示的服务器端的配置,这里不再详述。1.yum install zabbix.x86_64 zabbix-agent.x86_64zabbix-sender.x86_642.编辑配置文件[root@192 yum.repos.d]# cd /etc/zabbix/[root@192 zabbix]# lszabbix_agentd.conf #主配置文件&zabbix_agentd.d[root@192 zabbix]# ls zabbix_agentd.d/userparameter_mysql.conf#附加配置文件vim zabbix_agentd.conf#编辑配置文件只需修改参数Server=192.168.10.154(zabbix服务器地址),别的暂时不用管。3.启动服务[root@192 zabbix]# ls /etc/init.d/#查看启动脚本abrt-ccpp& blk-availability& firstboot&&&&iptables&&&&& messagebus&&&&& ntpd&&&&&&&& rdisc&&&&&&& rsyslog&&& spice-vdagentd& wpa_supplicantabrtd&&&&& bluetooth&&&&&&&& functions&&&& irqbalance&&& netconsole&&&&& ntpdate&&&&& restorecond& sandbox&&&sshd&&&&&&&&&&& ypbindabrt-oops& certmonger&&&&&&& haldaemon&&&& kdump&&&&&&&& netfs&&&&&&&&&& oddjobd&&&&& rngd&&&&&&&& saslauthd& sssd&&&&&&&&&&& zabbix-agentacpid&&&&& cpuspeed&&&&&&&&& halt&&&&&&&&& killall&&&&&& network&&&&&&&& portreserve& rpcbind&&&&&single&&&& sysstatatd&&&&&&& crond&&&&&&&&&&&& htcacheclean& lvm2-lvmetad&NetworkManager& postfix&&&&& rpcgssd&&&&& smartd&&&&udev-postauditd&&&& cups&&&&&&&&&&&&& httpd&&&&&&&& lvm2-monitor& nfs&&&&&&&&&&&&psacct&&&&&& rpcidmapd&&& snmpd&&&&&wdaemonautofs&&&& dnsmasq&&&&&&&&&& ip6tables&&&& mdmonitor&&&& nfslock&&&&&&&& quota_nld&&& rpcsvcgssd&&snmptrapd& winbindservice zabbix-agent start#启动服务&[root@192 zabbix]# ss -tnlp#查看进程和端口LISTEN&&&&& 0&&&&& 128&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&:::10050&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&:::*&&&&&users:(("zabbix_agentd",2372,5),("zabbix_agentd",2373,5),("zabbix_agentd",2374,5),("zabbix_agentd",2375,5),("zabbix_agentd",2376,5),("zabbix_agentd",2377,5))LISTEN&&&&& 0&&&&& 128&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*:10050&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*:*&&&&&users:(("zabbix_agentd",2372,4),("zabbix_agentd",2373,4),("zabbix_agentd",2374,4),("zabbix_agentd",2375,4),("zabbix_agentd",2376,4),("zabbix_agentd",2377,4))&监听在10050端口上。4.添加监控的主机登录监控服务器主页面,"Configuration"选项里的"host"菜单下,点击"Create host"按钮。出现如下图所示界面:在该对话框中输入:主机名、显示名、组名、IP地址、端口等信息如下图所示:添加完点击"add",显示如下图:说明主机已经在监控了。再到"Dashboard"菜单下看看,如下图所示:5.监控的主机上添加应用1).定义一个项目,如下图所示:2).点击"Configuration"选项下面的"Host"按钮,再点击"Items"选项,出现如下图所示的图形界面:3).点击"Create item"按钮,出现如下图所示的界面:4).可以在里面定义一些参数,这里我们以监控网卡流量为例,配置在里面的一些参数。5).配置完,点击"add"添加。6).看到图中所示参数的状态,说明Item已启用。如下图所示,应用和项目启用的很明显。查看"Dashboard",已看到有一个Item在启用,如下图所示:7).查看刚采集到的数据,采集到的网卡流量的值清晰可见。如下图所示:8).点击"Graph",可以看到绘图,如下图所示:本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)posts - 41,&
comments - 0,&
trackbacks - 0
一.Zabbix简介&&&
&&&&&& zabbix是一个基于界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。&&&&&& zabbix由与可选组件两部门组成。&&&&&& zabbix&server可以通过,,,端口监视等方法提供对远程服务器网络状态的监视。&&&&&& zabbix&agent需要安装在被监视的目标服务器上,它主要完成对硬件信息或与操作系统有关的内存,等信息的收集。
zabbix的主要特点:&&&&&&&&& -&安装与配置简单,学习成本低&&&&&&&&&& -&支持多语言(包括中文)&&&&&&&&& -&免费开源&&&&&&&&& -&自动发现服务器与网络设备&&&&&&&&& -&分布式监视以及集中管理功能&&&&&&&&& -&可以无监视&&&&&&&&& -&用户安全认证和柔软的授权方式&&&&&&&&& -&通过界面设置或查看监视结果&&&&&&&&& -&email等通知功能&&&&&&&& 等等
Zabbix主要功能:&&&&&&&& -&CPU负荷&&&&&&&& -&内存使用&&&&&&&& -&磁盘使用&&&&&&&& -&网络状况&&&&&&&& -&端口监视&&&&&&&& -&日志监视&
官方也提供了安装资料:/wiki/howto/monitor
本例采用PRM包安装方式,该方式交简介。
安装环境:
  系统:CentOS release 6.8
  地址:server 192.168.2.200
     agent &192.168.2.201
二、Zabbix-server服务器端的安装:
1、安装zabbix官方源
1 [root@lys1 ~]# rpm -ivh http:///zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
2 Retrieving http:///zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
3 Preparing...
########################################### [100%]
package zabbix-release-2.4-1.el6.noarch is already installed
5 [root@lys1 ~]#
2、安装zabbix-server
由于服务端也是需要监控的,故这里也一并安装zabbix-agent
1 [root@lys1 ~]# yum -y install zabbix zabbix-get zabbix-server zabbix-web-mysql zabbix-web zabbix-agent
2 已加载插件:fastestmirror
3 设置安装进程
4 Loading mirror speeds from cached hostfile
zabbix-get.x86_64 0:2.4.8-1.el6
zabbix-server.x86_64 0:2.4.8-1.el6
zabbix-web.noarch 0:2.4.8-1.el6
zabbix-web-mysql.noarch 0:2.4.8-1.el6
9 作为依赖被安装:
OpenIPMI-libs.x86_64 0:2.0.16-14.el6 dejavu-fonts-common.noarch 0:2.33-1.el6 dejavu-sans-fonts.noarch 0:2.33-1.el6
fontpackages-filesystem.noarch 0:1.41-1.1.el6 fping.x86_64 0:2.4b2-16.el6
freetype.x86_64 0:2.3.11-17.el6
iksemel.x86_64 0:1.4-2.el6
libX11.x86_64 0:1.6.3-2.el6
libX11-common.noarch 0:1.6.3-2.el6
libXau.x86_64 0:1.0.6-4.el6
libXpm.x86_64 0:3.5.10-2.el6
libxcb.x86_64 0:1.11-2.el6
libxslt.x86_64 0:1.1.26-2.el6_3.1
lm_sensors-libs.x86_64 0:3.1.1-17.el6
net-snmp.x86_64 1:5.5-57.el6_8.1
net-snmp-libs.x86_64 1:5.5-57.el6_8.1
php.x86_64 0:5.3.3-48.el6_8
php-bcmath.x86_64 0:5.3.3-48.el6_8
php-cli.x86_64 0:5.3.3-48.el6_8
php-common.x86_64 0:5.3.3-48.el6_8
php-gd.x86_64 0:5.3.3-48.el6_8
php-mbstring.x86_64 0:5.3.3-48.el6_8
php-mysql.x86_64 0:5.3.3-48.el6_8 php-pdo.x86_64 0:5.3.3-48.el6_8
php-xml.x86_64 0:5.3.3-48.el6_8
unixODBC.x86_64 0:2.2.14-14.el6
zabbix-server-mysql.x86_64 0:2.4.8-1.el6
17 [root@lys1 ~]#
3.安装mysql数据库服务(web、php在上条命令中已安装)
1 [root@lys1 ~]# yum -y install mysql-server
2 已加载插件:fastestmirror
3 设置安装进程
mysql-server.x86_64 0:5.1.73-7.el6
8 作为依赖被安装:
mysql.x86_64 0:5.1.73-7.el6
perl-DBD-MySQL.x86_64 0:4.013-3.el6
12 [root@lys1 ~]#
  修改MySQL配置文件如下
1 [root@lys1 ~]# vim /etc/my.cnf
2 [mysqld]
3 datadir=/var/lib/mysql
4 socket=/var/lib/mysql/mysql.sock
5 user=mysql
6 # Disabling symbolic-links is recommended to prevent assorted security risks
7 symbolic-links=0
9 character-set-server=utf8
#设置字符集为utf8
10 innodb_file_per_table=1
#让innodb的每个表文件单独存储
12 [mysqld_safe]
13 log-error=/var/log/mysqld.log
14 pid-file=/var/run/mysqld/mysqld.pid
  启动MySQL服务
1 [root@lys1 ~]# chkconfig mysqld on
2 [root@lys1 ~]# service mysqld start
3 初始化 MySQL 数据库: WARNING: The host 'lys1' could not be looked up with resolveip.
4 This probably means that your libc libraries are not 100 % compatible
6 Please report any problems with the /usr/bin/mysqlbug script!
9 正在启动 mysqld:
10 [root@lys1 ~]#
4、创建zabbix的数据库
  设置MySQL的root用户密码。
1 [root@lys1 ~]# mysqladmin -uroot password admin
2 [root@lys1 ~]# mysql -uroot -padmin
3 mysql& create database zabbix character set utf8;
4 Query OK, 1 row affected (0.01 sec)
5 mysql& grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
6 Query OK, 0 rows affected (0.00 sec)
(注意:创建zabbix的数据库字符集不为utf8会导致web界面切换到中文环境时出现乱码)
5、导入zabbix-server的数据库
1 [root@lys1 ~]# mysql -uzabbix -pzabbix
3 Database changed
4 mysql& source /usr/share/doc/zabbix-server-mysql-2.4.8/create/schema.
  需要注意的是,如果zabbix-proxy,只导入schema.sql即可,无需导入下面的sql,否则zabbix-proxy无法正常工作。
1 mysql& source /usr/share/doc/zabbix-server-mysql-2.4.8/create/images.
2 mysql& source /usr/share/doc/zabbix-server-mysql-2.4.8/create/data.
4 +-----------------------+
5 | Tables_in_zabbix
6 +-----------------------+
7 | acknowledges
8 | actions
9 | alerts
10 | application_template
11 | applications
12 ... ...
6、配置zabbix_server.conf
1 [root@lys1 ~]# vim /etc/zabbix/zabbix_server.conf
2 DBHost=localhost
3 DBName=zabbix
4 DBUser=zabbix
5 DBPassword=zabbix
6 StartPollers=5
7 CacheSize=256M
  以上参数需根据实际情况进行调整。默认只需修改DBPassword=zabbix即可。
1 [root@lys1 ~]# mkdir /etc/zabbix/{alertscripts,externalscripts}
7、启动zabbix-server服务
1 [root@lys1 ~]# service zabbix-server start
2 Starting Zabbix server:
3 [root@lys1 ~]# service httpd start
4 正在启动 httpd:httpd: apr_sockaddr_info_get() failed for lys1
5 httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
7 [root@lys1 ~]# chkconfig zabbix-server on
8 [root@lys1 ~]# chkconfig httpd on
9 [root@lys1 ~]#
8、防火墙设置
1 [root@lys1 ~]# vim /etc/sysconfig/iptables
2 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
3 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
4 -A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
5 -A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
6 -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
  上述代码中,10050是agent的端口,agent采用被动方式,server主动连接agent的10050端口;10051是server的端口,agent采用主动或trapper的方式,会连接server的10051端口。
9、selinux的设置
1 [root@lys1 ~]# chcon -R -t httpd_sys_content_rw_t /usr/share/zabbix/conf
2 [root@lys1 ~]# setsebool -P httpd_can_network_connect=true
3 [root@lys1 ~]# semanage port -a -t http_port_t -p tcp 10051
如果对selinux不是特别的熟悉,可以选择关闭selinux。在实际的生产环境中,大部分用户也是选择关闭selinux的。
1 [root@lys1 ~]# setenforce 0
#设置为警告模式,只给出提示,不会阻止
#操作,不用重启服务器即生效。
2 [root@lys1 ~]#getenforce
#获取当前selinux的运行状态
3 【Enforcing|Permissive|Disabled】
直接关闭selinux的方法
[root@lys1 ~]# getenforce vim /etc/selinux/config
SELINUX=disabled
注意:此种方式需要重启服务器才能生效。
10、php.ini配置文件的设置
1 [root@lys1 ~]# vim /etc/php.ini
2 date.timezone = Asia/Shanghai
3 max_execution_time = 300
4 max_input_time = 300
5 memory_limit = 128M
6 post_max_size = 16M
7 mbstring.func_overload = 2
[root@lys1 ~]# vim /etc/httpd/conf.d/zabbix.conf
&IfModule mod_php5.c&
php_value date.timezone Asia/Shanghai
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# php_value date.timezone Europe/Riga
&/IfModule&
&/Directory&
[root@lys1 ~]# service httpd restart
停止 httpd:
正在启动 httpd:httpd: apr_sockaddr_info_get() failed for lys1
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[root@lys1 ~]#
三、配置web界面
打开浏览器,输入http://192.168.2.200/zabbix会出现如下图:
提示&PHP mbstring.func_overload fail
查看官方文档说是要关闭 php配置文件的mbstring.func_overload。。。
1 [root@lys1 ~]# vim /etc/php.ini
2 #mbstring.func_overload = 2
3 [root@lys1 ~]# service httpd restart
4 停止 httpd:
5 正在启动 httpd:httpd: apr_sockaddr_info_get() failed for lys1
6 httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
8 [root@lys1 ~]#
顺利通过,继续next
配置mysql信息,单击 test connection 按钮测试数据库是否正常连接,显示 ok 继续 next
&(注意:如果zabbix-sever在其他机器中,这里的host填写zabbix-server所在的机器ip)
确认信息后,继续 next
配置完成提示 ok 点finish
进入登录界面,默认账户是Admin,密码是zabbix,登录:
web配置完成。
如果提示不能正常运行,分别检查zabbix_server.conf中的各项配置文件、selinux、iptables等。
四、安装zabbix-agent客户端
1、安装zabbix官方的yum源
1 [root@lys2 ~]# rpm -ivh http:///zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
2 Retrieving http:///zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
3 warning: /var/tmp/rpm-tmp.Q7fTlA: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
4 Preparing...
########################################### [100%]
1:zabbix-release
########################################### [100%]
6 [root@lys2 ~]# yum -y install zabbix zabbix-agent
7 已加载插件:fastestmirror
8 设置安装进程
9 Determining fastest mirrors
10 ... ...
11 已安装:
zabbix.x86_64 0:2.4.8-1.el6
zabbix-agent.x86_64 0:2.4.8-1.el6
15 [root@lys2 ~]#
2、防火墙设置
1 [root@lys2 ~]# vim /etc/sysconfig/iptables
2 -A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
3 -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
4 [root@lys2 ~]# service iptables restart
5 iptables:将链设置为政策 ACCEPT:filter
6 iptables:清除防火墙规则:
7 iptables:正在卸载模块:
8 iptables:应用防火墙规则:
9 [root@lys2 ~]#
3、配置zabbix_agentd.conf
1 [root@lys2 ~]# vim /etc/zabbix/zabbix_agentd.conf
2 Server=127.0.0.1,192.168.2.200
#被动模式,zabbix-server的ip
3 ServerActive=192.168.2.200:10051
4 Hostname=zabbix agent1
5 [root@lys2 ~]# chkconfig zabbix-agent on
6 [root@lys2 ~]# service zabbix-agent start
7 Starting Zabbix agent:
8 [root@lys2 ~]#
五、在zabbix-server上添加主机zabbix-agent,验证zabbix-server是否能监控到zabbix-agent
显示正常监控状态,zabbix搭建完成。
阅读(...) 评论()

我要回帖

更多关于 yum 安装mysql server 的文章

 

随机推荐