天天看点

zabbix-----1-----安装

更新yum源为阿里云的,方便安装

安装所需要的安装包:

1

2

<code>yum </code><code>install</code> <code>zabbix-server-mysql zabbix-web-mysql</code>

<code>yum </code><code>install</code> <code>mariadb-server</code>

关闭 NetworkManager 和防火墙

<code>systemctl disable firewalld &amp;&amp; systemctl stop firewalld</code>

<code>systemctl disable NetworkManager &amp;&amp; systemctl stop NetworkManager</code>

关闭并确认 SELinux 处于关闭状态

3

4

5

<code>快速修改的方法:</code>

<code>sed</code> <code>-i </code><code>'s#SELINUX=enforcing#SELINUX=disabled#g'</code> <code>/etc/selinux/config</code> <code>&amp;&amp; </code><code>grep</code>

<code>'SELINUX=disabled'</code> <code>/etc/selinux/config</code>

<code>setenforce 0</code>

<code>getenforce</code>

启动数据库

<code>systemctl </code><code>enable</code> <code>mariadb</code>

<code>systemctl start mariadb</code>

#检查数据库

6

7

8

<code>[root@zabbix-node1 yum.repos.d]</code><code># netstat -lntup</code>

<code>Active Internet connections (only servers)</code>

<code>Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID</code><code>/Program</code> <code>name    </code>

<code>tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      4396</code><code>/mysqld</code>         

<code>tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1274</code><code>/sshd</code>           

<code>tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1857</code><code>/master</code>         

<code>tcp6       0      0 :::22                   :::*                    LISTEN      1274</code><code>/sshd</code>           

<code>tcp6       0      0 ::1:25                  :::*                    LISTEN      1857</code><code>/master</code>

执行数据库安全初始化

<code>mysql_securt_initallion</code>

登录数据库,并创建数据库

<code>create database zabbix character </code><code>set</code> <code>utf8 collate utf8_bin;</code>

<code>grant all on zabbix.* to zabbix@</code><code>'localhost'</code> <code>identified by </code><code>'mysql123456'</code><code>;</code>

<code>flush privileges;</code>

导入初始化数据到数据库中

<code>rpm -ql zabbix-server-mysql</code>

<code>zcat </code><code>/usr/share/doc/zabbix-server-mysql-3</code><code>.2.3</code><code>/create</code><code>.sql.gz|mysql -uzabbix -pmysql123456 zabbix</code>

#启动web界面

<code>vim </code><code>/etc/httpd/http</code><code>.conf</code>

<code>95hang 的servername 127.0.0.1:80</code>

<code>systemctl </code><code>enable</code> <code>start httpd.service</code>

设置时区

系统时区设置

9

10

11

12

13

14

15

16

<code>[root@zabbix-node1 conf]</code><code># timedatectl set-timezone Asia/Shanghai</code>

<code>[root@zabbix-node1 conf]</code><code># timedatectl list-timezones|grep Shanghai</code>

<code>Asia</code><code>/Shanghai</code>

<code>[root@zabbix-node1 conf]</code><code># ntpdate time1.aliyun.com</code>

<code> </code><code>8 Mar 16:35:54 ntpdate[4748]: step </code><code>time</code> <code>server 115.28.122.198 offset -28801.022509 sec</code>

<code>[root@zabbix-node1 conf]</code><code># date </code>

<code>Wed Mar  8 16:36:00 CST 2017</code>

<code>[root@zabbix-node1 conf]</code><code># timedatectl </code>

<code>      </code><code>Local </code><code>time</code><code>: Wed 2017-03-08 16:36:05 CST</code>

<code>  </code><code>Universal </code><code>time</code><code>: Wed 2017-03-08 08:36:05 UTC</code>

<code>        </code><code>RTC </code><code>time</code><code>: Wed 2017-03-08 16:36:07</code>

<code>       </code><code>Time zone: Asia</code><code>/Shanghai</code> <code>(CST, +0800)</code>

