Ad Widget

Collapse

Monitor a folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • metrozabbix
    Junior Member
    • Apr 2015
    • 12

    #1

    Monitor a folder

    Hello all,

    I would like monitor a folder, but i don't know the procedure..
    I have zabbix agent on my computer Windows 7 to be able monitor this.
    I looked on the Internet, i must write a command line in the zabbix agent with "UserParemeter=" and then configure the sensor personalized on zabbix (I don't know if there is other methods).
    Can you help me ?

    Best regards
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    What kind do you want monitoring for folder?

    Example : Folder used size check script

    c:\tools\foldersize.vbs
    -----
    Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
    WScript.Echo objFSO.GetFolder("C:\Temp").Size
    -----

    Execute on comand prompt:
    cscript //Nologo c:\tools\foldersize.vbs

    You call this script from UserParameter.
    But, If you use parameter include '\', you must set UnsafeUserParameters in zabbix_agentd.conf.

    zabbix_agentd.conf
    -----
    UnsafeUserParameters=1
    -----



    Another information :
    Count number files into a windows directory

    Comment

    • metrozabbix
      Junior Member
      • Apr 2015
      • 12

      #3
      Thanks for your answer

      I created script to report folder size in a file taillerep.vbs :

      Dim objFSO , objFolder, sLoc

      Set objFSO = CreateObject("Scripting.FileSystemObject")
      sLoc = WScript.Arguments(0)

      If objFSO.FolderExists(sLoc) Then
      Set objFolder = objFSO.GetFolder(sLoc)
      WScript.StdOut.Write objFolder.Size
      'msgbox objFolder.Size
      ' wscript.Echo objFolder.Size
      Else
      WScript.StdOut.Write -1
      ' wscript.Echo "Fodler does not exist."
      End If

      Set objFolder = Nothing
      Set objFSO = Nothing
      WScript.Quit(0)
      In my zabbix_agentd.conf :

      Server=172.20.16.117
      Hostname=dt10y8p4j
      UnsafeUserParameters=1
      UserParameter=fsiz[*],cscript //nologo taillerep.vbs "$1"
      then, I check with launching agent manually and locally and i receive an answer.

      I created an item in Zabbix

      Click image for larger version

Name:	Sans titre.jpg
Views:	1
Size:	44.8 KB
ID:	313000

      And I created a graph in Zabbix

      Click image for larger version

Name:	Sans titre1.jpg
Views:	1
Size:	29.4 KB
ID:	313001

      But, i've no data in my graph :/

      Best regards,


      PS: Verification that agent and script run well

      Click image for larger version

Name:	Sans titre3.png
Views:	1
Size:	15.0 KB
ID:	313002

      Comment

      • Colttt
        Senior Member
        Zabbix Certified Specialist
        • Mar 2009
        • 878

        #4
        what said the log? or what said the Error-Message in Zabbix?

        Do you restart the agent?

        did you try this from you zabbix-server
        Code:
        zabbix_get -s <YOU-WINDOWS-SERVER> -k fsiz[*]
        Debian-User

        Sorry for my bad english

        Comment

        • metrozabbix
          Junior Member
          • Apr 2015
          • 12

          #5
          It's works ! I think that I have an error in the key field of item.

          But for your command :
          zabbix_get -s <YOU-WINDOWS-SERVER> -k fsiz[*]
          I've got this error :
          zabbix_get [5532]: Get value error: cannot connect to [[172.20.16.117]:10050]: [0x0000274C] Une tentative de connexion a ├®chou├® car le parti connect├® nÔÇÖa pas r├®pondu convenablement au-del├á dÔÇÖune certaine dur├®e ou une connexion ├®tablie a ├®chou├® car lÔÇÖh├┤te de connexion nÔÇÖa
          Best regards.

          Comment

          Working...