Plugins 〉vertica-datasource
The vertica-datasource plugin has been deprecated and is no longer maintained.
vertica-datasource
Vertica Grafana Data Source
Grafana plugin for Vertica DB.
New data source that communicates with Vertica using the Vertica golang driver. [http://github.com/vertica/vertica-sql-go].
This plugin is a backend data source plugin.
Using the plugin
Installation
grafana-cli plugins install rajsameer-vertica-datasource
Creating data source connection
- Add Data source.
- Name: Data source name
- Host: Ip and port of vertica data base , example: vertica-ip:vertica-port
- Database: Database name
- User: User name of vertica database.
Note: Use a user name with less privileges. This data source does not prevent user from executing DELETE or DROP commands. - Password: password for vertica Database.
- SSL Mode: This states how the plugin will connect to the database.Options supported are as below:
1. "none" 2. "server" 3. "server-string". - Use Prepared Statement: If unchecked, query arguments will be interpolated into the query on the client side. If checked, query arguments will be bound on the server.
- Use Connection Load balancing: If checked the query will be distributed to vertica nodes.
- Set Max Open Connection, Ideal Connections and Max connection ideal time
- Save and test the data source. To test the connectivity "select version()" query is executed against the database.
Querying data.
Queried data is returned to Grafana in data-frame format.
To lean more about data-frames please refer. https://grafana.com/docs/grafana/latest/developers/plugins/data-frames/#data-frames
- Time series queries
Query type's supported are Time Series and Table. Query Type can be changed using the drop down in the query editor.
Example: Time Series Query
SELECT
time_slice(end_time, $__interval_ms, 'ms', 'end') as time ,
node_name,
avg(average_cpu_usage_percent)
FROM
v_monitor.cpu_usage
WHERE
end_time > TO_TIMESTAMP($__from/1000) and end_time < TO_TIMESTAMP($__to/1000)
GROUP BY 1, 2
ORDER BY 1 asc
No macros are used in the data source. Instead grafana global variables are used.
Example: "time_slice(end_time, $__interval_ms, 'ms', 'end') as time" following statement helps the quey to honor the interval of visualization. $__interval_ms is a grafana global variables.
Time filter:
Example: "end_time > TO_TIMESTAMP($__from/1000) and end_time < TO_TIMESTAMP($__to/1000)" this convert the the global $__from and $__to variables from grafana, to a timestamp format for vertica.
Table Query
SELECT
time_slice(end_time, $__interval_ms, 'ms', 'end') as time ,
node_name,
avg(average_cpu_usage_percent)
FROM
v_monitor.cpu_usage
WHERE
end_time > TO_TIMESTAMP($__from/1000) and end_time < TO_TIMESTAMP($__to/1000)
GROUP BY 1, 2
ORDER BY 1 asc
Choose Query Type as Table
Variables:
Variables can be easily defined as sql queries, the only restriction is query should return at least one column with "_text" name. If the query has two columns "_text" and "_value", _text would be used as the display value and _value would be applied to filter.
Example:
Query:
select distinct node_name as '_text' from v_monitor.cpu_usage
Usage: Grafana [Advanced formatting options]https://grafana.com/docs/grafana/latest/variables/advanced-variable-format-options/. In this example we create a multi select variable of node name , use ${node:sqlstring} for template in the query.
Annotations
Annotations are supported from grafana 7.2+
To use annotations, write any query which will return time, timeEnd, text, title and tags column as shown in the image.
Streaming (new) (beta)
Added support for streaming
Example Query
SELECT
end_time as time ,
avg(average_cpu_usage_percent)
FROM
v_monitor.cpu_usage
WHERE
end_time > TIMESTAMPADD(MINUTE, -1 , CURRENT_TIMESTAMP)
GROUP BY 1
ORDER BY 1 asc
This will get the latest data from the data base and keep appending the samples.
Time gap filling (new) (beta)
SQL data can return data which do not have sample for the entire time range , e.g. you could have gaps in the data.
This feature provide three modes which will add the missing time rows with either null , static, previous values.
Two modes are static , null and previous.
SQL syntax highlighting (new) (beta)
SQL syntax highlighting added using CodeMirror library. In future would add auto complete and formatting.
Debugging
You can debug the backed code using dlv. In order to debug the code.
- Compile the backend code with debug options.
mage -v debugger
- Restart grafana server
systemctl restart grafana-server
- Get the pid of the plugin process
pgrep vertica
- Use the pid from 3 step and use it in the below statement to start debugger
dlv attach <"pid from step 3"> --headless --listen=:3222 --api-version 2 --log
- Now you can use the vscode and debug option , configuration debugging is present in launch.json
Development
Prerequisite
- Node JS 14+
- Go version 1.14+
- yarn
Install
yarn install
Build
- Frontend
yarn build
- Backend mage -v
mage -v
Testing
sudo docker-compose up
This will run a local vertica and grafana instance.
A data source and data source will already be provisioned.
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
.h4 . .mb-0 }
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Installing vertica-datasource on Grafana Cloud:
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
For more information, visit the docs on plugin installation.
Installing on a local Grafana:
For local instances, plugins are installed and updated via a simple CLI command. Plugins are not updated automatically, however you will be notified when updates are available right within your Grafana.
1. Install the Data Source
Use the grafana-cli tool to install vertica-datasource from the commandline:
grafana-cli plugins install
The plugin will be installed into your grafana plugins directory; the default is /var/lib/grafana/plugins. More information on the cli tool.
Alternatively, you can manually download the .zip file for your architecture below and unpack it into your grafana plugins directory.
Alternatively, you can manually download the .zip file and unpack it into your grafana plugins directory.
2. Configure the Data Source
Accessed from the Grafana main menu, newly installed data sources can be added immediately within the Data Sources section.
Next, click the Add data source button in the upper right. The data source will be available for selection in the Type select box.
To see a list of installed data sources, click the Plugins item in the main menu. Both core data sources and installed data sources will appear.
Changelog
1.0.0 (Unreleased)
Initial release.