The goal of this article is to get fairly nice looking graphs of Phusion Passenger’s performance and memory metrics:
This specific setup focuses on CentOS (on cPanel none the less) – but instructions should apply for most linux distros. It assumes you already have Passenger and Munin successfully setup. See my previous article on getting Phusion Passenger setup if you have not already.
First we need to allow the munin user sudo privileges for a few passenger related commands:
$ sudo /usr/sbin/visudo
# Add the following line to the file
munin ALL=(ALL) NOPASSWD:/usr/bin/passenger-status, /usr/bin/passenger-memory-stats
# Depending on your setup, you may also have to comment out the following line:
Defaults requiretty
If you see the error sorry, you must have a tty to run sudo in /var/log/munin/munin-node.log, comment out the final line shown above.
The following two files will glean some performance and memory statistics.
Passenger Status:
sudo vi /usr/share/munin/plugins/passenger_status
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category App
graph_title passenger status
graph_vlabel count
sessions.label sessions
max.label max processes
running.label running processes
active.label active processes
END
exit 0
end
def output_values
status = `sudo /usr/bin/passenger-status`
unless $?.success?
$stderr.puts "failed executing passenger-status"
exit 1
end
status =~ /max\s+=\s+(\d+)/
puts "max.value #{$1}"
status =~ /count\s+=\s+(\d+)/
puts "running.value #{$1}"
status =~ /active\s+=\s+(\d+)/
puts "active.value #{$1}"
total_sessions = 0
status.scan(/Sessions: (\d+)/).flatten.each { |count| total_sessions += count.to_i }
puts "sessions.value #{total_sessions}"
end
if ARGV[0] == "config"
output_config
else
output_values
end
Memory Stats:
sudo vi /usr/share/munin/plugins/passenger_memory_status
#!/usr/bin/env ruby
# put in /etc/munin/plugins and restart munin-node
# by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin
# NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats
def output_config
puts <<-END
graph_category App
graph_title Passenger memory stats
graph_vlabel count
memory.label memory
END
exit 0
end
def output_values
status = `sudo /usr/bin/passenger-memory-stats | tail -1`
unless $?.success?
$stderr.puts "failed executing passenger-memory-stats"
exit 1
end
status =~ /(\d+\.\d+)/
puts "memory.value #{$1}"
end
if ARGV[0] == "config"
output_config
else
output_values
end
Now we will link these to the active plugins, and make them executable:
sudo chmod +x /usr/share/munin/plugins/passenger_status
sudo chmod +x /usr/share/munin/plugins/passenger_memory_status
sudo ln -s /usr/share/munin/plugins/passenger_status /etc/munin/plugins/passenger_status
sudo ln -s /usr/share/munin/plugins/passenger_memory_status /etc/munin/plugins/passenger_memory_status
Last thing we need to do is make sure those scripts run as the munin user:
sudo vi /etc/munin/plugin-conf.d/munin-node
[passenger_*]
user munin
command ruby %c
Restart the munin node, and wait and you should see the graphs start to propagate.
sudo /etc/init.d/munin-node restart
For even more detailed performance analytics, checkout NewRelic monitoring. And thanks to Dan Mange for the munin scripts.
分享到:
相关推荐
这个库版本为1.2.0a,它提供了便利的接口,使得用户能够轻松地将Munin收集的监控数据迁移到InfluxDB,以便进行更高效的数据分析和可视化。 Munin是一款开源的网络和系统监控工具,它能够定期收集各种系统性能数据,...
munin-influxdb, Munin到 influxdb/grafana网关 munin-influxdbMunin 至 InfluxDB Grafana gateway从 Munin ( RRD ) 迁移到InfluxDB和Grafana仪表板的工具。提供两个命令:导入将现有的Munin数据导入
php5-fpm-munin-plugins, Munin FPM的一组插件 安装在Ubuntu上的插件:cd/usr/share/munin/pluginsgit clone git://github.com/tjstein/php5-fpm-munin-plugins.gitchmod x
- 分别加载**muninn_EISP_boot_02_09.bin**、**rom_emmc_boot.bin**、**muninn_EISP_user_03_02.bin**以及**mboot.bin**到相应的文件路径框中。 5. **开始升级**: - 再次转回“Auto”页面。 - 点击“Connect”...
资源分类:Python库 所属语言:Python 资源全名:munin.async-0.4.zip 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
munstrap, 在 Twitter Bootstrap 上,基于其他 Munin 2.x 模板 Munstrap基于 Twitter Bootstrap 3的可选 Munin 2.x 模板。从 2015年02月 开始,Munstrap模板已经添加到 munin监视/contrib repo 。请以后使用该位置。...
资源分类:Python库 所属语言:Python 资源全名:tele_muninn-0.0.2-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
munin_postgresql_table_stats 基于每个表的 postgresql munin 脚本 如果您链接 postgres_setup_db_[database] 它将为数据库中的每个普通表设置选择和插入 munin 图,但是 /etc/munin/plugins 目录必须可由您的 ...
muninn 是一个开源项目,其源码以 `.rar` 形式提供,表明这可能是一个用C++或类似的编译型语言编写的软件。虽然标签没有给出具体信息,但我们可以根据"源码"这一关键词推测这与软件开发、编程、系统理解和学习相关。...
ansible-munin-node 安装和维护Munin Node的角色 角色变量 该剧本不需要特殊配置,但提供了很多选项。 默认值: munin_node_packages: - munin-node - munin-plugins-extra - git munin_node_extra_plugins: ...
Munin 导出器的积极开发版本是 。 munin_exporter munin 导出器是一个守护进程,通过 HTTP/JSON 为 Prometheus 消费提供 munin 指标。 入门 源代码定期编入索引: 。 所有核心开发人员都可以通过访问。 测试
ln -s /usr/share/munin/plugins/httping_ /etc/munin/plugins/httping_localhost /etc/munin/plugin-conf.d/munin-node ,在底部添加 [httping_localhost] env.URL http://localhost/ env.COUNT 5 env.connect...
在这个名为"Ansible-ansible-role-munin.zip"的压缩包中,我们看到的是Ansible对Munin监控系统的集成和配置。 Munin是一款开源的网络和系统监控工具,它能够实时监控服务器资源,包括CPU使用率、内存消耗、磁盘I/O...
将以/etc/munin/plugin-conf.d/munin-node添加到munin-node文件中,该文件通常在/etc/munin/plugin-conf.d/munin-node找到。 [php_opcache_*] user root env.URL http://www.example.com/php_opcache.php (URL的...
Munin的新网站是使用Jekyll构建的。 以下是对贡献者/好奇者的一些补充说明: 当地发展环境 要安装依赖项,请阅读。 完成后,您将可以使用bundle exec jekyll serve本地运行该项目。 然后,您可以打开自己喜欢的...
发送nasune磁盘空间、状态、程序心情、Zabbix模板、Munin插件的脚本。 ./zabbix/nasne_hdd_zabbix.pl ... 发送nasune磁盘空间到Zabbix Server的脚本 ./zabbix/nasne_status_zabbix.pl ... 发送./zabbix/nasne_...
主配置文件解析 - /etc/munin/munin.conf 这个文件是munin的核心配置文件,用于定义监控节点和相关参数。默认配置往往能满足基本需求,但为了更精细的控制,可能需要进行以下编辑: - **分组域名**:根据实际需求...
**Node.js-Munin-moe:可定制化的Munin监控面板详解** Munin-moe 是一个基于Node.js开发的、高度可定制化的Munin监控面板。它旨在为用户提供更加灵活和个性化的监控视图,以满足不同场景下的系统监控需求。本文将...