Monitoring Netvault with PowerShell

Number of servers explode in on premise or cloud infrastrctures, and if you really want to be pro-active you need to monitor your stuff. Backups is on of theses stuffes. I mean Datas are the key of your business, so be able to recover them with calm is truely awesome.

In my company, we recently deploy Dell Netvault solution which is very good, but we never success in sending SNMP traps to our Nagios pooler. The MIB was recognized, but nothing is parsed in the monitoring systems. So we decided to use Netvault, PowerShell and NSClient++ to correctly monitor the solution. In this post, i’ll try to explain how we works and why we choose this solution and not another.

Configure Netvault reports

Netvault is kind of a powerfull software, and as it’s at first a linux product, you have all configuration stored in flat files, so everything is really easy to hack and modify as your wish.

To work with my script bellow, you will have to created a file named nagios in your Netvault templates directory.

%CLASS "Job History"
%INCLUDE "%exitstatus != regexp:'Report' AND %starttime >= 'NOW-2HO'"

%EMPTYREPORTTEXT "Nothing to display%\n"
%SUMROWPRE "%\nTotal%\n"
%AVERAGEROWPRE "%\nAverage%\n"

Thanks to this, we will be able to create a csv with needed informations. By the way, the column size is not dynamic, so if some columns missing chars, don’t hesistate to increase interger values in the line starting by %FORMAT.


Extract and display informations

Here is how i exctract and play with datas exported by Netvault tools.

param (
    [String]$TempFile = 'D:\Reporting\Netvault.csv',
    [String]$NVReport =  'C:\Netvault\util\nvreport.exe',
    [String]$NVTemplate = 'C:\Netvault\reports\templates\nagios',
    [String]$NVSite = 'STGNV',
    [INT]$Days = 1

    Write-Debug "Variables initialization"
    $Output = @()
    $NB_ERRORS = 0
    $NB_WARNINGS = 0
    $NB_UNKNOWN = 0
    $Exit = 0
    $Level = "OK"

    Write-Debug "Remove previous $TempFile if existing..."
    if (Test-Path $TempFile) { Remove-Item -Path $TempFile -Force }
    Try {
        Write-Debug "Creating report using $NVReport with $NVTemplate for $NVSite"
        $NVReport $NVSite -templatefile $NVTemplate | Out-File $TempFile
        $NVDatas = Get-Content $TempFile
    Catch {
        Write-Host "UNKNOWN: ERROR - $($_.Exception.Message)"
        Exit 3

    Write-Debug "Importing Netvault Data in a PSCustomObject"
    if ($NVDatas[0] -like "*Report*CLI*Report*") {
        $NVDatas| % {
            [String]$Line = $_
            $ArrayLine = $Line.split(";")
            if (";" -notmatch $ArrayLine[0] ) {
                $prop = [ordered]@{"Start"=(($ArrayLine[0] -as [string]).trimEnd() + " " + ($ArrayLine[1] -as [string]).TrimEnd()) -as [DateTime];
                                    "JobID"=($ArrayLine[2] -as [string]).trim();
                                    "JobTitle"=($ArrayLine[3] -as [string]).TrimEnd();
                                    "Computer"=($ArrayLine[4] -as [String]).TrimEnd();
                                    "Status"=($ArrayLine[5] -as [String]).TrimEnd()}
                $Output += New-Object -TypeName PSCustomObject -Property $prop

        Write-Debug "Count errors (if there is for the past $Days day(s))"
        $Output | ? { $_.Start -gt ((Get-Date).AddDays(-$Days)) } | % {
            if ($_.Status -match "Echou") { Inc $NB_ERRORS }
            elseif ($_.Status -match "avertissements|abandonn") { Inc $NB_WARNINGS }
            else { Inc $NB_UNKNOWN }

        if ($NB_ERRORS -gt 0) { $Exit = 2; $Level = "CRITICAL" }
        elseif ($NB_WARNINGS -gt 0) { $Exit = 1; $Level = "WARNING" }
        elseif ($NB_UNKNOWN -gt 0) { $Exit = 3; $Level = "UNKNOWN" }
    else {
        Write-Host "UNKNOWN: ERROR - $($NVDatas[0])"
        Exit 3
    Write-Host "$Level: $NVSite - Critical: $NB_ERRORS Warning: $NB_WARNING Unknown: $NB_UNKNOWN"
    Exit $Exit

You must register this script in C:\Program Files\NSClient++\scripts

Configure NSClient

If you use Nagios and you don’t use NSClient for your Windows hosts, you miss something. This tool will able you to use NRPE commands on your system to improve your monitoring. The part intresting, is you can also execute PowerShell scripts !

To enable scripts execution you must uncomment a line in the NSC.ini file located by default here: C:\Program Files\NSClient++


; Script to check external scripts and/or internal aliases.

Remove the ; of the next line:



And in the [External Scripts] part, add your script execution, like this:

check_netvault=cmd /c echo scripts\Resporting_Netvault.ps1; exit($lastexitcode) | powershell.exe -command –


Now you just have to add this check in your Nagios server, and you have monitoring on your backups of the last night !

Hope you will find this helpfull.