serverstatus(
)

The serverstatus( function returns a dictionary describing the current status of Panorama X Server.


Parameters

No parameters.


Description

This function returns a dictionary describing the current status of Panorama X Server, including the up time, server name, and account status (whether or not a payment is required). (This function can only be used when running on a Panorama X Server. On a regular copy of Panorama this function will return an empty dictionary.)

The intended use for this function is to be used to create your own custom monitoring URL. For example, suppose you have a web application that includes three databases: Invoices, Products, Customers. You want to set up a monitoring system that will warn you if one or more of these databases is not open, and also warn you if your account balance needs replenishing. To do this, create a procedure in one of the databases with this code.

let status = serverstatus()
let openDatabases = info("files")
let requiredDatabases = "Invoices,Products,Customers"
let missingDatabases = ""
looparray requiredDatabases,",",requiredDatabase
    if arraynotcontains(openDatabases, requiredDatabase,cr())
        missingDatabases = sandwich("", missingDatabases,",")+ requiredDatabase
    endif
endloop
if missingDatabases <> ""
    setdictionaryvalue status,"Status","Required databases are not open"
endif
setdictionaryvalue status,"Missing",missingDatabases
cgiHTML = jsonexport(status)
cgiContentType = "text/json; charset=utf-8"
return

Note that this procedure only sets the "Status" dictionary item if there is a problem. If there is no problem, you should leave this value alone, so that the original value from the serverstatus() function is retained.

Let’s assume the procedure is named readycheck and you put it in the Invoices database. You can now check the status of your server with the url:

http://yourcompany.com/cgi-bin/panoramax.cgi?Invoices/readycheck

If your server is running correctly, the result will contain the text:

"Status" : "All Systems Go"

You can use a web monitoring service (for example https://uptimerobot.com) to check this URL on a regular basis (for example every 5 minutes) and verify that the All Systems Go message is present. If the message is not present you can configure the monitoring service to send you an email, text message, tweet, etc. You’ll be notified if:


See Also


History

VersionStatusNotes
10.2NewNew in this version.