aouyar / PyMunin

Python Module for developing Munin Multigraph Monitoring Plugins. Multigraph Plugins for Apache Web Server, Apache Tomcat, APC PHP Cache, PHP FPM (Fast Process Manager), Asterisk, FreeSWITCH, Lighttpd, Memcached, MySQL Database, Nginx, NTP, PostgreSQL Database, CPU Utilization, Memory Utilization, Disk Usage, Disk I/O, Network Interfaces, Network Connections, Processes and Threads, etc.

Home Page:http://aouyar.github.io/PyMunin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Monitor 2 or more postgresql instances on one node

clickfreak opened this issue · comments

add the ability to monitor 2 or more postgresql instances on one node.

For example, add new environment var for name of instance (or cluster in debian terms) and use it for graphs names

Hi,

The plugin initialization has to occur once for each instance (a new connection has to be established, the list of databases populated), so it seems that it is reasonable to run the plugin once for each instance. In Munin, the only way I know of for running a plugin multiple times is to create a symbolic link with a different name for each instance.So technically it would not be difficult to archive monitoring multiple instances on one node; just create multiple symlinks to the plugin with different names and associate them with different plugin configuration.

Example:
pgstats_inst1 -> /usr/share/munin/plugins/pgstats
pgstats_inst2 -> /usr/share/munin/plugins/pgstats
pgstats_inst3 -> /usr/share/munin/plugins/pgstats

And in the configuration files put something like:

[pgstats_*]

[pgstats_inst1]

[pgstats_inst2]

[pgstats_inst3]

All this could be achieved without any changes to the code, but then I think the names graphs in multigraph plugins must not clash and the graph images should embed the instance name to help differentiate the graphs for the different instances, and I would have to make sure this does not cause problems with the graph include / exclude code.

I would prefer to implement the multi-instance functionality not in the PostgreSQL plugin, but in the Plugin Framework, so that all plugins could automatically support multiple instances. In conclusion, I think it can be done, and I would like to do it, but it is a significant change in the core, so I would have to take it slowly.

Thanks for the suggestion,
Ali

Just implemented the Multi-instance Functionality in the PyMunin Framework and activated support for monitoring multiple PostgreSQL Instances in the pgstats plugin:

http://aouyar.github.com/PyMunin/2012/09/07/PyMunin-Multi-Instance_Plugin_Support_in_Core.html
http://aouyar.github.com/PyMunin/#configuration

The multi-instance functionality is still lacking field testing; any feedback would be highly appreciated.