CalculateDowntime

CalculateDowntime(object, schedule, startTime, endTime): Array

Calculates downtime periods for a given network object based on a maintenance schedule within the specified time range.

Table 1. Parameters

object

NetObj or Integer

Network object or object ID

schedule

String

Maintenance schedule name

startTime

Integer

Start of the period (as UNIX timestamp)

endTime

Integer

End of the period (as UNIX timestamp)

Return

Array of DowntimeInfo objects describing downtime windows, or NULL on failure.

// Calculate downtime for the last 24 hours
downtimes = CalculateDowntime($node, "business-hours", time() - 86400, time());
if (downtimes != null) {
    for (d : downtimes) {
        println("Downtime from " .. d->startTime .. " to " .. d->endTime);
    }
}