can we get any report option to fetch below SSL cert details from template. see attached screen short
Issuer:Valid From:Valid To:Subject:Subject Alternative Name:Thumbprint
Did you want to record that information or only send it over via an alert? The data is there (though not parsed well), and can be included in an alert message without too much difficulty.
But if you wanted to "record" this kind of data (for storage in the Orion database), then you'd have to write your own SAM Script template. There are a few examples over in the SAM Content Exchange.
Hi,
we required to pull data for all server in report/excel sheet from template.
Yeah - if that's what you want then you'll need to use a script component to pull that information. Each script component can pull up to 10 "pieces" of information (normally numeric value), but you can also store the "messages" (plain text) as well.
The out-of-the-box (OOTB) SSL expiration component doesn't need to access the operating system/file system on the target server itself - it only makes an HTTPS call and interprets the certificate. Some script templates already do this. This is one such that would work for PowerShell.
# Tested with PowerShell 5.1#region Define Exit Codes# Shamelessly stolen from https://blog.kmsigma.com/2017/09/08/sam-powershell-scripting-template/$ExitCode = @{ "Up" = 0; "Down" = 1; "Warning" = 2; "Critical" = 3; "Unknown" = 4 }#endregion Define Exit Codes# Ignore SSL Warnings[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }# Set the Target URL$Url = "https://www.amazon.com/"# Build the request$WebRequest = [Net.HttpWebRequest]::Create($Url)$WebRequest.Method = "HEAD"#region This does the web requesdt and extracts the important data# Make the request, but we don't need to output anything$WebRequest.GetResponse() | Out-Null# Dig out the SSL Certrificate$Certificate = $WebRequest.ServicePoint.Certificate$CertExpiration = [datetime]( $Certificate.GetExpirationDateString() )$CertIssuer = ( $Certificate.GetIssuerName() ).Split("=")[-1]$CertSubject = $Certificate.Subject#endregion This does the web requesdt and extracts the important dataif ( $CertExpiration -and $CertIssuer -and $CertSubject ) { # Calculate days until certificate expiration $ExpiresIn = ( $CertExpiration - ( Get-Date ) ) Write-Host "Message.Issuer: Certificate Issuer is '$CertIssuer'" Write-Host "Statistic.Issuer: 1" Write-Host "Message.Expiration: Certificate expires on $( $CertExpiration )" Write-Host "Statistic.Expiration: $( $ExpiresIn.Days )" Write-Host "Message.Subject: $CertSubject" Write-Host "Statistic.Subject: 1" $Status = "Up"}else { # We don't have the data we want, so let's output the same "things" but change them out for errors Write-Host "Message.Issuer: [Not Detected]" Write-Host "Statistic.Issuer: 0" Write-Host "Message.Expiration: [Not Detected]" Write-Host "Statistic.Expiration: 0" Write-Host "Message.Subject: [Not Detected]" Write-Host "Statistic.Subject: 0" $Status = "Unknown"}# In a component monitor, you'll need to send back an exit code#exit $ExitCode[$Status]# just remove the '#' from the above line to enable that
You'd need to make some slight tweaks to "optimize" it for your environment, but then you'd be collecting the data you wanted. Then you could build a report (or a custom query widget or a Modern Dashboard) that reports this information for you and your leadership teams.
can you add under script
Valid From
Thumbprint
Subject Alternative Name
also i am unable to create custom report as required data filed is not showing under add columns
can you share any advance database query for report?