Sign inSign up

voipgrid/opensips_exporter

By voipgrid

โ€ขUpdated almost 6 years ago

OpenSIPS exporter for Prometheus

Image
0

1.2K

voipgrid/opensips_exporter repository overview

โ opensips_exporter

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.

โ Usage

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")

โ Exported Metrics

MetricMeaningLabels
opensips_core_bad_URIs_rcvdNumber of URIs that OpenSIPS failed to parse.
opensips_core_bad_msg_hdrNumber of SIP headers that OpenSIPS failed to parse.
opensips_core_repliesNumber of received replies by OpenSIPS.kind
opensips_core_replies_totalTotal number of received replies by OpenSIPS.
opensips_core_requestNumber of requests by OpenSIPS.kind
opensips_core_requests_totalTotal number of received requests by OpenSIPS.
opensips_core_unsupported_methodsNumber of non-standard methods encountered by OpenSIPS while parsing SIP methods.
opensips_core_uptime_secondsNumber of seconds elapsed from OpenSIPS starting.
opensips_dialog_dialogsNumber of dialogs.status
opensips_dialog_receivedThe number of dialog events received from other OpenSIPS instances.event
opensips_dialog_sentNumber of replicated dialog requests send to other OpenSIPS instances.event
opensips_load_loadPercentage of UDP children that are awake and processing SIP messages on the specific UDP interface.ip, port, protocol
opensips_load_tcp_loadPercentage of TCP children that are awake and processing SIP messages.
opensips_net_waitingNumber of bytes waiting to be consumed on an interface that OpenSIPS is listening on.protocol
opensips_pkmem_fragmentsCurrently available number of free fragments in the private memory for OpenSIPS process.pid
opensips_pkmem_free_sizeFree private memory available for the OpenSIPS process. Computed as total_size - real_used_size.pid
opensips_pkmem_max_used_sizeThe maximum amount of private memory ever used by the OpenSIPS process.pid
opensips_pkmem_real_used_sizeAmount of private memory requested by the OpenSIPS process, including allocator-specific metadata.pid
opensips_pkmem_total_sizeTotal size of private memory available to the OpenSIPS process.pid
opensips_pkmem_used_sizeAmount of private memory requested and used by the OpenSIPS process.pid
opensips_registrar_default_expireValue of default_expire parameter.
opensips_registrar_max_contactsValue of max_contacts parameter.
opensips_registrar_max_expiresValue of max_expires parameter.
opensips_registrar_registrationsNumber of registrations.type
opensips_shmem_fragmentsTotal number of fragments in the shared memory.
opensips_shmem_free_sizeFree memory available. Computed as total_size - real_used_size
opensips_shmem_max_used_sizeMaximum amount of shared memory ever used by OpenSIPS processes.
opensips_shmem_real_used_sizeAmount of shared memory requested by OpenSIPS processes + malloc overhead
opensips_shmem_total_sizeTotal size of shared memory available to OpenSIPS processes.
opensips_shmem_used_sizeAmount of shared memory requested and used by OpenSIPS processes.
opensips_sl_received_ACKsThe number of received_ACKs.
opensips_sl_repliesThe number of replies.type
opensips_sl_sent_err_replies_totalThe total number of sent_err_replies.
opensips_sl_sent_replies_totalThe total number of sent_replies.
opensips_tm_inuse_transactionsNumber of transactions existing in memory at current time.
opensips_tm_local_replies_totalTotal number of replies local generated by TM module.
opensips_tm_received_replies_totalTotal number of total replies received by TM module.
opensips_tm_relayed_replies_totalTotal number of replies received and relayed by TM module.
opensips_tm_transactions_totalTotal number of transactions.type
opensips_uri_negative_checksAmount of negative URI checks.
opensips_uri_positive_checksAmount of positive URI checks.
opensips_userloc_registered_users_totalTotal number of AOR existing in the USRLOC memory cache for all domains.
opensips_usrloc_contactsNumber of contacts existing in the USRLOC memory cache for that domain.domain
opensips_usrloc_expiresTotal number of expired contacts for that domain.domain
opensips_usrloc_usersNumber of AOR existing in the USRLOC memory cache for that domain.domain

โ Processors

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!)

โ Filtering enabled processors

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.

โ Development

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.

Tag summary

Content type

Image

Digest

Size

4.4 MB

Last updated

almost 6 years ago

docker pull voipgrid/opensips_exporter