国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Linux下Zabbix5.0 LTS添加MySQL監(jiān)控,實(shí)現(xiàn)郵件報(bào)警并執(zhí)行預(yù)處理操作

番茄西紅柿 / 3144人閱讀

摘要:依據(jù)前文下監(jiān)控基礎(chǔ)原理及安裝部署圖文教程環(huán)境,繼續(xù)添加應(yīng)用集。第二部分動(dòng)作觸發(fā)實(shí)現(xiàn)郵箱報(bào)警功能。郵箱,已收到測(cè)試郵件。創(chuàng)建二級(jí)管理員用戶。測(cè)試停用服務(wù),驗(yàn)證結(jié)果。第三部分執(zhí)行預(yù)處理操作。設(shè)置告警停用后,自動(dòng)執(zhí)行重啟操作。

依據(jù)前文:Linux下Zabbix5.0 LTS監(jiān)控基礎(chǔ)原理及安裝部署(圖文教程) 環(huán)境,繼續(xù)添加MySQL應(yīng)用集。

第一部分:添加Zabbix自帶的MySQL應(yīng)用集。

在ZabbixClient-01上操作。官方rpm下載

# 檢查是否已安裝MySQL,反之下載安裝[root@ZabbixClient-01 ~]# rpm -qa | grep mysql[root@ZabbixClient-01 ~]# wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm[root@ZabbixClient-01 ~]# rpm -Uvh mysql57-community-release-el7-10.noarch.rpm[root@ZabbixClient-01 ~]# yum list all | grep mysql-community[root@ZabbixClient-01 ~]# yum install mysql-community-server mysql-community-client -y[root@ZabbixClient-01 ~]# mysql -Vmysql  Ver 14.14 Distrib 5.7.36, for Linux (x86_64) using  EditLine wrapper# 檢查是否正常啟動(dòng)[root@ZabbixClient-01 ~]# systemctl start mysqld && systemctl enable mysqld[root@ZabbixClient-01 ~]# netstat -nutpl | grep mysqltcp6       0      0 :::3306                 :::*                    LISTEN      7350/mysqld[root@ZabbixClient-01 ~]# ps -ef | grep mysqlmysql      7350      1  0 14:43 ?        00:00:03 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid# MySQL安全初始化[root@Mysql-Master01 ~]# grep temporary password /var/log/mysqld.log2021-08-19T04:08:59.720748Z 1 [Note] A temporary password is generated for root@localhost: .!aTlyih4r2y[root@Mysql-Master01 ~]# mysql_secure_installationSecuring the MySQL server deployment.Enter password for user root:  # 輸入MySQL初始密碼 .!aTlyih4r2yThe existing password for the user account root has expired. Please set a new password.New password:    # 輸入符合復(fù)雜密碼策略的新密碼 Client@01Re-enter new password:  # 再次輸入 Client@01The validate_password plugin is installed on the server.The subsequent steps will run with the existing configurationof the plugin.Using existing password for root.Estimated strength of the password: 100Change the password for root ? ((Press y|Y for Yes, any other key for No) : n    # 上面以已經(jīng)修改了,無(wú)需再修改 ... skipping.By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : y    # 是否刪除匿名用戶Success.Normally, root should only be allowed to connect fromlocalhost. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y  # 是否禁用root遠(yuǎn)程登錄Success.By default, MySQL comes with a database named test thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y  # 是否刪除test庫(kù)和對(duì)test庫(kù)的訪問(wèn)權(quán)限 - Dropping test database...Success. - Removing privileges on test database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y   # 是否刷新授權(quán)表使修改生效Success.All done!# root測(cè)試登錄MySQL,并創(chuàng)建監(jiān)控用戶[root@ZabbixClient-01 ~]# mysql -u root -pEnter password:  # 輸入上面剛更改的密碼 Client@01Welcome to the MySQL monitor.  Commands end with ; or /g.Your MySQL connection id is 113Server version: 5.7.36 MySQL Community Server (GPL)Copyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type help; or /h for help. Type /c to clear the current input statement.# 創(chuàng)建用戶zbx_monitor 密碼ZabbixClient@01mysql> create user zbx_monitor@localhost identified by ZabbixClient@01;Query OK, 0 rows affected (0.00 sec)# 授予zbx_monitor權(quán)限mysql> grant usage,replication client,process,show databases,show view on *.* to zbx_monitor@localhost;Query OK, 0 rows affected (0.00 sec)  或 mysql> grant all privileges on *.* to zbx_monitor@localhost;Query OK, 0 rows affected (0.00 sec)# 刷新授權(quán),使其立即生效mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> select user,host from mysql.user;+---------------+-----------+| user          | host      |+---------------+-----------+| mysql.session | localhost || mysql.sys     | localhost || root          | localhost || zbx_monitor   | localhost |+---------------+-----------+4 rows in set (0.00 sec)mysql> show grants for zbx_monitor@localhost;+----------------------------------------------------------+| Grants for zbx_monitor@localhost                         |+----------------------------------------------------------+| GRANT ALL PRIVILEGES ON *.* TO zbx_monitor@localhost |+----------------------------------------------------------+1 row in set (0.00 sec)# zbx_monitor用戶測(cè)試登錄,并查看已有權(quán)限[root@ZabbixClient-01 ~]# mysql -u zbx_monitor -pEnter password:Welcome to the MySQL monitor.  Commands end with ; or /g.Your MySQL connection id is 6Server version: 5.7.36 MySQL Community Server (GPL)Copyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type help; or /h for help. Type /c to clear the current input statement.mysql> show grants for current_user();+----------------------------------------------------------+| Grants for zbx_monitor@localhost                         |+----------------------------------------------------------+| GRANT ALL PRIVILEGES ON *.* TO zbx_monitor@localhost |+----------------------------------------------------------+1 row in set (0.00 sec)# /etc/zabbix下新增一個(gè)文件 .my.cnf[root@ZabbixClient-01 ~]# vim /etc/zabbix/.my.cnf[mysql]user=zbx_monitorpassword=ZabbixClient@01[mysqladmin]user=zbx_monitorpassword=ZabbixClient@01# 搜索zabbix-agent自帶的MySQL Key配置文件[root@ZabbixClient-01 ~]# find / -iname userparameter_mysql*/usr/share/doc/zabbix-agent-5.0.17/userparameter_mysql.conf[root@ZabbixClient-01 ~]# cp /usr/share/doc/zabbix-agent-5.0.17/userparameter_mysql.conf /etc/zabbix/zabbix_agentd.d/# 修改userparameter_mysql.conf配置文件(其實(shí)只多了一個(gè) HOME=/etc/zabbix)[root@ZabbixClient-01 ~]# sed -i_bak$(date +%Y%m%d) -e s#],#], HOME=/etc/zabbix#g /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf[root@ZabbixClient-01 ~]# systemctl restart zabbix-agent && systemctl restart mysqld

 Zabbix Web設(shè)置,添加MySQL監(jiān)控集。

