Skip to main content

Asterisk

Monitor Asterisk PBX — active channels, call volumes, SIP registration status, voicemail counts, and system uptime — using asterisk-exporter.

Pattern: asterisk_exporter → Prometheus scrape → xScaler remote_write


Prerequisites

  • Asterisk 16+
  • ARI (Asterisk REST Interface) enabled
  • xScaler tenant credentials (token + tenant ID)

Enable ARI

In asterisk/ari.conf:

[general]
enabled = yes
pretty = yes
allowed_origins = *

[xscaler_monitor]
type = user
password = ari_password
read_only = no

Option A — Prometheus Exporter

docker run -d \
-p 9088:9088 \
-e ASTERISK_URI=http://localhost:8088 \
-e ASTERISK_USERNAME=xscaler_monitor \
-e ASTERISK_PASSWORD=ari_password \
bitergia/asterisk-exporter

Add to prometheus.yml:

scrape_configs:
- job_name: asterisk
static_configs:
- targets: ['localhost:9088']

remote_write:
- url: https://euw1-01.m.xscalerlabs.com/api/v1/push
authorization:
credentials: <token>
headers:
X-Scope-OrgID: <tenant-id>

Option B — Grafana Alloy

prometheus.scrape "asterisk" {
targets = [{"__address__" = "localhost:9088"}]
forward_to = [prometheus.remote_write.xscaler.receiver]
}

prometheus.remote_write "xscaler" {
endpoint {
url = "https://euw1-01.m.xscalerlabs.com/api/v1/push"
authorization {
type = "Bearer"
credentials = "<token>"
}
headers = { "X-Scope-OrgID" = "<tenant-id>" }
}
}

Option C — OpenTelemetry Collector

receivers:
prometheus:
config:
scrape_configs:
- job_name: asterisk
static_configs:
- targets: ['localhost:9088']

processors:
batch:
timeout: 10s

exporters:
otlphttp/xscaler:
endpoint: https://euw1-01.m.xscalerlabs.com
headers:
Authorization: "Bearer <token>"
X-Scope-OrgID: "<tenant-id>"
compression: gzip

service:
pipelines:
metrics:
receivers: [prometheus]
processors: [batch]
exporters: [otlphttp/xscaler]

Logs

Collect Asterisk full log including calls, errors, and AMI events. Add the following to your Alloy config:

local.file_match "asterisk_logs" {
path_targets = [{
__address__ = "localhost",
__path__ = "/var/log/asterisk/full",
instance = constants.hostname,
job = "integrations/asterisk",
}]
}

loki.source.file "asterisk_logs" {
targets = local.file_match.asterisk_logs.targets
forward_to = [loki.write.xscaler.receiver]
}

loki.write "xscaler" {
endpoint {
url = "https://euw1-01.l.xscalerlabs.com/api/v1/logs/push"

http_client_config {
authorization {
type = "Bearer"
credentials = env("XSCALER_TOKEN")
}
}

headers = { "X-Scope-OrgID" = env("XSCALER_TENANT_ID") }
}
}

Key metrics

MetricDescription
asterisk_active_channelsCurrently active channels
asterisk_active_callsActive calls in progress
asterisk_calls_processed_totalTotal calls processed
asterisk_registrations_totalSIP registrations by status
asterisk_voicemail_messages_totalVoicemail messages by mailbox
asterisk_uptime_secondsAsterisk process uptime