Samba monitoring

Started by Nikk, April 23, 2014, 02:38:32 PM

Previous topic - Next topic

Nikk

Hello,

Is there a way to monitor samba similar to this https://www.netxms.org/forum/configuration/monitoring-ftp-daemon/msg10341/#msg10341 with externalparameter using smbclient //server/service -U user?

Because with ProcessCount it's not possible to tell whether samba is running or not.

Regards,
Nikk


Borgso

#1
Which distro are you using?

Ubuntu:

Samba running:

user@box:~$ status smbd
smbd start/running, process 1406


user@box:~$ smbstatus
Samba version 3.6.3
PID     Username      Group         Machine
-------------------------------------------------------------------

Service      pid     machine       Connected at
-------------------------------------------------------
share1       2714    client1        Tue Apr  8 20:42:18 2014
share1       31445  client2        Mon Apr 14 11:17:00 2014
share2       2714    client3        Tue Apr  8 20:42:18 2014
share3       2714    client2        Tue Apr  8 20:42:18 2014

Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
31445        1000       DENY_NONE  0x100081    RDONLY     NONE             /srv/user   path/OpenFolder   Mon Apr 21 19:32:00 2014



Samba not running:

user@box:~$ status smbd
smbd stop/waiting



user@box:~$ smbstatus
Samba version 3.6.3
PID     Username      Group         Machine
-------------------------------------------------------------------

Service      pid     machine       Connected at
-------------------------------------------------------

No locked files



If you want to check via ProsessCount, did you try "smbd"?

user@box:~$ ps aux|grep smbd
root     15030  0.0  0.2 122504  5756 ?        Ss   15:44   0:00 smbd -F
root     15031  0.0  0.0 122504  1508 ?        S    15:44   0:00 smbd -F
user   15032  0.0  0.1 124976  3524 ?        S    15:44   0:00 smbd -F



Victor Kirhenshtein

Hi!

If you have Windows agent somewhere, you can use Net.RemoteShareStatus or Net.RemoteShareStatusText parameter. Syntax is following:

Net.RemoteShareStatus(share,domain,login,password)
Net.RemoteShareStatusText(share,domain,login,password)

Best regards,
Victor

Nikk

Thanks for your responses!

Borgso, i will try smbstatus, but ProcessCount with smbd is faulty, because, there are still many smbd processes running, while samba itself is down. :/

Victor, what are the status return codes?

Using this Net.RemoteShareStatus(share,domain,login,password)
It shows 0, also when i type incorrect domain, respectively OK for Text.



Victor Kirhenshtein

Net.RemoteShareStatus should return status code returned by NetUseAdd Windows API call. Level 2 call is used.

Best regards,
Victor