collectd 检测cpu使用率
环境配置
1. install epel
https://www.cyberciti.biz/faq/installing-rhel-epel-repo-on-centos-redhat-7-x/
2. Graphing your system performance in Linux with collectd
https://www.theurbanpenguin.com/graphing-your-system-performance-in-linux-with-collectd/
3. 选择前端(参考后面的列表)
CGP https://github.com/pommi/CGP CGP提供支持nginx配置。
nginx配置在16.04上启用了php7.0-fpm
location ~ \.php$ { try_files $uri =404; # fastcgi_pass unix:/run/php5-fpm.sock; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # Disallow access to hidden files and directories (such as .git/) location ~ /\. { deny all; }
Collectd-Web https://www.tecmint.com/install-collectd-and-collectd-web-to-monitor-server-resources-in-linux/
4. 这里有一个综合的安装介绍: 使用的前端是 Collection3, 推荐使用CGP
https://fishilico.github.io/generic-config/etc-server/web/collectd.html
进阶
1. 为collectd 增加一个python的plugin来监控cpu 使用率
https://blog.csdn.net/ffeiffei/article/details/50670411
2. How to Write a Collectd Plugin with Python
https://www.tuicool.com/articles/niiIFra
3. shell plugin
http://blog.kankanan.com/article/4f7f7528-collectd-8fdb884c670d52a176d163a7.html
List of front-ends
The following is a list of front-ends to the data collected by collectd.
Name | Type | Framework | Engine | Flush |
---|---|---|---|---|
Collectd Graph Panel | Web-based | PHP | RRDtool | Yes |
Collectd Graph Z | Web-based | PHP (based on CGP) | RRDtool | Yes |
Collectd-web | Web-based | CGI | RRDtool | No |
CollectGraph | Web-based | MoinMoin wiki | unknown | unknown |
Collection 3 | Web-based | CGI | RRDtool | Yes |
Collection 4 | Web-based | FastCGI | gRaphaël, RRDtool | No |
Collectd-carbon | Web-based | Django | Graphite/Carbon | No |
collectw | Web-based | FastCGI | gRaphaël | No |
EcoStats | Web-based | CGI | RRDtool | No |
Facette | Web-based | Go http package | HighCharts | Yes |
Heymon | Web-based | Ruby on Rails | RRDtool | No |
Jarmon | Web-based | jQuery, Javascript RRD, Flowplayer Tools, (Twisted) | Flot | No |
kcollectd | Stand-alone | KDE | Qt | No |
Observium | Web-based | PHP | RRDtool | Yes |
PerfWatcher | Web-based | PHP | RRDtool | Yes |
Visage | Web-based | Ruby + Sinatra, MooTools | HighCharts (SVG) | No |
Vizir | Web-based | Ruby on Rails | Rickshaw/D3js | Yes |
Sick Muse | Web-based | Python, jQuery, Backbone.js | Flot | unknown |
RRDscout | Web-based | Python, Flask | RRDtool | unknown |