cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 13

NPM and Palo Monitoring

The last couple of days I've been playing with the Palo REST API and got some really useful output that Solarwinds doesn't currently display.

I've tried using the SAM API poller but that just errors every time I add a PALO API request and assume this is only for servers and applications.

Is there any other way of displaying Palo API calls in Solarwinds?

Thanks

Jon

0 Kudos
2 Replies
Level 10

@jonchill What error are you getting?

Have you tried SAM 2020.2 version? There is many more authorization types, so hopefully your use case is covered:

https://thwack.solarwinds.com/t5/SAM-Documents/Server-amp-Application-Monitor-SAM-2020-2-is-Now-Gene... 

 

Let us know if you still have issues in configuring API Poller.

0 Kudos
Level 10

I use PowerShell for a majority of my calls. This is a script that I use for HA Sync Status.

 

 

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
    using System;
    using System.Net;
    using System.Net.Security;
    using System.Security.Cryptography.X509Certificates;
    public class ServerCertificateValidationCallback
    {
        public static void Ignore()
        {
            if(ServicePointManager.ServerCertificateValidationCallback ==null)
            {
                ServicePointManager.ServerCertificateValidationCallback += 
                    delegate
                    (
                        Object obj, 
                        X509Certificate certificate, 
                        X509Chain chain, 
                        SslPolicyErrors errors
                    )
                    {
                        return true;
                    };
            }
        }
    }
"@
    Add-Type $certCallback
 }
[ServerCertificateValidationCallback]::Ignore()

Function SecureStringToString($value){
    [System.IntPtr] $bstr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($value);
    try
    {
        [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr);
    }
    finally
    {
        [System.Runtime.InteropServices.Marshal]::FreeBSTR($bstr);
    }
}
$swCredentials = Get-Credential -credential ${CREDENTIAL}
[string] $credUsername = $swCredentials.Username
[string] $credPassword = SecureStringToString $swCredentials.Password

$paIpAddress = '${IP}'

$paApiKeyObj = Invoke-WebRequest -Uri "https://$paIpAddress/api/?type=keygen&user=$credUsername&password=$credPassword" -UseBasicParsing
$paApiKey = $([xml]$paApiKeyObj.Content).response.result.key

$paDetailsRaw = Invoke-WebRequest -Uri "https://$paIpAddress/api/?type=op&cmd=<show><high-availability><state><%2Fstate><%2Fhigh-availability><%2Fshow>&key=$paApiKey" -UseBasicParsing
$paHAEnabled = $([xml]$paDetailsRaw).response.result.enabled

If ($paHAEnabled -eq 'yes') 
{
    $paDetails = $([xml]$paDetailsRaw).response.result.group
    $paMode = $paDetails.mode
    $paSyncStatus = $paDetails.'running-sync'

    Write-Host "Statistic.HAEnabled: 1"
    Write-Host "Message.HAEnabled: HA is enabled (HAEnabled = $paHaEnabled)"

    If ($paSyncStatus -eq 'synchronized') { Write-Host "Statistic.RunningSync: 1" }
    Else { Write-Host "Statistic.RunningSync: 0" }
    Write-Host "Message.RunningSync: Mode - $paMode, Status - $paSyncStatus"
}
Else
{
    Write-Host "Statistic.HAEnabled: 0"
    Write-Host "Message.HAEnabled: HA is disabled (HAEnabled = $paHAEnabled)"
    Write-Host "Statistic.RunningSync: 9"
    Write-Host "Message.RunningSync: HA is disabled!"
}

 

 

  

0 Kudos