Reconnoiter Graph Templates
Reconnoiter graph templates
I’ve spent some time working with reconnoiter and getting the templates setup on the web interface. As there isn’t much information regarding how the templates work I thought I’d share it here to help others.
Firstly there currently isn’t any template editor with reconnoiter, you’ll either have to build one yourself, or you’ll need to perform inserts directly into the database. For all of these examples I’ll be performing the inserts directly into the database.
Where are the templates stored:
In the database the templates are stored in the prism.graph_templates table, when you first look in this table it will be blank. If you describe the table you’ll see that it has three columns:
The templateid should be a UUID value. The title should be a meaningful title you want to give the template, and the json is the actual JSON that you’ll use for the template.
Creating JSON for the templates
The link above gives an example of the JSON that you should use for a template, I found that this example mostly worked, though I had to quote the “sid” values or PHP would throw a fatal error as the JSON was invalid.
Breaking down the JSON:
Using the above JSON, the query you make into postgres then looks like this:
Some example templates
An example of a query that would add a template for SSH duration metrics:
This template could be used for average ping time metrics:
This is more complex, it has three values and a guide for the 95th percentile. In this case I’ve setup a check that pulls down ELB (Elastic Load Balancer) metrics from AWS Cloudwatch. This example is setting up a template for the latency values. Note that the title will be named “ELB Latency (seconds)” followed by the text you enter. See the JSON on the mailing list post linked above for an example of putting other variables in the title:
Using the templates
Once the templates are in place, reload your reconnoiter web interface and browse to the templates section under graph templates. You’ll see a list of the templates you’ve added. When you expand a template you’ll see a list of all of the targets that have metrics that match that template. You can now expand a target, select the metric, give it a name and hit “create graph”.
Now browse to graphs, search for the graph you’ve just added and it should be there.
Things to note
I’ve noticed that if you have multiple metrics with the same name they’ll show up in the templates. For example both the nginx module and the ssh2 module will collectd a metric called “duration”, when you add this as a metric for a template you’ll see both of those listed as metrics you can choose.
Your reconnoiter apache error log will log your PHP errors and can be helpful in tracking down problems. The Reconnoiter_GraphTemplate.php, Reconnoiter_DB.php and template_browse_json.php files can be very helpful in working out what’s going on. They are all in the “ui” section of the source.
Ensure your JSON is correct and parseable, you can use http://json.parser.online.fr to verify it.
If you’re using Chrome, the developer tools are excellent for showing the requests that are being made.