Repository navigation
NethVoice: Monitor service availability #8093
Copy link
Copy link
Labels
nethvoiceBug or features releted to the NethVoice projectBug or features releted to the NethVoice projecttestingPackages are available from testing repositoriesPackages are available from testing repositories
Milestone
Description
Description
Add the first set of built-in alerts for NethVoice and NethVoice proxy, as part of #8066, so administrators know about problems before users report them.
Each module exports its own metrics and publishes its own alert rules. The node runs the export-metrics command of each module every 5 minutes (NethServer/ns8-core#1365). The metrics app evaluates the rules stored by the module (NethServer/ns8-metrics#91) and sends notifications with its existing portal and email settings.
The full list of alerts, with severity and conditions, is in this comment.
Scope
- Services:
ServiceDownfor the NethVoice services (FreePBX/Asterisk, MariaDB, Janus, CTI, Phonebook, Tancredi, Satellite, Reports, SFTP, SAML2/OAuth2 proxies) and the proxy services (kamailio, postgres, redis, rtpengine). Service state is read from systemd, not from podman. - Trunks:
NethVoiceTrunkUnreachable. NethVoice checks trunks that bypass the proxy; NethVoice proxy checks UDP trunks that go through it. TCP and TLS trunks through the proxy are not checked yet. - DNS:
NethVoiceDnsFailureandNethVoiceDnsSlowfor the NethVoice, CTI and proxy names, checked on the DNS resolver of the node (/etc/resolv.conf). - AI:
NethVoiceAiKeyInvalidandNethVoiceAiCreditExhaustedfor the Deepgram and OpenAI keys used by transcription. - Alerts are off by default and are turned on per module from the "Alerts" card of the Settings page (
set-alertsaction). The list of alerts and their thresholds cannot be changed.
Call quality and configurable thresholds belong to the parent issue.
Acceptance criteria
- With alerts off (default), no rules are published, but metrics are still exported. Turning alerts on publishes the rules; turning them off removes them.
- Rules are published at module create, update, restore and clone, and removed when the module is removed. Rules of other modules are not touched.
ServiceDownfires withreason=stoppedwhen a service is stopped for 10 minutes, or withreason=crash_loopwhen systemd restarts it at least 3 times in 10 minutes. Disabled services and services never started are not watched.NethVoiceTrunkUnreachablefires when a trunk stays unregistered or its provider does not answer for 10 minutes.NethVoiceDnsFailurefires when a name does not resolve (reason=not_resolved) or the proxy name does not point to the proxy IP (reason=ip_mismatch) for 15 minutes.NethVoiceDnsSlowfires when the resolver is slower than 3 seconds or does not answer for 15 minutes.NethVoiceAiKeyInvalidfires when transcription is on and the provider rejects the API key for 10 minutes.NethVoiceAiCreditExhaustedfires when Satellite reports a call refused for lack of credit, and clears after the next successful call.- A check that cannot run (for example AI provider unreachable or FreePBX stopped) is reported with
nethvoice_exporter_collector_up= 0 (nethvoice_proxy_exporter_collector_upfor the proxy) and raises no alert. - Alerts show the service or trunk, module instance and node, in English and Italian.
- Requires core 3.24.0 or later and metrics app 1.7.0 or later. With an older metrics app the rules are ignored.
Verification
- Unit tests for the metric collectors and rule publishing, and promtool tests for the alert rules, in both repositories.
- Robot tests in CI for
export-metrics,set-alertsand rule publishing. - Manual QA on a test cluster: services stopped and in crash loop, trunk failures, DNS
not_resolvedandip_mismatch, invalid AI key, and rule cleanup on module removal.
References
- NethVoice: feat(alerts): add first NethVoice alerts nethesis/ns8-nethvoice#1067
- NethVoice proxy: feat(alerts): add ServiceDown and trunk alerts nethesis/ns8-nethvoice-proxy#231
- Core, periodic
export-metrics: feat(metrics): publish module metric files ns8-core#1365 - Metrics, module alert rules: feat(alerts): allow module-provided rules ns8-metrics#91
- Module-provided alert rules: Allow applications to provide their own alert rules #8100
- Parent issue: NethVoice: Configurable Alerting for Critical NethVoice Events #8066
- Alert list: NethVoice: Monitor service availability #8093 (comment)
- Superseded (systemd-exporter approach): Add systemd Prometheus exporter nethesis/ns8-nethvoice#907, feat(metrics): add systemd exporter nethesis/ns8-nethvoice-proxy#194
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
nethvoiceBug or features releted to the NethVoice projectBug or features releted to the NethVoice projecttestingPackages are available from testing repositoriesPackages are available from testing repositories
Type
Projects
- StatusShow more project fieldsTesting
Activity
[-]NethVoice: Monitor failed systemd units[/-][+]NethVoice: Monitor service availability[/+]gsanchietti commentedon Oct 27, 2026
Implemented alerts
Alerts implemented in nethesis/ns8-nethvoice#1067 and nethesis/ns8-nethvoice-proxy#231. They are off by default and are enabled from the "Alerts" card in the Settings page of each module. Checks run every 5 minutes.
NethVoice (nethesis/ns8-nethvoice#1067)
ServiceDownreason=stopped) or restarted at least 3 times in 10 minutes (reason=crash_loop). Services: freepbx (Asterisk), mariadb, janus, nethcti-ui, nethcti-server, nethcti-middleware, phonebook, tancredi, satellite, satellite-mqtt, satellite-pgsql, reports-api, reports-redis, reports-ui, sftp, saml2-proxy, oauth2-proxy. Disabled services and services never started are not watched.NethVoiceTrunkUnreachablereason=registration_failed), the remote side of areceivetrunk is not registered (reason=not_registered), or the provider of an IP trunk that bypasses the proxy does not answer OPTIONS (reason=qualify_failed)NethVoiceTrunkNotMonitoredreceivetrunk has a name Asterisk cannot use as SIP user (a space or another character outside letters, digits and_ . + - ! ~ * ' ( )) and no From User, so its provider is never checked (reason=name_invalid). Fix: rename the trunk without spacesNethVoiceDnsFailurereason=not_resolved), the proxy name does not point to the proxy public or private IP (reason=ip_mismatch), or the DNS server does not answer within 5 seconds (reason=no_answer)NethVoiceDnsSlowNethVoiceDnsFailurefor the same nameNethVoiceAIKeyInvalidNethVoiceAICreditExhaustedDNS checks use the DNS server configured on the node (
/etc/resolv.conf), not public DNS servers. The DNS server answer time is also exported asnethvoice_dns_response_seconds.NethVoice proxy (nethesis/ns8-nethvoice-proxy#231)
ServiceDownreason=stopped) or restarted at least 3 times in 10 minutes (reason=crash_loop)NethVoiceTrunkUnreachablereason=registration_rejected), does not answer the registration (reason=registration_timeout), or does not answer OPTIONS (reason=qualify_timeout)The proxy alerts show the trunk name when NethVoice exports it. Trunks over TCP and TLS are not checked by the proxy yet.
gsanchietti commentedon Oct 28, 2026
Testing versions:
nethvoice:1.8.0-testing.55,nethvoice-proxy:1.7.5-testing.11,core:3.24.0,metrics:1.7.0Clean install:
Update existing install:
(core update docs, module update docs)
Before the alert tests, set up email or portal notifications in the Metrics app so alerts can be received.
Test case 1: Clean install, alerts off by default
Test case 2: Update from previous release
1.7.14and NethVoice proxy1.7.4with working phones and trunks.Test case 3: Turn alerts on and off
Test case 4: Unused services are not watched
Test case 5: Trunk that skips the proxy is unreachable
Test case 6: UDP trunk through the proxy is unreachable
Test case 7: Trunk name with a space
Test case 8: DNS name not resolved or pointing to the wrong address
Test case 9 (optional): Slow DNS
Needs a DNS server that answers slowly.
Test case 10: Invalid AI key
Test case 11 (optional): AI credit used up
Needs an AI provider key with no credit left.
Test case 12: Backup restore, clone and removal