| 1 |
<module> |
|---|
| 2 |
<name>postgres_ingestor</name> |
|---|
| 3 |
<description><para>This module imports noitd data into postgres.</para></description> |
|---|
| 4 |
<loader>C</loader> |
|---|
| 5 |
<image>postgres_ingestor.so</image> |
|---|
| 6 |
<moduleconfig> |
|---|
| 7 |
</moduleconfig> |
|---|
| 8 |
<checkconfig /> |
|---|
| 9 |
<examples> |
|---|
| 10 |
<example> |
|---|
| 11 |
<title>Using the postgres_ingestor.</title> |
|---|
| 12 |
<para>This example loads the postgres_ingestor and configures it.</para> |
|---|
| 13 |
<programlisting><![CDATA[ |
|---|
| 14 |
<stratcon> |
|---|
| 15 |
<modules> |
|---|
| 16 |
<module image="postgres_ingestor" name="postgres_ingestor" /> |
|---|
| 17 |
</modules> |
|---|
| 18 |
<database> |
|---|
| 19 |
<journal> |
|---|
| 20 |
<path>/var/log/stratcon.persist</path> |
|---|
| 21 |
</journal> |
|---|
| 22 |
<dbconfig> |
|---|
| 23 |
<host>db1</host> |
|---|
| 24 |
<dbname>reconnoiter</dbname> |
|---|
| 25 |
<user>stratcon</user> |
|---|
| 26 |
<password>unguessable</password> |
|---|
| 27 |
</dbconfig> |
|---|
| 28 |
<statements> |
|---|
| 29 |
<!-- These are optional and used for stuff like setting search paths --> |
|---|
| 30 |
<!-- |
|---|
| 31 |
<metanodepostconnect> |
|---|
| 32 |
SELECT do_some_magic(); |
|---|
| 33 |
</metanodepostconnect> |
|---|
| 34 |
<storagepostconnect> |
|---|
| 35 |
SELECT do_some_magic($1,$2); |
|---|
| 36 |
</storagepostconnect> |
|---|
| 37 |
--> |
|---|
| 38 |
<allchecks> |
|---|
| 39 |
SELECT remote_address, id, target, module, name |
|---|
| 40 |
FROM check_currently |
|---|
| 41 |
</allchecks> |
|---|
| 42 |
<findcheck> |
|---|
| 43 |
SELECT remote_address, id, target, module, name |
|---|
| 44 |
FROM check_currently |
|---|
| 45 |
WHERE sid = $1 |
|---|
| 46 |
</findcheck> |
|---|
| 47 |
<allstoragenodes> |
|---|
| 48 |
SELECT storage_node_id, fqdn, dsn |
|---|
| 49 |
FROM stratcon.storage_node |
|---|
| 50 |
</allstoragenodes> |
|---|
| 51 |
<findstoragenode> |
|---|
| 52 |
SELECT fqdn, dsn |
|---|
| 53 |
FROM stratcon.storage_node |
|---|
| 54 |
WHERE storage_node_id = $1 |
|---|
| 55 |
</findstoragenode> |
|---|
| 56 |
<mapallchecks> |
|---|
| 57 |
SELECT id, sid, noit as remote_cn, storage_node_id, fqdn, dsn |
|---|
| 58 |
FROM stratcon.map_uuid_to_sid LEFT JOIN stratcon.storage_node USING (storage_node_id) |
|---|
| 59 |
</mapallchecks> |
|---|
| 60 |
<mapchecktostoragenode> |
|---|
| 61 |
SELECT o_storage_node_id as storage_node_id, o_sid as sid, |
|---|
| 62 |
o_fqdn as fqdn, o_dsn as dsn, o_noit as remote_cn |
|---|
| 63 |
FROM stratcon.map_uuid_to_sid($1,$2) |
|---|
| 64 |
</mapchecktostoragenode> |
|---|
| 65 |
<check> |
|---|
| 66 |
INSERT INTO check_archive_%Y%m%d |
|---|
| 67 |
(remote_address, whence, sid, id, target, module, name) |
|---|
| 68 |
VALUES ($1, 'epoch'::timestamptz + ($2 || ' seconds')::interval, |
|---|
| 69 |
$3, $4, $5, $6, $7) |
|---|
| 70 |
</check> |
|---|
| 71 |
<status> |
|---|
| 72 |
INSERT INTO check_status_archive_%Y%m%d |
|---|
| 73 |
(whence, sid, state, availability, duration, status) |
|---|
| 74 |
VALUES ('epoch'::timestamptz + ($1 || ' seconds')::interval, |
|---|
| 75 |
$2, $3, $4, $5, $6) |
|---|
| 76 |
</status> |
|---|
| 77 |
<metric_numeric> |
|---|
| 78 |
INSERT INTO metric_numeric_archive_%Y%m%d |
|---|
| 79 |
(whence, sid, name, value) |
|---|
| 80 |
VALUES ('epoch'::timestamptz + ($1 || ' seconds')::interval, |
|---|
| 81 |
$2, $3, $4) |
|---|
| 82 |
</metric_numeric> |
|---|
| 83 |
<metric_text> |
|---|
| 84 |
INSERT INTO metric_text_archive_%Y%m%d |
|---|
| 85 |
( whence, sid, name,value) |
|---|
| 86 |
VALUES ('epoch'::timestamptz + ($1 || ' seconds')::interval, |
|---|
| 87 |
$2, $3, $4) |
|---|
| 88 |
</metric_text> |
|---|
| 89 |
<config> |
|---|
| 90 |
SELECT stratcon.update_config |
|---|
| 91 |
($1, $2, $3, |
|---|
| 92 |
'epoch'::timestamptz + ($4 || ' seconds')::interval, |
|---|
| 93 |
$5) |
|---|
| 94 |
</config> |
|---|
| 95 |
<findconfig> |
|---|
| 96 |
SELECT config FROM stratcon.current_node_config WHERE remote_cn = $1 |
|---|
| 97 |
</findconfig> |
|---|
| 98 |
</statements> |
|---|
| 99 |
</database> |
|---|
| 100 |
</stratcon> |
|---|
| 101 |
]]></programlisting> |
|---|
| 102 |
</example> |
|---|
| 103 |
</examples> |
|---|
| 104 |
</module> |
|---|