linux監控平臺介紹,zabbix監控介紹,zabbix安裝,忘記Admin密碼如何做
阿新 • • 發佈:2018-07-07
stat can emctl mct web img mman row 安裝源 linux監控平臺介紹
- cacti、nagios、zabbix、smokeping、open-falcon等等
- cacti、smokeping偏向於基礎監控,成圖非常漂亮
- cacti、nagios、zabbix服務端監控中心,需要php環境支持,其中zabbix和cacti都需要mysql作為數據存儲,nagios不用存儲歷史數據,註重服務或者監控項的狀態,zabbix會獲取服務或者監控項目的數據,會把數據記錄到數據庫裏,從而可以成圖
- open-falcon為小米公司開發,開源後受到諸多大公司和運維工程師的追捧,適合大企業,滴滴、360、新浪微博、京東等大公司在使用這款監控軟件,值得研究
zabbix監控介紹
- C/S架構,基於C++開發,監控中心支持web界面配置和管理,需要php和mysql支持
- 單server節點可以支持上萬臺客戶端
- 最新版本3.4,官方文檔https://www.zabbix.com/manuals
- 包含5個組件
- zabbix-server 監控中心,接收客戶端上報信息,負責配置、統計、操作數據
- 數據存儲 存放數據,比如mysql
- web界面 也叫web UI,在web界面下操作配置是zabbix簡單易用的主要原因
- zabbix-proxy 可選組件,它可以代替zabbix-server的功能,減輕server的壓力
- zabbix-agent 客戶端軟件,負責采集各個監控服務或項目的數據,並上報
zabbix安裝
- 官網下載地址 www.zabbix.com/download
- wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm,下載zabbix源並安裝源,客戶端也要安裝
[root@akuilinux01 ~]# rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm 警告:zabbix-release-3.2-1.el7.noarch.rpm: 頭V4 RSA/SHA512 Signature, 密鑰 ID a14fe591: NOKEY 準備中... ################################# [100%] 正在升級/安裝... 1:zabbix-release-3.2-1.el7 ################################# [100%]
- 服務端安裝zabbix
yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql
- 會連帶安裝httpd和php
- 如果mysql之前沒有安裝的話,需要根據lamp那一章的mysql安裝方法安裝mysql
- vim /etc/my.cnf //需要增加配置
character_set_server = utf8 - 重啟mysqld服務後,進入mysql命令行,創建zabbix庫和用戶
mysql> create database zabbix character set utf8; Query OK, 1 row affected (0.34 sec) mysql> grant all on zabbix.* to ‘zabbix‘@‘127.0.0.1‘ identified by ‘s5381561‘; Query OK, 0 rows affected (0.05 sec)
- 導入數據
[root@akuilinux01 ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.11/ [root@akuilinux01 zabbix-server-mysql-3.2.11]# ls AUTHORS ChangeLog COPYING create.sql.gz NEWS README [root@akuilinux01 zabbix-server-mysql-3.2.11]# gzip -d create.sql.gz [root@akuilinux01 zabbix-server-mysql-3.2.11]# ls AUTHORS ChangeLog COPYING create.sql NEWS README [root@akuilinux01 zabbix-server-mysql-3.2.11]# mysql -uroot -ps5381561 zabbix < create.sql Warning: Using a password on the command line interface can be insecure.
- 開啟服務並開機啟動
如果有nginx服務需要先停掉並禁掉開機啟動 [root@akuilinux01 ~]# systemctl stop nginx [root@akuilinux01 ~]# chkconfig nginx off [root@akuilinux01 ~]# systemctl start httpd [root@akuilinux01 ~]# systemctl enable httpd [root@akuilinux01 ~]# systemctl start zabbix-server [root@akuilinux01 ~]# systemctl enable zabbix-server [root@akuilinux01 ~]# ps aux |grep zabbix zabbix 2048 0.0 0.1 254588 3496 ? S 22:56 0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf root 2154 0.0 0.0 112676 984 pts/0 S+ 23:01 0:00 grep --color=auto zabbix
- 修改配置文件
[root@akuilinux01 ~]# vim /etc/zabbix/zabbix_server.conf DBHost=127.0.0.1 DBName=zabbix DBUser=zabbix DBPassword=s5381561 [root@akuilinux01 ~]# systemctl restart zabbix-server [root@akuilinux01 ~]# netstat -lntp |grep zabbix tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 2176/zabbix_server tcp6 0 0 :::10051 :::* LISTEN 2176/zabbix_server
- 在瀏覽器裏輸入http://192.168.21.128/zabbix/進入zabbix的web界面,點擊下一步
- PHP option "date.timezone" unknown Fail提示時區不對
[root@akuilinux01 ~]# vim /etc/php.ini date.timezone = Asia/Shanghai [root@akuilinux01 ~]# systemctl restart httpd
- 下一步,定義mysql信息和主機名,最後完成
- 默認用戶名Admin 密碼zabbix
- 進入後臺第一件事情就是修改密碼,改中文
- 在客戶端上也需要下載zabbix的yum源
- yum install -y zabbix-agent
- vim /etc/zabbix/zabbix_agentd.conf //修改如下配置
Server=127.0.0.1修改為Server=192.168.21.128 //定義服務端的ip(被動模式) ServerActive=127.0.0.1修改為ServerActive=192.168.21.128 //定義服務端的ip(主動模式) Hostname=Zabbix server修改為Hostname=Zabbix server //這是自定義的主機名,一會還需要在web界面下設置同樣的主機名
- 啟動服務並開機啟動
[root@akuilinux02 ~]# systemctl start zabbix-agent [root@akuilinux02 ~]# systemctl enable zabbix-agent Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
忘記Admin密碼如何做
[root@akuilinux01 ~]# mysql -uroot -ps5381561 mysql> use zabbix mysql> desc users; #密碼存在users表裏 +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ | userid | bigint(20) unsigned | NO | PRI | NULL | | | alias | varchar(100) | NO | UNI | | | | name | varchar(100) | NO | | | | | surname | varchar(100) | NO | | | | | passwd | char(32) | NO | | | | | url | varchar(255) | NO | | | | | autologin | int(11) | NO | | 0 | | | autologout | int(11) | NO | | 900 | | | lang | varchar(5) | NO | | en_GB | | | refresh | int(11) | NO | | 30 | | | type | int(11) | NO | | 1 | | | theme | varchar(128) | NO | | default | | | attempt_failed | int(11) | NO | | 0 | | | attempt_ip | varchar(39) | NO | | | | | attempt_clock | int(11) | NO | | 0 | | | rows_per_page | int(11) | NO | | 50 | | +----------------+---------------------+------+-----+---------+-------+ 16 rows in set (0.00 sec) mysql> update users set passwd=md5(‘5381561‘) where alias=‘Admin‘; #更改Admin用戶密碼 Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from users; #目前有倆個用戶 +--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+ | userid | alias | name | surname | passwd | url | autologin | autologout | lang | refresh | type | theme | attempt_failed | attempt_ip | attempt_clock | rows_per_page | +--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+ | 1 | Admin | Zabbix | Administrator | 8735d2f54dde47455a2558e0f138dc89 | | 1 | 0 | zh_CN | 30 | 3 | default | 0 | | 0 | 50 | | 2 | guest | | | d41d8cd98f00b204e9800998ecf8427e | | 0 | 900 | en_GB | 30 | 1 | default | 0 | | 0 | 50 | +--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+ 2 rows in set (0.00 sec)
linux監控平臺介紹,zabbix監控介紹,zabbix安裝,忘記Admin密碼如何做