{"id":20585418,"url":"https://github.com/voipgrid/opensips_exporter","last_synced_at":"2025-04-14T21:08:44.160Z","repository":{"id":57534285,"uuid":"122336505","full_name":"VoIPGRID/opensips_exporter","owner":"VoIPGRID","description":"Simple server that scrapes OpenSIPS stats and exports them via HTTP for Prometheus consumption","archived":false,"fork":false,"pushed_at":"2023-08-18T11:15:43.000Z","size":581,"stargazers_count":25,"open_issues_count":6,"forks_count":17,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-14T21:08:35.761Z","etag":null,"topics":["dashboard","grafana","opensips","prometheus"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VoIPGRID.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-02-21T12:57:43.000Z","updated_at":"2024-06-19T02:40:54.000Z","dependencies_parsed_at":"2022-09-26T18:21:32.020Z","dependency_job_id":"75e5e257-27dc-46e5-b6b9-8fa23efe538a","html_url":"https://github.com/VoIPGRID/opensips_exporter","commit_stats":{"total_commits":31,"total_committers":5,"mean_commits":6.2,"dds":"0.29032258064516125","last_synced_commit":"0f7e5c139207853d939505ba14672baab871ebfb"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoIPGRID%2Fopensips_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoIPGRID%2Fopensips_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoIPGRID%2Fopensips_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoIPGRID%2Fopensips_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VoIPGRID","download_url":"https://codeload.github.com/VoIPGRID/opensips_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961237,"owners_count":21189993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dashboard","grafana","opensips","prometheus"],"created_at":"2024-11-16T07:08:04.001Z","updated_at":"2025-04-14T21:08:44.128Z","avatar_url":"https://github.com/VoIPGRID.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opensips_exporter \nThis exporter exposes OpenSIPS metrics for consumption by Prometheus using the Unix socket \nprovided by OpenSIPS. It uses the\nOpenSIPS [Management Interface](http://www.opensips.org/Documentation/Interface-MI-2-4) to gather\nthese statistics. It supports two protocols to communicate with the Management Interface `mi_datagram` for OpenSIPS versions up to 2.4.x and for OpenSIPS versions from 3.0 and higher it supports `mi_http` (JSON-RPC)\n\nTested and developed against OpenSIPS versions 1.10, 2.4, 3.0, 3.1 though this will probably work with all other versions as well. \n\n## Status\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/VoIPGRID/opensips_exporter)](https://goreportcard.com/report/github.com/VoIPGRID/opensips_exporter) \n[![Docker Pulls](https://img.shields.io/docker/pulls/voipgrid/opensips_exporter.svg?maxAge=604800)](https://hub.docker.com/r/voipgrid/opensips_exporter/)\n\nActive / maintained\n\nThis project is considered stable for use in production environments.\n\n## Examples and dashboard\nA few examples are provided to give you a clue on how this would be setup on a Prometheus instance:\n- [Prometheus scrape config](examples/prometheus.yaml)\n- [AlertManager rules](examples/alerts.yaml)\n\nAnd because gathering the metrics is only half of the story there's [a dashboard](examples/dashboard.json) you can import into a Grafana installation which works wonders with this exporter. The dashboard is also available on the [Grafana dashboard site](https://grafana.com/dashboards/6935). \n\nA picture is worth a thousand words.\n![OpenSIPS Dashboard for Grafana](examples/dashboard.png \"OpenSIPS dashboard for Grafana\")\n*Note: the dashboard uses elements from the [node exporter](https://github.com/prometheus/node_exporter/) but can still be used without it.*\n\n## Usage\n\nMake sure `$GOPATH/bin` is in your `$PATH`.\n\n```text\nUsage of opensips_exporter:\n  -addr string\n    \tAddress on which the OpenSIPS exporter listens. (e.g. 127.0.0.1:9434) (default \":9434\")\n  -http_address string\n    \tAddress to query the management query through HTTP (e.g. http://127.0.0.1:8888/mi/) (default \"http://127.0.0.1:8888/mi/\")\n  -path string\n    \tThe path where metrics will be served. (default \"/metrics\")\n  -protocol string (required)\n    \tWhich protocol to use to get data from the Management Interface (mi_datagram \u0026 mi_http currently supported) (default \"mi_datagram\")\n  -socket string\n    \tPath to the socket file for OpenSIPS.) (default \"/var/run/ser-fg/ser.sock\")\n```\n\n### OpenSIPS up to version 2.4\nUp to OpenSIPS version 2.4 the exporter works with the `mi_datagram` module. You can load it in your OpenSIPS config like so:\n```\nloadmodule \"mi_datagram.so\"\nmodparam(\"mi_datagram\", \"socket_name\", \"RUNDIR/ser.sock\")\n```\nThen start the exporter with the following params:\n```\nopensips_exporter -protocol mi_datagram -socket RUNDIR/ser.sock\n```\n\n### OpenSIPS version 3.0 and higher\nFrom OpenSIPS version 3.0 and higher the datagram protocol is not supported, instead you can use the `mi_http` module\nwhich uses JSON-RPC to communicate with the Management Interface. For debian you have to install \nthe `opensips-http-modules` to include the module in your OpenSIPS installation. You can load it in your OpenSIPS config like so:\n```\nloadmodule \"httpd.so\"\nloadmodule \"mi_http.so\"\nmodparam(\"httpd\", \"ip\", \"127.0.0.1\")\n```\nBy default the management interface listens on port 8888 which is the default in the exporter as well. You can start the exporter with the following params:\n```\nopensips_exporter -protocol mi_http\n```\n\n## Exported Metrics\n\n| Metric | Meaning | Labels | Metric type |\n| ------ | ------- | ------ | ------ |\n| opensips_up | Whether the opensips exporter could read metrics from the Management Interface socket. (i.e. is OpenSIPS up) | | Gauge |\n| opensips_core_bad_URIs_rcvd | Number of URIs that OpenSIPS failed to parse. | | Counter |\n| opensips_core_bad_msg_hdr | Number of SIP headers that OpenSIPS failed to parse. | | Counter |\n| opensips_core_replies | Number of received replies by OpenSIPS. | kind | Counter |\n| opensips_core_replies_total | Total number of received replies by OpenSIPS. | | Counter |\n| opensips_core_request | Number of requests by OpenSIPS. | kind | Counter |\n| opensips_core_requests_total | Total number of received requests by OpenSIPS. |  | Counter |\n| opensips_core_unsupported_methods | Number of non-standard methods encountered by OpenSIPS while parsing SIP methods. | | Counter |\n| opensips_core_uptime_seconds | Number of seconds elapsed from OpenSIPS starting. | | Counter |\n| opensips_dialog_dialogs | Number of dialogs. | status | Gauge |\n| opensips_dialog_received | The number of dialog events received from other OpenSIPS instances. | event | Counter |\n| opensips_dialog_sent | Number of replicated dialog requests send to other OpenSIPS instances. | event | Counter |\n| opensips_load_load | Percentage of UDP children that are awake and processing SIP messages on the specific UDP interface. |ip, port, protocol| Gauge |\n| opensips_load_process | The realtime load of the process ID. (**OpenSIPS \u003e= 2.4**) |process| Gauge |\n| opensips_load_tcp_load | Percentage of TCP children that are awake and processing SIP messages. | | Gauge |\n| opensips_load_core | The realtime load of entire OpenSIPS - this counts all the core processes of OpenSIPS; the additional processes requested by modules are not counted in this load. (**OpenSIPS \u003e= 2.4**) | | Gauge |\n| opensips_load_core_1m | The last minute average load of core OpenSIPS (covering only core/SIP processes) (**OpenSIPS \u003e= 2.4**) | | Gauge |\n| opensips_load_core_10m | The last 10 minute average load of core OpenSIPS (covering only core/SIP processes) (**OpenSIPS \u003e= 2.4**) | | Gauge |\n| opensips_load_all | The realtime load of entire OpenSIPS, counting both core and module processes. (**OpenSIPS \u003e= 2.4**) | | Gauge |\n| opensips_load_all_1m | The last minute average load of entire OpenSIPS (covering all processes). (**OpenSIPS \u003e= 2.4**) | | Gauge |\n| opensips_load_all_10m | The last 10 minute average load of entire OpenSIPS (covering all processes). (**OpenSIPS \u003e= 2.4**) | | Gauge |\n| opensips_load_1m | The last minute average load of the process ID. (**OpenSIPS \u003e= 2.4**) | ip, port, protocol, process | Gauge |\n| opensips_load_10m | The last 10 minute average load of the process ID. (**OpenSIPS \u003e= 2.4**) | ip, port, protocol, process | Gauge |\n| opensips_load_processes_number | Number of running OpenSIPS processes. (**OpenSIPS \u003e= 3.0**) |  | Gauge |\n| opensips_net_waiting | Number of bytes waiting to be consumed on an interface that OpenSIPS is listening on. | protocol | Gauge |\n| opensips_pkmem_fragments | Currently available number of free fragments in the private memory for OpenSIPS process. | pid | Gauge |\n| opensips_pkmem_free_size | Free private memory available for the OpenSIPS process. Computed as total_size - real_used_size. | pid | Gauge |\n| opensips_pkmem_max_used_size | The maximum amount of private memory ever used by the OpenSIPS process. | pid | Gauge |\n| opensips_pkmem_real_used_size | Amount of private memory requested by the OpenSIPS process, including allocator-specific metadata. | pid | Gauge |\n| opensips_pkmem_total_size | Total size of private memory available to the OpenSIPS process. | pid | Gauge |\n| opensips_pkmem_used_size | Amount of private memory requested and used by the OpenSIPS process. | pid | Gauge |\n| opensips_registrar_default_expire | Value of default_expire parameter. | | Gauge |\n| opensips_registrar_max_contacts | Value of max_contacts parameter. | | Gauge |\n| opensips_registrar_max_expires | Value of max_expires parameter. | | Gauge |\n| opensips_registrar_registrations | Number of registrations. | type | Counter |\n| opensips_shmem_fragments | Total number of fragments in the shared memory. | | Gauge |\n| opensips_shmem_free_size | Free memory available. Computed as total_size - real_used_size | | Gauge |\n| opensips_shmem_max_used_size | Maximum amount of shared memory ever used by OpenSIPS processes. | | Gauge |\n| opensips_shmem_real_used_size | Amount of shared memory requested by OpenSIPS processes + malloc overhead | | Gauge |\n| opensips_shmem_total_size | Total size of shared memory available to OpenSIPS processes. | | Gauge |\n| opensips_shmem_used_size | Amount of shared memory requested and used by OpenSIPS processes. | | Gauge |\n| opensips_sl_received_ACKs | The number of received_ACKs. | | Counter |\n| opensips_sl_replies | The number of replies. | type | Counter |\n| opensips_sl_xxx_replies | The number of replies that don't match any other reply status. | | Counter |\n| opensips_sl_failures | The number of failures. | | Counter |\n| opensips_sl_sent_err_replies_total | The total number of sent_err_replies. | | Counter |\n| opensips_sl_sent_replies_total | The total number of sent_replies. | | Counter |\n| opensips_tm_inuse_transactions | Number of transactions existing in memory at current time. | | Counter |\n| opensips_tm_local_replies_total | Total number of replies local generated by TM module. | | Counter |\n| opensips_tm_received_replies_total | Total number of total replies received by TM module. | | Counter |\n| opensips_tm_relayed_replies_total | Total number of replies received and relayed by TM module. | | Counter |\n| opensips_tm_transactions_total | Total number of transactions. (TM module)| type | Counter |\n| opensips_tmx_transactions_total | Total number of transactions. (TMX module) | type | Counter |\n| opensips_tmx_UAS_transactions | Total number of transactions created by received requests. | type | Counter |\n| opensips_tmx_UAC_transactions | Total number of transactions created by local generated requests. | | Counter |\n| opensips_tmx_inuse_transactions | Number of transactions existing in memory at current time. | | Gauge |\n| opensips_tmx_active_transactions | Number of ongoing transactions at current time. | | Gauge |\n| opensips_tmx_replies | Total number of replies. | type | Counter |\n| opensips_uri_negative_checks | Amount of negative URI checks. | | Counter |\n| opensips_uri_positive_checks | Amount of positive URI checks. | | Counter |\n| opensips_usrloc_registered_users_total | Total number of AOR existing in the USRLOC memory cache for all domains. | | Counter |\n| opensips_usrloc_contacts | Number of contacts existing in the USRLOC memory cache for that domain. | domain | Gauge |\n| opensips_usrloc_expires | Total number of expired contacts for that domain. | domain | Gauge |\n| opensips_usrloc_users | Number of AOR existing in the USRLOC memory cache for that domain. | domain | Gauge |\n\n## Processors\n\nThere are processors available per 'module' of OpenSIPS. The processors take the\nstatistics from the OpenSIPS socket and turn it into a Prometheus metric. You can \nrecognise a processor by the naming convention of the metrics. \nFor example the`opensips_core_replies` metric comes from the core module and its \nprocessor can be found in `./processors/core_processor`.\n\nYou can find out more about the available modules in the OpenSIPS documentation.\n\n### Filtering enabled processors\n\nIt is possible to select what processors you want metrics from. You can do this by\nappending `collect[]` parameters to your request. If for example you only want to\nget metrics about the [core](http://www.opensips.org/Documentation/Interface-CoreStatistics-2-4) \nand [usrloc](http://www.opensips.org/html/docs/modules/2.4.x/usrloc.html#exported_statistics) \nmodule you can do this as follows:\n\n```bash\ncurl localhost:9434/metrics?collect[]=core:\u0026collect[]=usrloc:\n```\n\n**_Note: You have to append `:` to the module name for this to work._**\n\n## Development\n\nTo work on opensips_exporter, get a recent [Go] and\nrun:\n\n    go get -u github.com/VoIPGRID/opensips_exporter\n\nThe `github.com/VoIPGRID/opensips_exporter/opensips` package contains the\nimplementation of the interactions with OpenSIPS needed to get statistics from\nthe mi_datagram Unix socket of a running OpenSIPS. For tests, there is a mock\nin the `./internal/mock` package.\n\nMetrics from different OpenSIPS modules are extracted by processors defined in\nthe `./processors` package. To extend this exporter with metrics from other modules\ncreate your own processor and implement the `Collector` interface. See the other\nprocessors for inspiration. \n\n## Contributing\n\nSee the [CONTRIBUTING.md](.github/CONTRIBUTING.md) file on how to contribute to this project.\n\n## Contributors\n\nSee the [CONTRIBUTORS.md](CONTRIBUTORS.md) file for a list of contributors to the project.\n\n[Go]: https://golang.org/doc/install (Getting Started - The Go Programming Language)\n[mod]: https://golang.org/ref/mod (Installation · go mod)\n\n## License\n\nopensips_exporter is made available under the Apache 2.0 license. See the [LICENSE](LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoipgrid%2Fopensips_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoipgrid%2Fopensips_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoipgrid%2Fopensips_exporter/lists"}