Hi, is there a way to delete all closed tickets?
Article Comments
Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.
After setting retention to one day for closed tickets, you could also schedule the script below daily to close all open tickets.
# Ensuring TLS/SSL connection to our host
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
# return codes
$http_code = @{ 200 = "OK"; 302 = "Found"; 400 = "Bad Request"; 401 = "Unauthorized"}
# setup credentials
$username = ""
$passhash = ""
$creds_str = "&username=$($username)&passhash=$($passhash)"
# Command line that downloaded CSV file with all open tickets
$Cmd_GetAllOpenTicketsCSV = "https://CORE_SERVER_IP_ADDRESS/api/table.csv?content=tickets&columns=datetime,parentid,status&filter_status=1" + $creds_str
# Get list of todays tickets using command above
$AllOpenTickets = Invoke-WebRequest -Uri $Cmd_GetAllOpenTicketsCSV | ConvertFrom-Csv
# Iterate through each open ticket and run URL to set it close
$AllOpenTickets | % {
$t_id = $_."Ticket ID"
$res = Invoke-WebRequest -Uri "https://CORE_SERVER_IP_ADDRESS/api/closeticket.htm?id=$($t_id)&content=close$($creds_str)"
Write-Host "Closing ticket $($t_id) - $($http_code.($res.StatusCode))"
}
Nov, 2019 - Permalink
Lawsont,
The script can be executed by the scheduled task manager on the Windows PRTG Server.
Benjamin Day
[Paessler Support]
Oct, 2020 - Permalink
Hi there,
You can set the Data Purging for closed tickets under "Setup > System Administration > Core & Probes > Historic Data Purging > Closed Tickets".
Jan, 2017 - Permalink