zabbix-简介


监控服务器的出入带宽,报文数量

网站响应速度超过几秒

 

yum install zabbix-server-mysql zabbix-agent2
yum install centos-release-scl
yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl

安装mysql

yum -y install mysql-*

查看状态

[root@master-2 mysql]# systemctl  start mysqld

[root@master-2 mysql]# systemctl  status  mysql
Unit mysql.service could not be found.
[root@master-2 mysql]# systemctl  status  mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2022-05-25 21:28:52 CST; 11s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 13300 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 13245 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 13303 (mysqld)
    Tasks: 27
   Memory: 369.2M
   CGroup: /system.slice/mysqld.service
           └─13303 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

May 25 21:28:44 master-2 systemd[1]: Starting MySQL Server...
May 25 21:28:52 master-2 systemd[1]: Started MySQL Server.

查看初始密码

[root@master-2 mysql]# grep password /var/log/mysqld.log
2022-05-25T13:28:49.450510Z 1 [Note] A temporary password is generated for root@localhost: ijgfk:z.d1kI

登录

[root@master-2 mysql]# mysql -uroot -pijgfk:z.d1kI
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

修改密码

[root@master-2 mysql]# mysqladmin -uroot -pijgfk:z.d1kI -password xxxxx

创建数据库、用户,授权

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> create user zabbix@localhost identified by 'xxxxxxxx';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;

导入数据

[root@master-2 mysql]# ll /usr/share/doc/zabbix-server-mysql-5.0.23/
total 3228
-rw-r--r-- 1 root root      98 May  2 16:26 AUTHORS
-rw-r--r-- 1 root root 1223392 May  2 17:20 ChangeLog
-rw-r--r-- 1 root root   17990 May  2 16:26 COPYING
-rw-r--r-- 1 root root 2040914 May  2 18:28 create.sql.gz
-rw-r--r-- 1 root root     282 May  2 17:20 double.sql
-rw-r--r-- 1 root root      52 May  2 16:26 NEWS
-rw-r--r-- 1 root root    1322 May  2 17:20 README
mysql> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| widget_field               |
+----------------------------+
166 rows in set (0.00 sec)

修改zabbix配置文件

[root@master-2 mysql]# grep "^[a-Z]" /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=512
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=xxxxxxxx
DBPort=3306
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1

vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf

server {
        listen          80;
        server_name     192.168.64.111;

        root    /usr/share/zabbix;

        index   index.php;

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

[zabbix]
user = apache
group = apache

listen = /var/opt/rh/rh-php72/run/php-fpm/zabbix.sock
listen.acl_users = apache,nginx
listen.allowed_clients = 127.0.0.1

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 200

php_value[session.save_handler] = files
php_value[session.save_path]    = /var/opt/rh/rh-php72/lib/php/session/

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[max_input_vars] = 10000
php_value[date.timezone] = Asia/Shanghai

启动服务

[root@master-2 mysql]# systemctl restart zabbix-server zabbix-agent2 rh-nginx116-nginx rh-php72-php-fpm
[root@master-2 mysql]# systemctl enable zabbix-server zabbix-agent2 rh-nginx116-nginx rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service to /usr/lib/systemd/system/zabbix-agent2.service.

 

原创文章,作者:745907710,如若转载,请注明出处:https://blog.ytso.com/272421.html

(0)
上一篇 2022年7月9日
下一篇 2022年7月9日

相关推荐

发表回复

登录后才能评论