summaryrefslogtreecommitdiff
path: root/docs/Sources.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/Sources.md')
-rw-r--r--docs/Sources.md36
1 files changed, 33 insertions, 3 deletions
diff --git a/docs/Sources.md b/docs/Sources.md
index 4121c89..0a6d1d7 100644
--- a/docs/Sources.md
+++ b/docs/Sources.md
@@ -61,8 +61,8 @@ source:
default: sql
sql:
adapter: sqlite
- database: "/var/lib/oxidized/devices.db"
- table: devices
+ database: "/var/lib/oxidized/nodes.db"
+ table: nodes
map:
name: fqdn
model: model
@@ -72,6 +72,36 @@ source:
enable: enable
```
+### Custom SQL Query Support
+
+You may also implement a custom SQL query to retreive the nodelist using SQL syntax with the `query:` configuration parameter under the `sql:` stanza.
+
+
+#### Custom SQL Query Examples
+
+You may have a table named `nodes` which contains a boolean to indicate if the nodes should be enabled (fetched via oxidized). This can be used in the custom SQL query to avoid fetching from known impacted nodes.
+
+In your configuration, you would add the `query:` parameter and specify the SQL query. Make sure to put this within the `sql:` configuration section.
+
+```sql
+query: "SELECT * FROM nodes WHERE enabled = True"
+```
+
+Since this is an SQL query, you can also provide a more advanced query to assist in more complicated oxidized deployments. The exact deployment is up to you on how you design your database and oxidized fetchers.
+
+In this example we limit the nodes to two "POPs" of `mypop1` and `mypop2`. We also require the nodes to have the `enabled` boolean set to `True`.
+
+```sql
+query: "SELECT * FROM nodes WHERE pop IN ('mypop1','mypop2') AND enabled = True"
+```
+The order of the nodes returned will influence the order that nodes are fetched by oxidized. You can use standard SQL `ORDER BY` clauses to influence the node order.
+
+You should always test your SQL query before using it in the oxidized configuration as there is no syntax or error checking performed before sending it to the database engine.
+
+Consult your database documentation for more information on query language and table optimization.
+
+
+
### Source: HTTP
One object per device.
@@ -107,4 +137,4 @@ source:
url: https://url/api
scheme: https
secure: false
-``` \ No newline at end of file
+```