I'm looking to run: as_dsmgr.exe /DSStat "Data store"
Which returns:
*************
Deduplication enabled: True Overall Status: Stopping
Data Store data (size in bytes): Stored Data: 47533135358418 Deduplication ratio: 79.57% Compression ratio: 27.69% Overall Data Reduction ratio: 85.23% Space occupied size: 7022251653519
Backup destination path status (size in bytes): Volume total size: 18000172277760 Volume free size: 10949416239104 Volume used size: 7050756038656 Data folder size: 13431878476
Index role information (size in bytes): Job status: no job Index volume total size: 18000172277760 Index volume free size: 10949416239104 Index folder size: 55123280259 nPort: 5008
Hash role information (size in bytes): Hash volume total size: 18000172277760 Hash volume free size: 10949416239104 Hash folder size: 12377621024 Memory total size: 50330615808 Memory available size: 4471898112 Hash used Memory size: 12537233408 Port: 5010
Data role information (size in bytes): Data volume total size: 18000172277760 Data volume free size: 10949416239104 Data folder size: 6955747612672 Port: 5009
*************
What I care bout is the value after Overall Status: which if != 'Running'
Then needs to be marked as down.
I don't know where to start.
Article Comments
To close this request, my script looks as follows:
param ([string]$datastore) invoke-command -computername DEVICE -scriptblock { cd 'C:\Program Files\Arcserve\Unified Data Protection\Engine\BIN' $a = .\as_dsmgr.exe /DSStat $Using:datastore $lineNumber = 0 for($i = 0; $i -lt $a.length; $i++){ if($a[$i] -like'*Overall Status:*') { $lineNumber = $i break } } if($a[$lineNumber] -like'*Running*') { Write-Host '0:Running' } elseif ($a[$lineNumber] -like'*Starting*'){ Write-Host '1:Starting' } elseif ($a[$lineNumber] -like'*Stopping*'){ Write-Host '1:Stopping' } elseif ($a[$lineNumber] -like'*Stopped*'){ Write-Host '2:Stopped' } elseif ($a[$lineNumber] -like'*Status*'){ Write-Host '2:State not captured in script' } else{ Write-Host $a } }
I have then set PRTG to use the windows credentials then set the error and warning thresholds to be 0 and 1. And set 'Value' as the primary channel
Jan, 2022 - Permalink
Thank you for sharing the script. Just to make sure that it is correct, it does work as you expected ?
Jan, 2022 - Permalink
Yes, all works well. i need to improve the final if statement for unexpected output, as i currently appears Green so I need to tweak the last write-host to have an error value. Other than that I'm happy.
Next step would be to pass the server variable as currently the server name is hard coded.
Jan, 2022 - Permalink
Thank you for the confirmation.
Regarding the server name, you can pass it to the script by using the placeholder %host (device IP/DNS address) or "%device" (device name) in the Parameters field of the sensor.
Then for the else statement, you need to return an exit code different than 0 to trigger an error in the sensor. You will find the list of exit codes here: https://www.paessler.com/manuals/prtg/custom_sensors#standard_exescript.
The sensor should then behave as you want it to do.
Jan, 2022 - Permalink
Hello,
Thank you for your message.
According to what you would like to achieve, you need to develop and use a custom script with the EXE/Script or EXE/Script Advanced sensor. The latter should follow the steps below:
That way, you can configure limits in the settings of the channel in PRTG or a custom lookup.
Please, note that the response returned by the script must follow the format corresponding to the sensor used. You will find it in this manual: https://www.paessler.com/manuals/prtg/custom_sensors.
If you have questions, do not hesitate.
Regards.
Jan, 2022 - Permalink