第二部分: 動(dòng)作觸發(fā)實(shí)現(xiàn)163.com郵箱報(bào)警功能。

 發(fā)送手機(jī)短信獲取163郵箱授權(quán)碼。

Zabbix Web設(shè)置。

qq郵箱,已收到測(cè)試郵件。

創(chuàng)建二級(jí)管理員用戶群組。

 創(chuàng)建二級(jí)管理員用戶。

 創(chuàng)建動(dòng)作觸發(fā)。

ZabbixClient-01測(cè)試停用MySQL服務(wù),驗(yàn)證結(jié)果 。

[root@ZabbixClient-01 ~]# systemctl stop mysqld[root@ZabbixClient-01 ~]# ps -ef | grep mysqldroot      71766   1141  0 11:30 pts/0    00:00:00 grep --color=auto mysqld

 

ZabbixClient-01測(cè)試啟用MySQL服務(wù),驗(yàn)證結(jié)果。

[root@ZabbixClient-01 ~]# systemctl start mysqld[root@ZabbixClient-01 ~]# ps -ef | grep mysqldmysql     96660      1  0 11:58 ?        00:00:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pidroot      96816   1141  0 12:06 pts/0    00:00:00 grep --color=auto mysqld

 

 

第三部分:執(zhí)行預(yù)處理操作。

