# Last Updated: 2023/05/18 # NOTES: # - This script requires HP Smart Storage Administrator to be installed on the server as it uses the ssacli.exe or hpssacli.exe CLI tool. # - After configuring and testing this script, you should create a Scheduled Task to have it run daily # - ssacli.exe/hpssacli.exe can be located in different directories depending on the version, so update the path on line 18 if needed. # - The output from ssacli will show something like "logicaldrive 1 (238.4 GB, RAID 1): OK" for each volume, so the recommended Success rule in the CheckCentral check configuration would be: # - Body Text - Complex Match ": OK"{#} (where # is the number of volumes that ssacli returns) ################### # Script Settings # ################### # CheckCentral API key $apiToken = "" # Set the path to ssacli.exe here # Note: For HP ProLiant Gen 8 and older, the path is most likely "C:\Program Files\hp\hpssacli\bin\hpssacli.exe" $hpCliPath = "C:\Program Files\Smart Storage Administrator\ssacli\bin\ssacli.exe" # Set the RAID controller ID to check here. If the system only has one RAID controller, it should be ID 0. $raidControllerID = 0 #################################################### # Script Processing (Don't modify below this line) # #################################################### # Setup the subject for the email $subject = "HP RAID Status: " + $env:COMPUTERNAME # Get the RAID status using OpenManage Server Administrator Write-Output "`n[INFO] Getting the RAID report from ssacli...`n" try { $raidReport = & $hpCliPath ctrl slot=$raidControllerID ld all show status | Out-String } catch { $raidReport = "Failed to get the RAID status from ssacli.exe: " + $env:COMPUTERNAME } # Create the activity in CheckCentral Write-Output "`n[INFO] Creating the activity in CheckCentral...`n" $ccActivity = [PSCustomObject]@{ sendNotifications = $true sendTicketingSystems = $true activities = @( [PSCustomObject]@{ subject = $subject body = $raidReport } ) } $ccCreateActivitiesRequest = Invoke-WebRequest -Uri "https://api.checkcentral.cc/createActivities/?apiToken=$apiToken" -Method "POST" -ContentType "text/json" -Body $(($ccActivity | ConvertTo-Json)) if (($ccCreateActivitiesRequest.Content | ConvertFrom-Json).activities_saved -lt ($ccCreateActivitiesRequest.Content | ConvertFrom-Json).activities_received) { Write-Output "Failed to create $(($ccCreateActivitiesRequest.Content | ConvertFrom-Json).activities_received - ($ccCreateActivitiesRequest.Content | ConvertFrom-Json).activities_saved) activitie(s) in CheckCentral" }