Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSIPS can bind to network sockets for mi_datagram instead of unix domain sockets #13

Open
gwvandesteeg opened this issue Dec 6, 2020 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@gwvandesteeg
Copy link

Version

OpenSIPS Exporter Version: 2.0.4
OpenSIPS 2.4.8

File / Feature

switch *protocol {

This is the switch statement which looks at the type of connection and either connects via the mi_http interface, or the unix domain socket (a file on the filesystem), which would normally match the filename of the socket used in the socket_name setting of mi_datagram. However, the opensips configuration allows the socket to be defined as a network socket instead of a filename.

loadmodule "mi_datagram.so"
modparam("mi_datagram", "socket_name", "udp:127.0.0.1:8090")

Expected behaviour

The socket connection would be accepted and relevant metrics get provided when queried for.
This means that the client interprets the socket path and checks whether it is a UDP socket instead of a filename and connects and queries accordingly.

Actual behaviour

$ opensips_exporter -protocol mi_datagram -addr 127.0.0.1:9434 -socket udp:127.0.0.1:8090
2020/12/06 22:52:29 Started OpenSIPS exporter, listening on 127.0.0.1:9434
2020/12/06 22:52:31 Error encountered while reading statistics from opensips socket: write unixgram opensips_exporter422669750/1.sock->udp:127.0.0.1:8090: sendto: no such file or directory
2020/12/06 22:52:31 Problems registering the *processors.pkmemProcessor processor (could be due to no metrics found for this processor). Error: collector has no descriptors

Stacktrace / Error message

nil

Other info

nil

@RubenHoms
Copy link
Contributor

Thanks for bringing up this issue. I was aware that using a network socket was possible using the mi_datagram module, though we've always used unix domain sockets ourselves so we've had no need for it yet.

I think implementing this should be pretty easy, I don't have time right now to implement this myself but am more than happy to accept a pull request for this. In particular, have a look at the the New, roundtrip and GetStatistics functions in opensips.go. The implement the parts that deal with setting up, retrieving and parsing the response from opensips.

@RubenHoms RubenHoms added bug Something isn't working good first issue Good for newcomers labels Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants