summaryrefslogtreecommitdiff
path: root/docs/Sources.md
diff options
context:
space:
mode:
authorJason Ackley <jason@ackley.net>2017-11-18 03:57:16 -0600
committerNeil Lathwood <neil@lathwood.co.uk>2017-11-18 09:57:16 +0000
commit77e5c874896e8f17aa32fa40b96196a8d2932ff5 (patch)
tree27e868e4f0da6e65bc8da3c9b22e7c6e416c9ce2 /docs/Sources.md
parent40cfa7b7cfba0d0a655fe2148ad9336414e89737 (diff)
docs: Misc Doc updates (#1107)
* Move VRP-Huawei.md to new Model-Notes subdir * Update Sources.md with a few improvements: 1. Sync the example table name between the MySQL and SQLite example configs for consistency. 2. Document the very useful custom SQL query parameter (query:) including a couple of examples. * Basic README.md for Model-Notes directory with a simple table for notes/caveats * Markdown quote the Huawei config blocks and link back to README.md * Update Sources.md
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
+```