opensips_exporter
opensips_exporter copied to clipboard
Check socket file permissions before starting
Version
v1.1.1
File / Feature
Reading metrics from the OpenSIPS socket file.
Expected behaviour
It should tell me that I don't have the right permissions to read from the socket file and exit with a useful info message.
Actual behaviour
The exporter runs and spits our permission denied errors.
Stacktrace / Error message
Started OpenSIPS exporter, listening on :9434
Error encountered while reading statistics from opensips socket: read unixgram /tmp/opensips_exporter158593694/1.sock: i/o timeout
ERROR:mi_datagram:mi_datagram_server: failed to send the response: Permission denied (13)
Other info
Same error came up in #8, with the simple fix being "run it as the same user your OpenSIPS socket file is created with". It would make sense to have the exporter check the socket file permissions against the user it is running as. If they're not the same user, or don't have the proper permissions to read from the file, the exporter should exit and print a message telling them to run the exporter as the correct user.