What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Uptime Report as .csv

Votes:

0

How can I get the Top 100 Uptime report to come out as a csv file instead of a pdf?

csv pdf reports

Created on May 31, 2018 11:03:22 AM



3 Replies

Votes:

0

Unfortunately, it's not possible to create CSV reports for those, as they lack the necessary data files.


Kind regards,
Stephan Linke, Tech Support Team

Created on May 31, 2018 12:38:45 PM by  Stephan Linke [Paessler Support]



Votes:

0

I guess I must to do something like this:

$date = Get-Date
$day = $date.DayOfWeek

switch($day)
{
    "Monday" { $dateModifier = -1 }
    "Tuesday" { $dateModifier = -2 }
    "Wednesday" { $dateModifier = -3 }
    "Thursday" { $dateModifier = -4 }
    "Friday" { $dateModifier = -5 }
    "Saturday" { $dateModifier = -6 }
    "Sunday" { $dateModifier = -7 }
}

[datetime]$previousSunday = (Get-Date).AddDays($dateModifier)

$endstring = "$($previousSunday.Year)-$($previousSunday.Month)-$($previousSunday.Day)-23-59-00"

$startstring = "$($previousSunday.AddDays(-7).Year)-$($previousSunday.AddDays(-7).Month)-$($previousSunday.AddDays(-7).Day)-00-00-00"

$url = "https://myprtg/api/genreport.htm?id=93216&repstart=$startstring&repend=$endstring&$auth"
Write-Host -ForegroundColor Cyan "VERBOSE: $url"
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
$elements = $request.ParsedHtml.getElementsByTagName("td")

$items = @()
$i = 0
foreach($e in $elements)
{
    $items += ($elements[$i].innerText).TrimEnd()
    $i++
}

$i = 1
$report = @()
do
{
    $report += [PSCustomObject]@{
        Sensor = $items[(($i * 12) - 10)]
        Device = $items[(($i * 12) - 9)]
        Group = $items[(($i * 12) - 8)]
        "Uptime %" = $items[(($i * 12) - 7)]
        "Uptime T" = $items[(($i * 12) - 6)]
        "Downtime %" = $items[(($i * 12) - 4)]
        "Downtime T" = $items[(($i * 12) - 3)]
    }
    $i++
}until($i -eq ((($items.Count)-2)/12))

$report | Export-Csv

Created on Jun 5, 2018 3:49:50 PM

Last change on Jun 5, 2018 6:36:11 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

If it returns what you need? :)


Kind regards,
Stephan Linke, Tech Support Team

Created on Jun 6, 2018 5:50:50 AM by  Stephan Linke [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.