Collection of Grafana dashboards to work with Kexa, help you monitoring & visualize for low costs, by using data from Kexa to be visualized and monitored.
Want more information on Kexa project ? Check the Open Source repository : https://github.com/4urcloud/Kexa
To set up Grafana dashboards for Kexa, you first need to use the Postgres or MySQL saving option from Kexa.
This will allow you to save your scans data in this database, and then Grafana will retrieve data from it.
Then you can follow indications for the dashboard you want to use.
Kexa read configuration files from './config/' folder, here is a few links to know more about how Kexa work :
- Kexa Ready to Run for Git Action repository (with tuturial in readme)
- Kexa repository
- Kexa full documentation
So in your configuration file, you can add the 'potgres' or 'mysql' save option :
{
"save": [
{
"type": "postgres",
"name": "my_database",
"description": "Database to save the data",
"urlName": "postgres://yourDatabaseConnectionString"
}
]
}
- type: The save option you want to use , 'postgres' or 'mysql'
- name: name of your database
- description: the database to save the data
- urlName: the connection string for your database ( warning: keep your crendentials private )
The database will be constructed automatically on first Kexa launch.
You can check the Kexa logs to get the results and debug data saving:
- 1 : Result of the scan, with resource information for remediation.
- 2 : Export success confirmed
Once your results have been exported, you can launch Grafana, for example, if you used the docker local run, you can go to : http://localhost:3000/
You will need to add your database used for Kexa data saving to your Grafana dashboard as a new data source :
-
Adding a Postgres data source : PostgreSQL data source | Grafana documentation
-
Adding a MySql data source : MySQL data source | Grafana documentation
At the top of this dashboard, you will see a few dropdown menus. Here is the explanation for each one :
The two following need to be set up correctly for the dashboard to work :
- "CPU Usage Rule Name": The Kexa rule name that check for CPU usage peaks
- "Memory Usage Rule Name": The Kexa rule name that check for Memory usage peaks.
Those drop down lists are generated by the retrieved Kexa data, if no rules are showing in those two drop down lists, that means Kexa hasn't saved the data or rules are not applied.
You should select for CPU & Memory, the associated rule for peaks alerts, as mentioned before, you can retrieve the whole rule file for this tutorial here : Kexa_Action_ReadyToRun/rules/kubernetesConsumptions.yaml at main · 4urcloud/Kexa_Action_ReadyToRun (github.com).
So by default the "CPU Usage Rule Name" is "kube-pods-cpu-limitations" and the "Memory Usage Rule Name" is "kube-pods-memory-limitation", if you're using another rule, please select the associated one.
- "Source Database" : Choose your datasource where Kexa data are located
- "Namespace" : Choose the namespace to scan
- "Pod" : Choose the pod to analyse data from
Once all is selected, the dashboard will be refreshed with the new data.
The first section is called “SELECTED POD”, and contains all the analysis data for the selected pod, with CPU analysis on the left and Memory analysis on the right.
It has been made to help you set your limits & requests, as well as monitoring CPU & memory usages.
- Limit Total & Request Total: Your current configuration for limits & requests
- Usage charts: Representing the usage per scan on a timeline, and comparing the usage with the request & limit.
- Optimization scores: A score based on the range between request & limit and the distance between the current usage and those two points. It is just an indication to have a quick view, refer to the graph above for more understanding.
You need to configure your limits & requests to get an optimization score.
Below the optimization scores, you will see a panel with the minimum usage over the selected period, as well as the maximum and the average.
We have also included average deviation and min/max range, and on the right of those statistics, you have the list of Kexa peaks alerts raised.
Next, you have the "CONSUMPTION PEAKS" section, used to help you schedule your pods:
- A heatmap: Taking all data over time to make an average usage per week day and hour so you can know where the usage is the highest or lowest in average.
- Day/Hour peaks & bottoms: Important data from the heatmap
- Alert list: List of all alerts concerning the memory or CPU usage, so you can easily find pods to analyse.