NetXMS Support Forum

English Support => General Support => Topic started by: Nikk on April 23, 2014, 02:38:32 PM

Title: Samba monitoring
Post by: Nikk on April 23, 2014, 02:38:32 PM
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

Title: Re: Samba monitoring
Post by: Borgso on April 23, 2014, 04:46:37 PM
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


Title: Re: Samba monitoring
Post by: Victor Kirhenshtein on April 24, 2014, 07:21:59 PM
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
Title: Re: Samba monitoring
Post by: Nikk on April 28, 2014, 09:57:16 AM
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.


Title: Re: Samba monitoring
Post by: Victor Kirhenshtein on April 28, 2014, 10:35:30 AM
Net.RemoteShareStatus should return status code returned by NetUseAdd (http://msdn.microsoft.com/en-us/library/windows/desktop/aa370645%28v=vs.85%29.aspx) Windows API call. Level 2 call is used.

Best regards,
Victor