Externalized Metrics
Prior to the 2023.08 release, metrics appeared in Smile CDR. Metrics have now been externalized using Prometheus (to pull metrics from Smile CDR) and Grafana (to visualize the metrics). The metrics within Smile CDR will be deprecated in a future release, and it is highly recommended to externalize your Smile CDR metrics as soon as possible. In order to externalize metrics in Smile CDR, the following 4 steps must be completed in order.
First, install Prometheus by referring to: https://prometheus.io/docs/introduction/first_steps/
Prometheus is configured using a YAML file. The Prometheus download comes with a sample configuration in a file called prometheus.yml
. Modify this file to allow Prometheseus to scrape the metrics from SmileCDR.
Setup Prometheus with a configuration file:
smilecdr-monitoring
smilecdr
to the scrape_configssmilecdr
job is: /metrics/local/metrics
['PROMETHEUS']
Additional options for the configuration file are available here: https://prometheus.io/docs/prometheus/latest/configuration/configuration/
A sample prometheus.yml
configuration file is attached below that uses basic auth to authenticate the smile server. If testing locally using Docker, ensure the target for the smilecdr job is host.docker.internal:9000
instead.
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
external_labels:
monitor: 'smilecdr-monitoring'
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: smilecdr
metrics_path: '/metrics/local/metrics'
static_configs:
- targets: ['localhost:9000']
basic_auth:
username: admin
password: password
params:
format: ['PROMETHEUS']
Install Grafana using the instructions found here: https://grafana.com/docs/grafana/latest/setup-grafana/installation/.
These instructions were adopted from: https://prometheus.io/docs/visualization/grafana/
To create a Prometheus data source in Grafana:
http://localhost:9090/
). If running Prometheus in docker locally for testing purposes, use: http://host.docker.internal:9090
.In Grafana, each datasource has a unique ID. For the Prometheus datasource that you just created, obtain the ID by editing the datasource, and copying everything after the final "/":
For the following URL: http://localhost:3000/datasources/edit/z0tPZ2-Vz
The datasource ID is: z0tPZ2-Vz
Copy this value, and in SmileCDR in the admin_web console, populate the Prometheus Datasource ID with that value.
Navigate to the metrics page in Smile CDR, go to each module you want a dashboard for, and click "Download Grafana JSON". Unzip the .zip file, you will be uploading the JSON file contained within the zip file to Grafana to create the dashboard in Step 5. Do this for each module.