OpenSIPS exporter for Prometheus
1.2K
This exporter exposes OpenSIPS metrics for consumption by Prometheus using the Unix socket provided by OpenSIPS. It uses the OpenSIPS Management Interfaceโ to gather these statistics.
Tested and developed for OpenSIPS 1.11. Though the Management Interface to gather metrics is available in other OpenSIPS versions.
Make sure $GOPATH/bin is in your $PATH.
Usage of opensips_exporter:
-path string
The path where metrics will be served (default "/metrics")
-port string
Port on which the OpenSIPS exporter listens. (default "9737")
-socket string
Path to the socket file for OpenSIPS. (default "/var/run/ser-fg/ser.sock")
| Metric | Meaning | Labels |
|---|---|---|
| opensips_core_bad_URIs_rcvd | Number of URIs that OpenSIPS failed to parse. | |
| opensips_core_bad_msg_hdr | Number of SIP headers that OpenSIPS failed to parse. | |
| opensips_core_replies | Number of received replies by OpenSIPS. | kind |
| opensips_core_replies_total | Total number of received replies by OpenSIPS. | |
| opensips_core_request | Number of requests by OpenSIPS. | kind |
| opensips_core_requests_total | Total number of received requests by OpenSIPS. | |
| opensips_core_unsupported_methods | Number of non-standard methods encountered by OpenSIPS while parsing SIP methods. | |
| opensips_core_uptime_seconds | Number of seconds elapsed from OpenSIPS starting. | |
| opensips_dialog_dialogs | Number of dialogs. | status |
| opensips_dialog_received | The number of dialog events received from other OpenSIPS instances. | event |
| opensips_dialog_sent | Number of replicated dialog requests send to other OpenSIPS instances. | event |
| opensips_load_load | Percentage of UDP children that are awake and processing SIP messages on the specific UDP interface. | ip, port, protocol |
| opensips_load_tcp_load | Percentage of TCP children that are awake and processing SIP messages. | |
| opensips_net_waiting | Number of bytes waiting to be consumed on an interface that OpenSIPS is listening on. | protocol |
| opensips_pkmem_fragments | Currently available number of free fragments in the private memory for OpenSIPS process. | pid |
| opensips_pkmem_free_size | Free private memory available for the OpenSIPS process. Computed as total_size - real_used_size. | pid |
| opensips_pkmem_max_used_size | The maximum amount of private memory ever used by the OpenSIPS process. | pid |
| opensips_pkmem_real_used_size | Amount of private memory requested by the OpenSIPS process, including allocator-specific metadata. | pid |
| opensips_pkmem_total_size | Total size of private memory available to the OpenSIPS process. | pid |
| opensips_pkmem_used_size | Amount of private memory requested and used by the OpenSIPS process. | pid |
| opensips_registrar_default_expire | Value of default_expire parameter. | |
| opensips_registrar_max_contacts | Value of max_contacts parameter. | |
| opensips_registrar_max_expires | Value of max_expires parameter. | |
| opensips_registrar_registrations | Number of registrations. | type |
| opensips_shmem_fragments | Total number of fragments in the shared memory. | |
| opensips_shmem_free_size | Free memory available. Computed as total_size - real_used_size | |
| opensips_shmem_max_used_size | Maximum amount of shared memory ever used by OpenSIPS processes. | |
| opensips_shmem_real_used_size | Amount of shared memory requested by OpenSIPS processes + malloc overhead | |
| opensips_shmem_total_size | Total size of shared memory available to OpenSIPS processes. | |
| opensips_shmem_used_size | Amount of shared memory requested and used by OpenSIPS processes. | |
| opensips_sl_received_ACKs | The number of received_ACKs. | |
| opensips_sl_replies | The number of replies. | type |
| opensips_sl_sent_err_replies_total | The total number of sent_err_replies. | |
| opensips_sl_sent_replies_total | The total number of sent_replies. | |
| opensips_tm_inuse_transactions | Number of transactions existing in memory at current time. | |
| opensips_tm_local_replies_total | Total number of replies local generated by TM module. | |
| opensips_tm_received_replies_total | Total number of total replies received by TM module. | |
| opensips_tm_relayed_replies_total | Total number of replies received and relayed by TM module. | |
| opensips_tm_transactions_total | Total number of transactions. | type |
| opensips_uri_negative_checks | Amount of negative URI checks. | |
| opensips_uri_positive_checks | Amount of positive URI checks. | |
| opensips_userloc_registered_users_total | Total number of AOR existing in the USRLOC memory cache for all domains. | |
| opensips_usrloc_contacts | Number of contacts existing in the USRLOC memory cache for that domain. | domain |
| opensips_usrloc_expires | Total number of expired contacts for that domain. | domain |
| opensips_usrloc_users | Number of AOR existing in the USRLOC memory cache for that domain. | domain |
There are processors available per 'module' of OpenSIPS. The processors take the
statistics from the OpenSIPS socket and turn it into a Prometheus metric. You can
recognise a processor by the naming convention of the metrics.
For example theopensips_core_replies metric comes from the core module and its
processor can be found in ./processors/core_processor.
You can find out more about the available modules in the OpenSIPS documentation. At this time not all modules have a processor written for them. (help wanted!)
It is possible to select what processors you want metrics from. You can do this by
appending collect[] parameters to your request. If for example you only want to
get metrics about the coreโ
and usrlocโ
module you can do this as follows:
curl localhost:9737/metrics?collect[]=core:&collect[]=usrloc:
Note: You have to append : to the module name for this to work.
To work on opensips_exporter, get a recent Goโ , get a recent depโ , and run:
go get -u github.com/VoIPGRID/opensips_exporter
While developing, make sure to run dep ensure often enough to keep
dependencies up-to-date.
The github.com/VoIPGRID/opensips_exporter/opensips package contains the
implementation of the interactions with OpenSIPS needed to get statistics from
the mi_datagram Unix socket of a running OpenSIPS. For tests, there is a mock
in the ./internal/mock package.
Metrics from different OpenSIPS modules are extracted by processors defined in
the ./processors package. To extend this exporter with metrics from other modules
create your own processor and implement the Collector interface. See the other
processors for inspiration.
Content type
Image
Digest
Size
4.4 MB
Last updated
almost 6 years ago
docker pull voipgrid/opensips_exporter