Ad Widget

Collapse

Monitoring freespace exchange 2003

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • patrick77
    Junior Member
    • Feb 2011
    • 1

    #1

    Monitoring freespace exchange 2003

    I would like to monitor the freespace of my exchange2003.

    I have made a vbs script that writes a txt document whith the freespace of the server.

    Is there a way to monitor and building a graph ofthe freespace in zabbix

    vbs script
    Code:
    serverName = "zabbix.***l"
    hostName = "exchsvr.***"
    zbxSender = """C:\Program Files\Zabbix Agent\zabbix_sender.exe"""
    
    Set WSHShell = CreateObject("WScript.Shell")
    
    arrComputers = Array("EXCHSVR")
    
    
    
    Const TEMP_FILE = "C:\whitespace.txt"
    
    
    Const ForWriting = 2
    
    
    Dim strInput, fso
    
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    
    Set filDest = fso.OpenTextFile(TEMP_FILE, ForWriting, True)
    
    
    For Each strComputer In arrComputers
    
    
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    
    
    Set colItems = objWMIService.ExecQuery("Select * from Win32_NTLogEvent Where Logfile='Application' and Eventcode = '1221'")
    
    
    For each objEvent in colItems
    
    
    strMessage = objEvent.Message
    
    
    StartWhiteSpaceDBName = Instr(1,strMessage,"database",1)
    
    
    EndWhiteSpaceDBName = Instr(1,strMessage,"has",1)
    
    
    ReturnDBNameLength = ((EndWhiteSpaceDBName-1)-(StartWhiteSpaceDBName+9))
    
    
    strWSDB = Mid(strMessage,(StartWhiteSpaceDBName+9),(ReturnDBNameLength))
    
    
    StartWhiteSpaceSize = Instr(1,strMessage,"has",1)
    
    
    EndWhiteSpaceSize = Instr(1,strMessage,"megabytes",1)
    
    
    ReturnSizeLength = ((EndWhiteSpaceSize-1)-(StartWhiteSpaceSize+4))
    
    
    strWSSize = Mid(strMessage,(StartWhiteSpaceSize+4),(ReturnSizeLength))
    
    
    dtmEventDate = objEvent.TimeWritten
    
    
    strWSTime = WMIDateStringToDate(dtmEventDate)
    
    
    strOutput = strWSTime & "," & strComputer & "," & strWSDB & "," & strWSSize
    
    if instr(strWSDB,"Mailbox Store") > 0 then 
    STRDbSIZE= strWSSize
    filDest.WriteLine STRDbSIZE
    
    
    WSHShell.Exec zbxSender & " -z " & serverName & " -s " & hostName & " -k exch_Free_Space[total] -o " & STRDbSIZE
    
    
    filDest.WriteLine zbxSender & " -z " & serverName & " -s " & hostName & " -k exch_Free_Space[total] -o " & STRDbSIZE
    exit for
    end if 
    
    if instr(strWSDB,"Mailbox Store") = 0  then exit for
    
    
    'filDest.WriteLine instr(strWSDB,"Mailbox Store") = 0
    Next
    
    
    Next
    
    
    filDest.Close
    
    
    Function WMIDateStringToDate(dtmEventDate)
    
    
    WMIDateStringToDate = CDate(Mid(dtmEventDate, 5, 2) & "/" & Mid(dtmEventDate, 7, 2) & "/" & Left(dtmEventDate, 4) )
    
    
    End Function
    The output of the txt document:
    Code:
    12042
    "C:\Program Files\Zabbix Agent\zabbix_sender.exe" -z zabbix.** -s exchsvr.*** -k exch_Free_Space[total] -o 12042
    Some help would be welcome.
Working...