Asterisk integration for Grafana Cloud
Asterisk is a free and open source framework for building communications applications and is sponsored by Sangoma. The integration enables you to quickly setup monitoring for your Asterisk instance. The integration installs pre-built dashboards and alerts that are specifically designed to monitor an Asterisk deployment.
Install Asterisk integration for Grafana Cloud
In your Grafana instance, Click Integrations and Connections (lightning bolt icon), then click on install integration on Asterisk tile.
Wait for the integration to be installed and then follow the steps shown to setup Grafana Agent to automatically scrape and send Asterisk metrics to your Cloud Instance.
Pre-install configuration for the Asterisk integration
In order for this integration to work, you must enable the embedded prometheus exporter in Asterisk to collect and expose Asterisk metrics.
When both the Asterisk http server and prometheus exporter is enabled - the metrics are exposed by default on the url:
Sample res_prometheus configration
[general] enabled = yes core_metrics_enabled = yes uri = metrics
Sample http_server configuration
[general] enabled=yes enablestatic=yes bindaddr=0.0.0.0 bindport=8088 prefix= sessionlimit=100 session_inactivity=30000 session_keep_alive=15000
After updating the configurations - make sure to restart Asterisk server
sudo systemctl restart asterisk
And then check the status of the Asterisk server
sudo systemctl status asterisk
And finally login to the Asterisk CLI to make sure its running
sudo asterisk -r
The metrics should be exposed by the embedded prometheus exporter on the url
Post-install configuration for the Asterisk integration
In the agent configuration file, the agent must be pointed to server, such as
asterisk:8088 in the example below, that exposes a
/metrics endpoint by the embedded Asterisk prometheus exporter.
Also in the logs config, the agent must be configured to collect logs from the Asterisk ‘full’ log file as shown in the example below.
metrics: wal_directory: /tmp/wal global: scrape_interval: 5s configs: - name: integrations remote_write: - url: http://cortex:9009/api/prom/push scrape_configs: - job_name: integrations/asterisk-prom static_configs: - targets: ['localhost:8088'] logs: configs: - name: agent clients: - url: http://loki:3100/api/prom/push positions: filename: /tmp/positions.yaml target_config: sync_period: 10s scrape_configs: - job_name: integrations/asterisk-logs static_configs: - targets: ['localhost'] labels: job: integrations/asterisk-logs __path__: /var/log/asterisk/full
This integration inlcudes two dashboards.
This dashboard gives a general overview of the Asterisk instance based on all the metrics exposed by the embedded prometheus exporter in Asterisk.
Asterisk System Information
This dashboard provides metrics and details on Asterisk log files. Currently only the main Asterisk log file
/var/log/asterisk/full is tracked in this dashboard.
The dashboard contains multiple sections as shown below:
Complete Log File
Dashboard Links On the top right of dashboards, you will find a link to quickly switch between the two dashboards while keeping the time range selection the same
Below is a list of the metrics per service that are automatically written to your Grafana Cloud instance when you connect your Asterisk instance.
This file shows sample metrics exposed by the exporter of an Asterisk instance.
The integration also comes packaged with a number of handy alerts.
This alert monitors the asterisk_core_uptime_seconds metric and alerts if the system was restarted in the last 60 seconds. This can either be a planned restart or a restart due to some exception or failure.
This alert monitors the asterisk_core_last_reload_seconds metric and alerts if the system was reloaded in the last 60 seconds.
AsteriskHighScrapeTime > 100ms (Can be set by user)
The Asterisk prometheus exporter exposes a metric called asterisk_core_scrape_time_ms which is time in ms taken to collect the Asterisk data by the exporter. A high scrape time can lead to a performance degradation of the system. This value should generally be very low, so if the scrape time goes above 100ms this alert is fired.
AsteriskHighActiveCallsCount > 100 (Can be set by user)
The capacity of an Asterisk deployment will vary from environment to environment, however this alert can be configured to alert on an abnormally high active call count on the system.
By connecting your Asterisk instance to Grafana Cloud you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.
Related Grafana Cloud resources
How to set up and visualize synthetic monitoring at scale with Grafana Cloud
Learn how to use Kubernetes, Grafana Loki, and Grafana Cloud’s synthetic monitoring feature to set up your infrastructure's checks in this GrafanaCONline session.
Using Grafana Cloud to drive manufacturing plant efficiency
This GrafanaCONline session tells how Grafana helps a 75-year-old manufacturing company with product quality and equipment maintenance.