<code>     </code><code>NTP enabled: n</code><code>/a</code>

<code>NTP synchronized: no</code>

<code> </code><code>RTC </code><code>in</code> <code>local</code> <code>TZ: no</code>

<code>      </code><code>DST active: n</code><code>/a</code>

设置zabbix时区

17

<code>[root@zabbix-node1 conf.d]</code><code># vim zabbix.conf </code>

<code>#</code>

<code># Zabbix monitoring system php web frontend</code>

<code>Alias </code><code>/zabbix</code> <code>/usr/share/zabbix</code>

<code>&lt;Directory </code><code>"/usr/share/zabbix"</code><code>&gt;</code>

<code>    </code><code>Options FollowSymLinks</code>

<code>    </code><code>AllowOverride None</code>

<code>    </code><code>Require all granted</code>

<code>    </code><code>&lt;IfModule mod_php5.c&gt;</code>

<code>        </code><code>php_value max_execution_time 300</code>

<code>        </code><code>php_value memory_limit 128M</code>

<code>        </code><code>php_value post_max_size 16M</code>

<code>        </code><code>php_value upload_max_filesize 2M</code>

<code>        </code><code>php_value max_input_time 300</code>

<code>        </code><code>php_value always_populate_raw_post_data -1</code>

<code>        </code><code>php_value </code><code>date</code><code>.timezone Asia</code><code>/Shanghai</code>  <code>#这里改成中国的</code>

web界面登录

<a href="https://s5.51cto.com/wyfs02/M00/8E/69/wKioL1i_w-SSy8KsAAEkGNnV0BE412.png" target="_blank"></a>

<a href="https://s1.51cto.com/wyfs02/M00/8E/6B/wKiom1i_xDqh8VBxAAAqPuuL9Ys825.png-wh_500x0-wm_3-wmp_4-s_2664362478.png" target="_blank"></a>

看到zabbix server的状态是no

Zabbix server is running

No

localhost:10051

配置/etc/zabbix/zabbix-server.conf 中的数据库密码

重新启动

安装zabbix-agent

<code>1 zabbix-agent-3.0.5-1.el7.x86_64.rpm</code>

<code>[root@zabbix-node1 ~]</code><code># rpm -ivh zabbix-agent-3.0.5-1.el7.x86_64.rpm </code>

<code>Preparing...                          </code><code>################################# [100%]</code>

<code>Updating / installing...</code>

<code>   </code><code>1:zabbix-agent-3.0.5-1.el7         </code><code>################################# [100%]</code>

<code>[root@zabbix-node1 zabbix]</code><code># vim zabbix_agentd.conf </code>

<code>Server=127.0.0.1</code><code># 允许那台机器过来那数据</code>

<code>ServerActive=127.0.0.1</code><code>#主动模式</code>

<code>[root@zabbix-node1 zabbix]</code><code># systemctl enable zabbix-agent.service </code>

<code>Created </code><code>symlink</code> <code>from </code><code>/etc/systemd/system/multi-user</code><code>.target.wants</code><code>/zabbix-agent</code><code>.service to </code><code>/usr/lib/systemd/system/zabbix-agent</code><code>.service.</code>

<code>[root@zabbix-node1 zabbix]</code><code># systemctl satart zabbix-agent.service</code>

<code>Unknown operation </code><code>'satart'</code><code>.</code>

<code>[root@zabbix-node1 zabbix]</code><code># systemctl start zabbix-agent.service</code>

<code>[root@zabbix-node1 zabbix]</code><code># netstat -lntup</code>

<code>tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      5506</code><code>/mysqld</code>         

<code>tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      6643</code><code>/zabbix_agentd</code>  

<code>tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      6081</code><code>/zabbix_server</code>

本文转自 kesungang 51CTO博客,原文链接:http://blog.51cto.com/sgk2011/1904528,如需转载请自行联系原作者