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.
分享到:
相关推荐
python库。 资源全名:munin-influxdb-1.2.0a.tar.gz
基于munin的主机监控解决方案.doc
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
资源分类: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 。请以后使用该位置。...
muninn-源码.rar
资源分类: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 目录必须可由您的 ...
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...
将以/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_...
Ansible-ansible-role-munin-node.zip,ansible role-munin nodeansible role:munin节点,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
以下将启动munin-node并为192.168.254.13自动配置SNMP插件,还将在端口12345处公开munin-node。 SNMP_ARGS在论证通过了--snmp当munin-node-configure是在运行容器调用。 docker run -e 'SNMP_ARGS=192.168.254.13' ...
Ansible-ansible-role-munin.zip,责任角色-责任角色:munin,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
munin-plugin-condor condor 的各种 munin 插件要安装,git clone 这个项目并在 /etc/munin/plugins 中创建符号链接到 git 根目录内的各种插件脚本(如 condor_schedd)。 安装插件后,您需要重新加载您的 munin-...