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