Hi, is there a way to delete all closed tickets?
Delete tickets
Votes:
0
6 Replies
Accepted Answer
Votes:
0
Hi there,
You can set the Data Purging for closed tickets under "Setup > System Administration > Core & Probes > Historic Data Purging > Closed Tickets".
Votes:
0
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))" }
Created on Nov 15, 2019 3:38:23 AM
Last change on Apr 7, 2023 6:22:07 AM by
Sasa Ignjatovic [Paessler Support]
Votes:
0
Hey RG,
thanks for sharing.
Votes:
0
The script to close all open tickets. How do you implement this script?
Votes:
0
Lawsont,
The script can be executed by the scheduled task manager on the Windows PRTG Server.
Benjamin Day
[Paessler Support]
Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.
Add comment