Data configurationGrafana integrationsIntegrations referenceAsterisk integration

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

  1. In your Grafana instance, Click Integrations and Connections (lightning bolt icon), then click on install integration on Asterisk tile.

  2. 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.

The embedded prometheus exporter also requires the embedded asterisk http server to be enabled.

When both the Asterisk http server and prometheus exporter is enabled - the metrics are exposed by default on the url: http://localhost:8088/metrics

Sample res_prometheus configration /etc/asterisk/prometheus.conf

[general]
enabled = yes
core_metrics_enabled = yes
uri = metrics

Sample http_server configuration /etc/asterisk/http_additional.conf

[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 http://localhost:8088/metrics

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

Dashboards

This integration inlcudes two dashboards.

Asterisk Overview

This dashboard gives a general overview of the Asterisk instance based on all the metrics exposed by the embedded prometheus exporter in Asterisk.

Overview

image

Channels Information

image

Endpoints Information

image

Bridges Information

image

Asterisk System Information

image

Asterisk Logs 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:

Logs Overview

image

Errors

image

Warnings

image

Complete Log File

image

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

Metrics

Below is a list of the metrics per service that are automatically written to your Grafana Cloud instance when you connect your Asterisk instance.

  • asterisk_channels_count
  • asterisk_calls_sum
  • asterisk_calls_count
  • asterisk_channels_state
  • asterisk_channels_duration_seconds
  • asterisk_endpoints_count
  • asterisk_endpoints_state
  • asterisk_endpoints_channels_count
  • asterisk_bridges_count
  • asterisk_core_properties
  • asterisk_core_uptime_seconds
  • asterisk_core_last_reload_seconds
  • asterisk_core_scrape_time_ms

This file shows sample metrics exposed by the exporter of an Asterisk instance.

Alerts

The integration also comes packaged with a number of handy alerts.

AsteriskRestarted

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.

AsteriskReloaded

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.

Cost

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.