日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

Linux系统轻量级监控工具monitorix和munin安装

發布時間:2023/11/27 生活经验 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux系统轻量级监控工具monitorix和munin安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

提到監控工具,大家都會想到zabbix等重量級的,這些好是好,但是需要安裝數據庫等等,如果有時候希望簡單點其實可以借助一些輕量級的監控工具,例如monitorix和munin。


需要做點前置工作開啟Nginx和php-fpm的status,因為可以利用監控工具monitorix和munin甚至于zabbix等來監控,要的就是實時的快照數據。


1.開啟Nginx的status


nginx需要重新編譯安裝,關于nginx的安裝可以參考此文:

Linux環境Nginx安裝與調試以及PHP安裝?

# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
# make && make install

查看Nginx是否包含 stub_status 模塊
# /usr/local/nginx/sbin/nginx -V


重新配置Nginx,建議單獨配置一個端口比較好,這樣不影響現有的網站。

	location /nginx-status{stub_status on;access_log off;#allow 127.0.0.1;#deny all;    }

直接可以查看實時的nginx狀態數據


2.開啟php-fpm的status

修改php-fpm的配置文件,將下面這句注釋去掉即可。

; Note: The value must start with a leading slash (/). The value can be
;       anything, but it may not be a good idea to use the .php extension or it
;       may conflict with a real PHP file.
; Default Value: not set 
;pm.status_path = /status
pm.status_path = /status

修改nginx的配置

    location ~ ^/(status|ping)$    {        include fastcgi_params;        fastcgi_pass 127.0.0.1:9000;        fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;    }

最好是結束Nginx的進程而不是reload。

直接可以查看實時的php-fpm進程狀態數據


一.monitorix安裝與使用

monitorix官網:http://www.monitorix.org/downloads.html
# yum install monitorix
# yum install rrdtool rrdtool-perl perl-libwww-perl perl-MailTools perl-MIME-Lite perl-CGI perl-DBI?perl-XML-Simple perl-Config-General perl-HTTP-Server-Simple perl-IO-Socket-SSL

# rpm -ivh http://www.monitorix.org/monitorix-3.8.1-1.noarch.rpm

注意,如果3.8.1不存在說明發布了新版,需要自行去官網找到即可。


修改monitorix配置

#cd /etc/monitorix/

#vim?monitorix.conf

默認的monitorix配置并不符合我們的需求,可以做一些定制。


修改端口

<httpd_builtin>enabled = yhost =port = 8080user = nobodygroup = nobody


啟動nginx監控和process監控

<pre name="code" class="html"><graph_enable>
...nginx		= yprocess		= y


如果有不需要的改為n即可!

前面配置的nginx的status就發揮作用了

<nginx>url = http://localhost:8081/nginx-statusport = 80rule = 24100rigid = 0, 0, 0limit = 100, 100, 100
</nginx>

process只監控我們感興趣的進程

<process><list>0 = nginx,php-fpm,java,redis-server,solr</list>

啟動monitorix

# service monitorix start

重啟monitorix
# service monitorix restart

查看monitorix
http://xxx.xxx.xxx.xxx:端口/monitorix/?

打開了默認的界面,選擇按日,周,月,年進入即可






點擊圖片可以打開大圖片:


處理器的運行信息:



定制化的進程信息:


Nginx的運行信息:


參考:
http://monitorix.jincon.com/doc-redhat.html
http://wuhuizhong.iteye.com/blog/2033096
http://dl528888.blog.51cto.com/2382721/863701


二.munin的安裝

# yum install munin munin-node
# cd /etc/munin/

修改配置

munin.conf是munin服務端(munin master)的配置文件。
去掉路徑配置的注釋即可。除了tmpldir,其它可自行配置。但是tmpldir要配置到munin的HTML模板上,默認是在/etc/munin/templates 下。

dbdir	/var/lib/munin
htmldir /var/www/html/munin
logdir /var/log/munin
rundir  /var/run/munin# Where to look for the HTML templates
#
tmpldir	/etc/munin/templates


localhost.localdomain節點是用于配置需要監控的目標機器的。默認會配置本機127.0.0.1。可新增需要監控的機器。可以增加多臺機器,只要目標機器安裝了munin-node就可以。

# a simple host tree
[localhost]address 127.0.0.1use_node_name yes


啟動服務

# service munin-node start


在munin.conf 配置文件里面指定了生成的監控的html監控結果"htmldir"/var/cache/munin/www”。
需要配置好nginx指向/var/cache/munin/www即可。生成的html都是靜態文件。


在瀏覽器查看圖形化的監控信息


參考:

http://www.freehao123.com/munin/
http://www.cnblogs.com/rond/p/3757804.html

總結

以上是生活随笔為你收集整理的Linux系统轻量级监控工具monitorix和munin安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。