| Line | |
|---|
| 1 |
<module> |
|---|
| 2 |
<name>postgres</name> |
|---|
| 3 |
<description><para>The postgres module allows queries to be performaed against targets as checks. The results of the query are used as metrics.</para> |
|---|
| 4 |
</description> |
|---|
| 5 |
<loader>C</loader> |
|---|
| 6 |
<image>postgres.so</image> |
|---|
| 7 |
<moduleconfig /> |
|---|
| 8 |
<checkconfig> |
|---|
| 9 |
<parameter name="dsn" |
|---|
| 10 |
required="required" |
|---|
| 11 |
allowed=".+">The connect string for PostgreSQL. The syntax of this string is documented in your PostgreSQL documentation. See <ulink url="http://www.postgresql.org/docs/8.3/static/libpq-connect.html"><citetitle>Database Connection Control Functions</citetitle></ulink>.</parameter> |
|---|
| 12 |
<parameter name="sql" |
|---|
| 13 |
required="required" |
|---|
| 14 |
allowed=".+">The query that will be executed.</parameter> |
|---|
| 15 |
</checkconfig> |
|---|
| 16 |
<examples> |
|---|
| 17 |
<example> |
|---|
| 18 |
<title>Tracking PostgreSQL database sizes.</title> |
|---|
| 19 |
<para>This will track the sizes of all databases on 10.225.209.35 and 10.225.209.56. We will connect to the postgres database as the user "noit" with password "noit." We only run this check every 5 minutes.</para> |
|---|
| 20 |
<programlisting><![CDATA[ |
|---|
| 21 |
<noit> |
|---|
| 22 |
<modules> |
|---|
| 23 |
<module image="postgres" name="postgres"/> |
|---|
| 24 |
</modules> |
|---|
| 25 |
<checks> |
|---|
| 26 |
<databases> |
|---|
| 27 |
<postgres module="postgres" period="300000"> |
|---|
| 28 |
<config> |
|---|
| 29 |
<dsn>host=%[target] dbname=%[name] user=noit password=noit</dsn> |
|---|
| 30 |
<sql>select datname, pg_database_size(datname) as size, xact_commit, xact_rollback from pg_stat_database</sql> |
|---|
| 31 |
</config> |
|---|
| 32 |
<check uuid="8c5ca46c-77d7-11dd-ab5b-53bc659517d6" target="10.225.209.35"/> |
|---|
| 33 |
<check uuid="90b8aea2-77d7-11dd-8447-0f381e6a48eb" target="10.225.209.56"/> |
|---|
| 34 |
</postgres> |
|---|
| 35 |
</databases> |
|---|
| 36 |
</checks> |
|---|
| 37 |
</noit> |
|---|
| 38 |
]]></programlisting> |
|---|
| 39 |
</example> |
|---|
| 40 |
</examples> |
|---|
| 41 |
</module> |
|---|