serverstatus(
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:

- the server goes down
- the server loses its internet connection
- Panorama X Server quits unexpectedly
- your Panorama account needs a payment soon
- any of the required databases has closed on the server

See Also

- cgitest -- tests a CGI procedure.
- getcookie( -- returns the value of a cookie submitted to the server.
- getcookielist( -- returns a list of cookies submitted to the server.
- info("httprequestinprogress") -- returns true if this code is running on Panorama X Server, and the server is responding to a web client request.
- info("webclientsessioninprogress") -- returns true if this code is running on Panorama X Server, and the server is responding to a web client request.
- serverrunning( -- returns true if this code is running on a Panorama server, or false if it is running in single user mode or on a client.
- URL Tool Menu (Web Debugging) -- tool with popup menu to assist with debugging web procedures.
- urlfilename( -- extracts the filename from a complete url.
- urlpath( -- extracts the path from a URL.
- Web Error Pages -- customizing the server response when an error occurs.
- webhomesubfolder( -- returns the folder ID of a subfolder of the web server's home folder.
- webserverinfo( -- retrieves additional information about the web server and the current browser request.
- webtagortext( -- prepares text for display in a web page.
- webtext( -- converts a number or regular text into text encoded for display in a web browser.

History

Version | Status | Notes
10.2 | New | New in this version.