Our agent ships with built-in support for OpenStack, Ceph, containers platforms and more but Sentinel.la is extensible, you can build custom integrations with a few lines. If we don’t have a plugin available for what you’d like to monitor, you can write your own plugin. These are simple python files. If you can collect a metric therefore you can send it to Sentinel.la to be monitored.
You need a Sentinel.la account to create a plugin. If you dont have an account, signup here. Once you are logged in, follow the steps above:
You need complete the form in https://app.sentinel.la/#/app/plugins to register your plugin to obtain a valid plugin key. Look for the button above:
You need to provide the next information:
After completing the form and submitting it, your plugin will have assigned a plugin key that looks like this:
904605aa- E577-4f66-88c5-4de907535072.
This plugin key must be included in your code to Sentinel.la engine validates your request.
After you have a registered plugin, you will need download Plugin Template that is a Sentinel.la plugin template so you can use it to write you code and collect metrics from the service you specify and send them to Sentinel.la
The next step is start to build your plugin!
Correct plugin structure to Sentinella, example:
Look unde myplugin.conf under the following structure to set your plugin key:
plugin-one/conf/plugin-one.conf: #This is an example, use your custom vars, plugin_key is required { "foo": { "var": "example", "var2": "1" }, "bar": 9797, "plugin_key": UUID #Provided by sentinel.la }
IMPORTANT : myplugin.conf must have a valid json format, delete all the comments in this file.
Now you can write your custom logic to obtain your metrics. You can rename the directory and files just be aware to provide the correct path in the sentinella config. That configurations is reviewed ahead. To send metrics to sentinel.la just look at the example under the following structure:
plugin-one/pluginone.py: # [START] To be completed with plugin code # Here goes your logic """ Add dict into list plugins: value : Metric value type : String row_name: Label Metric, is a redeable text to describe Metric. metric_name: Name Metric. Replace metric_1, metric_2, metric_3 to your metrics or add more :) """ data['plugins'].update({"{}".format(plugin_key):{}}) data['plugins'][plugin_key].update({"metric_1": {"row_name":"Row Name 1","metric_name":"metric1","value":100, "type":"integer" }}) data['plugins'][plugin_key].update({"metric_2": {"row_name":"Row Name 2","metric_name":"metric2","value":3.5, "type":"percent" }}) data['plugins'][plugin_key].update({"metric_3": {"row_name":"Row Name 3","metric_name":"metric3","value":1, "type":"binary" }}) data['plugins'][plugin_key].update({"metric_3": {"row_name":"Row Name 4","metric_name":"metric4","value":1, "type":"string" }})
IMPORTANT : The name of the metrics should not have hyphens. Example : metric-one, will not work.
Good example : metric_one, metricOne, METRIC_ONE.
In order to perform tests and install the plugin locally, you install it via the following command:
$ python setup.py install $ service sentinella install <plugin_name> <plugin_version>
Then you need to add your plugin to /etc/sentinella/conf.d/sentinella.conf:
"plugins": { "sentinella.openstack_logs": [ "get_openstack_events" ], "sentinella.metrics": [ "get_server_usage_stats" ], "sentinella.plugin-one": [ -----> Class name. "get_stats" -------------------------------------------------> Name function. ] },
Restart sentinella agent.
$ service sentinella stop $ service sentinella start
Once the plugin is ready and tested, you has to package it in a .zip file and then upload it to Sentinel.la
Your Plugin must be validated to become available to install for security reasons. Your plugin will be reviewed and tested to make it available to install. Once yoy have packaged your plugin, look for the next button in https://app.sentinel.la/#/app/plugins:
And complete the form to submit your plugin for approval.
Once your plugin is accepted, you will be notified and your plugin will become availabe to install it using the sentinella CLI as follows:
$ sentinella install <plugin_name> <plugin_version>