設(shè)置MySQL告警停用后,自動(dòng)執(zhí)行重啟MySQL操作。

# 增加遠(yuǎn)程執(zhí)行命令操作配置[root@ZabbixClient-01 ~]# sed -i -e $a/EnableRemoteCommands=1/nLogRemoteCommands=1 /etc/zabbix/zabbix_agentd.conf解析:EnableRemoteCommands=1    #允許遠(yuǎn)程執(zhí)行命令   LogRemoteCommands=1      #開啟遠(yuǎn)程執(zhí)行命令操作日志# 配置zabbix客戶端的sudo權(quán)限[root@ZabbixClient-01 ~]# visudo#....# 末行添加以下兩行內(nèi)容# allows zabbix user to restart mysqld without password.zabbix ALL=NOPASSWD:/usr/bin/systemctl restart mysqld

 

至此,已完成所有部署設(shè)置。

********************如果您認(rèn)為這篇文章還不錯(cuò)或者有所收獲,可以點(diǎn)擊右下角的【推薦】/【贊助】按鈕,因?yàn)槟闹С质俏依^續(xù)寫作,分享的最大動(dòng)力!********************

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/123766.html

相關(guān)文章

  • 如何使用 APM 搞定 PHP 應(yīng)用的性能優(yōu)化?

    摘要:究竟是什么很多人都是第一次聽說(shuō)的概念,本文主要闡述如何使用的解決方案來(lái)實(shí)現(xiàn)應(yīng)用性能的優(yōu)化。智能的報(bào)警機(jī)制,在性能瓶頸出現(xiàn)前,修復(fù)性能問(wèn)題,防止性能問(wèn)題導(dǎo)致用戶流失。 APM 究竟是什么? 很多人都是第一次聽說(shuō) APM 的概念,本文主要闡述如何使用 APM 的解決方案來(lái)實(shí)現(xiàn) PHP 應(yīng)用性能的優(yōu)化。首先先介紹一下 APM (Application Performance Manageme...

    sean 評(píng)論0 收藏0
  • 一次 HashSet 所引起的發(fā)問(wèn)題

    摘要:打開郵件一看,果然告知我有一個(gè)應(yīng)用的線程池隊(duì)列達(dá)到閾值觸發(fā)了報(bào)警。線程池的名稱一定得取的有意義,不然是自己給自己增加難度。根據(jù)監(jiān)控將線程池的隊(duì)列大小調(diào)整為一個(gè)具體值,并且要有拒絕策略。 showImg(https://segmentfault.com/img/remote/1460000016944121?w=1920&h=1080); 背景 上午剛到公司,準(zhǔn)備開始一天的摸魚之旅時(shí)突然...

    fjcgreat 評(píng)論0 收藏0
  • 馬蜂窩大交通業(yè)務(wù)監(jiān)控報(bào)警系統(tǒng)架構(gòu)設(shè)計(jì)與實(shí)現(xiàn)

    摘要:為了讓大交通下的各業(yè)務(wù)線都能夠通過(guò)報(bào)警盡早發(fā)現(xiàn)問(wèn)題解決問(wèn)題,進(jìn)而提升業(yè)務(wù)系統(tǒng)的服務(wù)質(zhì)量,我們決定構(gòu)建統(tǒng)一的監(jiān)控報(bào)警系統(tǒng)。本文主要介紹馬蜂窩大交通業(yè)務(wù)監(jiān)控報(bào)警系統(tǒng)的定位整體架構(gòu)設(shè)計(jì),以及我們?cè)诼涞貙?shí)踐過(guò)程中的一些踩坑經(jīng)驗(yàn)。 部門的業(yè)務(wù)線越來(lái)越多,任何一個(gè)線上運(yùn)行的應(yīng)用,都可能因?yàn)楦鞣N各樣的原因出現(xiàn)問(wèn)題:比如業(yè)務(wù)層面,訂單量比上周減少了,流量突然下降了;技術(shù)層面的問(wèn)題,系統(tǒng)出現(xiàn) ERROR...

    smartlion 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<