samba_exporter - part of the samba-exporter package
samba_exporter options
samba_exporter The prometheus exporter part of the samba-exporter package.
The tool is usually stated as daemon by systemd as samba_exporter.service.
It communicates with the samba_statusd.service using the named pipes /run/samba_exporter.request.pipe and /run/samba_exporter.response.pipe.
The samba-exporter package works as a prometheus exporter for statistic data of the samba file server.
It uses smbstatus and the proc fs to collect the data and converts the result into prometheus style data.
The prometheus style data can be requested manually on port 9922 using a http client.
Or a prometheus database sever can be configured to collect the data by scraping port 9922 on the samba server.
The samba-exporter package has two main components running as daemons:
samba_exporter as prometheus exporter frontendsamba_statusd as tool collect the data from sambaSee https://imker25.github.io/samba_exporter/UserDocs/Concept/ for more details.
You might want to use one of the following optional parameters.
-help:
Print the programs help message and exit
-log-file-path string:
Give the full file path for a log file. When parameter is not set (as by default), logs will be written to stdout and stderr (default " ")
-not-expose-client-data
Set to true, no details about the connected clients will be exported
-not-expose-encryption-data
Set to true, no details about the used encryption or signing will be exported
-not-expose-user-data
Set to true, no details about the connected users will be exported
-not-expose-pid-data
Set to true, no process IDs will be exported
-not-expose-share-details
Set to 'true', no details about the shares will be exported
-print-version:
With this flag the program will only print it's version and exit
-request-timeout:
The timeout for a request to samba_statusd in seconds (default 5)
-test-mode:
Run the program in test mode.
In this mode the program will always return the same test data. To work with samba_statusd both programs needs to run in test mode or not.
-test-pipe:
Requests status from samba_statusd and exits. May be combined with -test-mode.
-verbose:
With this flag the program will print verbose output
-web.listen-address:
Address to listen on for web interface and telemetry. (default ":9922")
You might want this to bind to a given ip address like 127.0.0.1 by setting this parameter as "127.0.0.1:9922".
To use 9123 as port use ":9123" here.
-web.telemetry-path:
Path under which to expose metrics. (default "/metrics")
To change the behavior of the samba_exporter service update the /etc/default/samba_exporter according to your needs.
You can add any option shown in the help output of samba_exporter to the ARGS variable.
You may not want to start the service with arguments that will exit before listening starts like -test-pipe, -help or -print-version.
The service will start with -web.listen-address=127.0.0.1:9922 by default, in case your prometheus server is running on a different machine you
need to change this.
/etc/default/samba_exporter includes some examples.
To stop, start or restart the service use systemctl, e. g.:
sudo systemctl stop samba_exporter
To read the log output use journalctl, e. g.:
sudo journalctl -u samba_exporter.
Remark: Due to the services dependencies samba_exporter service stops whenever samba_statusd stops.
And samba_statusd always starts when samba_exporter is started if not already running.
The following values are exported by default:
samba_client_connected_at Unix time stamp a client connectedsamba_client_connected_since_seconds Seconds since a client connectedsamba_client_count Number of clients using the samba serversamba_encryption_method_count Number of processes on the server using the encryptionsamba_exporter_information Information of the samba_exportersamba_individual_user_count The number of users connected to this samba serversamba_lock_created_at Unix time stamp a lock was createdsamba_lock_created_since_seconds Seconds since a lock was createdsamba_locked_file_count Number of files locked by the samba serversamba_locks_per_share_count Number of locks on sharesamba_pid_count Number of processes running by the samba server. Only exported when not running in cluster mode.samba_process_per_client_count Number of processes on the server used by one clientsamba_protocol_version_count Number of processes on the server using the protocolsamba_request_time Time it took to reqest the samba status from samba_statusd [ms]samba_satutsd_up 1 if the samba_statusd seems to be runningsamba_server_information Version of the samba serversamba_server_up 1 if the samba server seems to be runningsamba_share_count Number of shares servered by the samba serversamba_signing_method_count Number of processes on the server using the signingsamba_smbd_cpu_usage_percentage CPU usage of the 'smbd' process with pid in percentsamba_smbd_io_counter_read_bytes IO counter reads of the process 'smbd' in bytesamba_smbd_io_counter_read_count IO counter read count of the process 'smbd'samba_smbd_io_counter_write_bytes IO counter writes of the process 'smbd' in bytesamba_smbd_io_counter_write_count IO counter write count of the process 'smbd'samba_smbd_open_file_count Open file handles by process 'smbd'samba_smbd_sum_cpu_usage_percentage Sum CPU usage of all 'smbd' processes in percentsamba_smbd_sum_io_counter_read_bytes IO counter reads of all 'smbd' processes in bytessamba_smbd_sum_io_counter_read_count IO counter read count of all 'smbd' processessamba_smbd_sum_io_counter_write_bytes IO counter writes of all 'smbd' processes in bytessamba_smbd_sum_io_counter_write_count IO counter write count of all 'smbd' processessamba_smbd_sum_open_file_count Open file handles of all 'smbd' processessamba_smbd_sum_thread_count Threads used by all 'smbd' processessamba_smbd_sum_virtual_memory_usage_bytes Virtual memory usage of all 'smbd' processes in bytessamba_smbd_sum_virtual_memory_usage_percent Virtual memory usage of all 'smbd' processes in percentsamba_smbd_thread_count Threads used by process 'smbd'samba_smbd_unique_process_id_count Count of unique process IDs for 'smbd'samba_smbd_virtual_memory_usage_bytes Virtual memory usage of the 'smbd' process with pid in bytessamba_smbd_virtual_memory_usage_percent Virtual memory usage of the 'smbd' process with pid in percentThe values of samba_client_* and samba_process_per_client_count may contain no valid data when monitoring a smbd running in cluster mode. When running in this mode the values of uid and gid may exported in labels are shown as -1 since smbstatus -L gives only anonymous data in this case. Another consequence of this fact is that samba_individual_user_count may show wrong values as well.
But when running in cluster mode the following additional metrics are exported:
samba_cluster_node_count Number of cluster nodes running the samba clustersamba_pids_per_node_count Number of PIDs per cluster nodesamba_locks_per_node_count Number of Locks per cluster nodesamba_processes_per_node_count Number of Locks per cluster nodesamba_shares_per_node_count Number of Shares per cluster node/etc/default/samba_exporter The configuration file for the samba_exporter service/run/samba_exporter.request.pipe The pipe samba_exporter requests the status from samba_statusd/run/samba_exporter.response.pipe The pipe samba_statusd answers requests from samba_exporter/usr/share/doc/samba-exporter/grafana/SambaService.json A example dashboard for GrafanaSee https://github.com/imker25/samba_exporter/issues
In case you found a new bug please also report as github issue on the projects page.
samba_exporter can work with files that contains spaces in the path and with shares that contain spaces in the name it can not work with shares that contain spaces in the path.share with spaces, but it's a problem to export statistics if the shared folder is /srv/shares/with spaces/
samba_exporter is Copyright (C) 2021 Tobias Zellner tobi@backfraki.de
samba_statusd(1), start_samba_statusd(1)