4 years ago
PowerShell Script for Alert
$headers = @{
Accept = 'application/json'
'Content-Type' = 'application/json'
}
$username = "appUser"
$password = "base64 encodedPassword"
$body = @{username=$username;password=$password;}
$response = Invoke-RestMethod 'https://localhost/webconsole/api/Login' -Method 'POST' -Headers $headers -Body $($body | ConvertTo-Json)
$token = $response | Select-Object -ExpandProperty token
$headers = @{
Authtoken = $token
Accept = 'application/json'
}
$response = Invoke-RestMethod 'https://localhost/webconsole/api/DDBInformation/8' -Method 'GET' -Headers $headers
$response.dedupDBInfo.subStoreList.avgQITime -gt "1400"
Hi I'm new to Logic Monitor what do I need to modify in this script so that can be run from collector, the script retrieves the token and inserts that token in next command, but I need to modify so that this user gets credentials from logic monitor service account. This REST API is using base64 encoded password to obtain token.
I need help with adding the logic monitor service account and write output to logic monitor, the script returns nothing if value is less than 1400 if grater than 1400 to trigger alert.