Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #$output = & "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\check_emc_hw.bat"
- $output = & "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\check_emc_hw.bat"
- & "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\check_emc_hw.bat"
- #$output = check_emc_hw.bat
- #write-host $output
- # Path and Filter
- #$Path = "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\emc_hw.txt"
- #$regex = "FAULT"
- #For Testing
- $regex = "JWXP"
- #Number of disks in the SAN
- #$disks_to_check = 45
- # Result of the filter
- Write-Host "OUTPUT"
- $output
- $fault = foreach ($line in ( $output | select-string -pattern $regex ) ) {
- $line.line }
- $string = ($output | select-string -pattern $regex -AllMatches | %{$_.matches} | %{$_.value})
- #write-host $string
- #Number of disks OK and NOK
- $result = $string.length
- #write-host $result
- # PRTG Sensor condition
- if ($result -gt 0) {
- write-host "2:Hadware fault on $fault"
- exit 2
- }
- else {
- write-host "0:Hardware OK Result: $output"
- exit 0
- }
- endif
Add Comment
Please, Sign In to add comment