munin-monitoring/munin — pull request #73 by gaelL (2013-02-05 21:45:09+00:00)
Title: Customize graph title for several postgres_* plugins

If you setup several postgres plugins like :
```
postgres_pg91_size_mydb
postgres_pg92_size_mydb
```
Your graph title display the same title for both :
```
munin-run postgres_pg91_size_mydb config | grep graph_title
graph_title PostgreSQL database size (mydb)
munin-run postgres_pg92_size_mydb config | grep graph_title
graph_title PostgreSQL database size (mydb)
```

I propose a change in pgpsql.pm to take a environment variable in the graph title.
Example in the munin-node conf:
```
[postgres_pg91_ *]
env.PGNAME Pg 9.1
[postgres_pg92_ *]
env.PGNAME Pg 9.2
```

After that you have a different graph title for each plugin :
```
munin-run postgres_pg91_size_mydb config | grep graph_title
graph_title PostgreSQL database size Pg 9.1 (mydb)
munin-run postgres_pg92_size_mydb config | grep graph_title
graph_title PostgreSQL database size Pg 9.2 (mydb)
```

I have also tested with different configuration and without PGNAME defined :
```
munin-run postgres_pg91_size_mydb config | grep graph_title
graph_title PostgreSQL database size (mydb)
```

By default this patch change nothing for plugins already installed and running. But if user want customize graph_title they can use the new environment variable.

![munin_postgres](https://f.cloud.github.com/assets/2479183/129423/0a833e8a-6fdd-11e2-9ee0-18c279a5bd4d.png)