Thursday, February 21, 2013

Version 1.3.2 of Ex2010_MBDB_Info released


Again I've released a new version of the check. I've changed only the Windows plugin. Now the spaces in a mailbox database name are replaced by underscores. I hope this change would help all of you, who experienced problems with the plugin.

To update it's enough to download the new check package, install it in your check_mk instance by a command like this:

cmk -vP install Ex2010_MBDB_Info-1.3.2.mkp

and substitute the cmd file on your Exchange server by the Ex2010_MBDB_Info.ps1 file from the new package.

You can find the new version of the package at the known place at the check_mk plugin exchange site.

5 comments:

  1. Nice job... but caching would be nice.

    #Pfad
    $path="C:\Program Files (x86)\check_mk\plugins\exchange"
    #Datei
    $file="$path\mdbinfo.txt"
    #Zeitraum
    $DateiAlter=(Get-Date).AddHours(-6)
    #Update ja oder nein
    $doUpdate=$True;
    #Prüfung Pfad und Datei
    If (Test-Path "$file")
    {
    $item = Get-Item $file;

    If ($item.LastWriteTime –gt $DateiAlter)
    {
    $doUpdate = $False;
    }
    } else {
    # Ordner vorhanden?
    if ((Test-Path -path "$path") -ne $True)
    {
    $FolderPointer = New-Item "$path" -type directory;
    }
    }
    #Update
    if ($doUpdate)
    {
    If ([intptr]::size -eq 4) {
    $powerShellDir = $powershelldir = "$env:Windir\Sysnative\WindowsPowerShell\V1.0\"
    $dir = "& `"$env:ProgramFiles\Check_MK\plugins\Ex2010_MBDB_InfoMOD.ps1`""
    $bytes = [Text.Encoding]::Unicode.GetBytes($dir)
    $encodedCommand = [Convert]::ToBase64String($bytes)
    Invoke-Command -command { & $powershelldir\powershell.exe -EncodedCommand $encodedCommand }
    } Else {
    echo "<<>>" >"$path\mdbinfo.txt"
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
    $DBS = Get-MailboxDatabase -Status -Server (hostname)
    $DBS | % { '{0,-10} {1,-20} {2, -6}' -f $_.name.Replace(" ", "_"), ($_.Databasesize -replace ',', ''-replace '^.*\((.*) bytes\)', '$1'), (Get-MailboxStatistics -Database $_.name|where { $_.DisconnectReason -ne 'SoftDeleted' }).count }>>"$file" ;
    }
    }
    # Datei ausgeben
    $out = Get-content "$file"
    echo $out

    ReplyDelete
  2. Thank you for providing such needful solution! I'm sure many users are interested in this feature!

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. I think I might have done something incorrectly. before the correct output in check_mk, I also get 3 UNKNOWN lines that look like this:

    UNKN Ex2010_MBDB_Info #< MailBoxDB #
    UNKNOWN - invalid output from agent or error in check implementation

    UNKN Ex2010_MBDB_Info -1<I32 MailBoxDB NPercentComplete-1/I32I32
    UNKNOWN - invalid output from agent or error in check implementation

    Any ideas?

    ReplyDelete
  5. Hey Anonymous,
    please try the follwoing: execute "check_mk_agent.exe test" in the check_mk directory of the Exchange server, which mailbox databases are located on, and post the full output here.

    ReplyDelete