The Agent can be operated in two modes:
-
Automated sync from the UI: Datasources and Queries can be set directly via our UI in the cloud. The agent establishes connectivity to our servers upon startup (by default) and will immediately pull configuration and execute queries immediately or on a schedule. Includes support for previewing query results directly from the UI.
-
StandAlone: If you do not wish to use the UI to manage the datasource and query configurations, they can be directly added to the Agent. In this mode, datasources and queries are self-contained within the agent, where the UI has no knowledge of the datasources and the queries - only the results of query executions are sent to Cloud9 Charts.
UI To Agent Sync
The following example uses UI-to-Agent sync to configure and execute queries against your datasource inside the network.
- Select Datasources from Queries left menu option and select a datasource.
-
Specify Datasource parameters: a. Enter Database connectivity parameters that the agent will use to connect against. b. Check the Internal Datasource checkbox to assign it to the agent. c. Click Save.
This will be synced by the Agent immediately.
- Specify a query and select preview. This will be synced by the agent real-time to display the results.
- Save (with or without schedule) to save, then add it to the dashboard.
StandAlone
Notes:
-
File names that start with datasource in the config directory are treated as a datasource configuration. Similarly, filenames that start with query in the config directory are treated as a query configuration.
-
Datasource or Query Files placed in the config directory are automatically picked up - No restart necessary.
-
The examples directory contains datasource and query examples against various datasources. Move appropriate files to the config directory (datasource_XXX.json files first if the Agent is running).
Example datasource config:
[
{
"name":"demoMySQL",
"url":"localhost:3306/test",
"datasource":"mysql",
"userId":"userA",
"password":"passA"
},
{
"name":"demoMongo",
"url":"dharma.mongohq.com:10071/mongoA",
"datasource":"mongo",
"userId":"mongoA",
"password":"mongoPassA"
}
]
There are two databases configured above: One pointing to MySQL and another to MongoDB.
Example Query config:
[
{
"entityName":"Weekly Sent By Message Type",
"dsName":"demoMySQL",
"queryStr":"select sum(sent) as Total Sent, message_type,Week from demo_sent group by message_type,week order by week asc",
"overrideVals":{
"replaceAll":true
}
},
{
"entityName":"Page Hits Over Time",
"dsName":"demoMongo",
"queryStr":"db.pagehits.find({hits: { $gte: 1}})",
"c9QLFilter":"select date(lastAccessTime) as Date, count(*) as Page Hits group by date(lastAccessTime) order by Date asc",
"frequencyType":"daily",
"frequency":1,
"startTime": "04:00",
"overrideVals":{
"replaceValuesForKey":["Date"]
}
}
]