3.1.1 Grouping Data Using Prometheus
What
In order to do summary reporting, we need to leverage the power of Prometheus.
When/Why
Anytime we want to do something like report on a rollout or general status, we are going to want to summarize a report. We will accomplish this by using a Prometheus config file on the FileWave server itself.
How
The configuration (or yml files) that we'll create will always be placed in the /usr/local/etc/filewave/prometheus/conf.d/jobs/https directory on the FileWave server. Anything placed in this directory will automatically be read by Prometheus, and the data presented to our dashboard. (Example yml files can be found in /usr/local/etc/filewave/prometheus/conf.d/jobs)
The syntax of these files is quite picky, so it is best to copy an existing one, and then modify it. It may seem complicated, but we are always going to do the following steps:
Step | Example |
1. Place a new (or copied) yml file into /usr/local/etc/filewave/prometheus/conf.d/jobs/https with a meaningful name. | |
2. Edit the new file to specify the following 3 things: * The inventory query (report) to use * The field you want to count by...device_id is almost always a good one if reporting by device * The field you want summarize (aggregate) by...in this case, the filewave client version |
|
3. Once your report is created, the report id to use is most easily accessed through the webadmin. Note that the fields you want to use for aggregation must be in the report. | |
4. Get the definition for the fields you want to use from the API...the easiest way is to do a curl from the command line like this: bash<br>curl -s -k -H "Authorization: <Base64_API_Token>" https://<my.server.address>:20445/inv/api/v1/query/<report_id> | python -mjson.tool<br> Make sure and substitute in your values for the <Base64_API_Token>, <my.server.address> and <report_id> You'll get a response that includes the component and the field names as shown at right |
|
4. Edit the YML file to specify the 3 items as they match your report definition, then save the file. If using the sample file, remember to take out the comment # at the beginning of each line. Example at right: |
Within a minute or two of creation of the file, the data should be available in your dashboard for a new panel.