imker25 / samba_exporter

A Prometheus exporter for statistic data of the samba file server.
https://imker25.github.io/samba_exporter/
Apache License 2.0
30 stars 6 forks source link

Error for shares with whitespace: strconv.Atoi: parsing "PDF": invalid syntax - while getting ShareData PID (normal without :) #123

Closed mkobel closed 9 months ago

mkobel commented 10 months ago

Error in syslog:

strconv.Atoi: parsing "PDF": invalid syntax - while getting ShareData PID (normal without :)

Output of smbstatus -S -n

Service      pid     Machine      Connected at                     Encryption   Signing
---------------------------------------------------------------------------------------------
Examples PDF 16828   172.16.1.100 Mon Dec 18 04:16:03 PM 2023 CET  -            -
mkobel commented 10 months ago

I renamed the affected share as workaround. This is an acceptable solution on our setup. But the issue might affect for other users/cases.

imker25 commented 10 months ago

@mkobel thanks for the bug report

I will try to find a solution for shares with white space in the name. The problem is, that the smbstatus output is not formatted in way that it could be parsed easy, so the code needs to probe a lot of different options, to figure out what each value could be. I will try ma best to find a way to fix this. But if I'm not able to find a good solution that can work also with multiple white spaces in the shares name I will just update the documentation with a warning that shares with names will cause problems.

imker25 commented 10 months ago

@mkobel with V1.31.6-pre, also shares with white space in the name should work. I will do a full release of this version when I can confirm that the bug is fixed.

imker25 commented 9 months ago

This issue is fixed with V1.31.8