Get-RibbonSbcUptime.ps1

Inspired by a question from John Cook on Twitter, I’ve taken my “Update-RibbonADCache.ps1” script, and through the magic of “Save As” we now have Get-RibbonSbcUptime.ps1.

Get-RibbonSbcUptime.ps1 invokes a REST login to your Sonus/Ribbon SBC 1k/2k/SWe-Lite and reports how long it’s been running: the CpuUptime.

It outputs to the pipeline either a timespan object, or a literal string in the same format the SBC displays on its System/Overview tab.

 

Usage

The minimum parameters are the SBC FQDN, the REST login name and REST password. An optional parameter is “-AsTimeString”.

PS C:\>.\Get-RibbonSbcUptime.ps1 -SbcFQDN 10.10.16.82 -RestLogin REST -RestPassword MyRestPwD -AsTimeString

If you fail to provide any of the required parameters, the script will prompt you for them.

The default output is a timespan object:

Days              : 2
Hours             : 20
Minutes           : 3
Seconds           : 10
Milliseconds      : 0
Ticks             : 2449900000000
TotalDays         : 2.83553240740741
TotalHours        : 68.0527777777778
TotalMinutes      : 4083.16666666667
TotalSeconds      : 244990
TotalMilliseconds : 244990000

With the “-AsTimeString” switch the script will output a literal version of the uptime, in the same format as the SBC shows on its System/Overview tab:

3 days, 20 hrs, 4 mins, 48 secs

Automation

If you’re automating this script, you can capture its output into a variable to work on in a subsequent flow. If you ARE doing this, make sure you add the “-SkipUpdateCheck” switch, otherwise when I post an update it will break the automation:

PS C:\> $SbcUptime = (.\Get-RibbonSbcUptime.ps1 -SbcFQDN 10.10.16.82 -RestLogin REST -RestPassword P@ssw0rd1 -Verbose -SkipUpdateCheck)

Known Issue

SBC firmware versions prior to v8.0.3 have a known bug: the CpuUptime reports zero. This is not a problem with the script. If the script reports zero but System/Overview reports an expected value, you’ll need to update the SBC’s firmware.

Auto Update

I’ve added an update-checking component so it will let you know as updates become available. You can suppress the update check by running it with the “-SkipUpdateCheck” parameter, which you should ALWAYS add if you’re running the script via a scheduled task or some other automated/unattended means.

Download

You’ll find a code-signed version of the script on GitHub. You’re welcome to pinch, adapt or improve upon the code with my blessing. If you encounter any problems with it please create an issue on the repo.

Revision History

6th June 2020: Corrected a typo in the post and updated the Download link to point to GitHub.

1.0 – 16th November 2019.

  • This is the initial release.

 

– G.

5 Comments

  1. Hi Greig,
    I tried to test this script on SBC SWe Lite version 9.02, it is failing to retrieve the report. I suspected Ribbon had tighten REST security on version 9 or require a REST license enable.
    Are you able to test and confirm if this is the case.
    Regards
    Ti

Leave a Reply

Your email address will not be published.

... and please just confirm for me that you're not a bot first: Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.