Web App Stats via HandleSpecialURL

Does anyone have code they’d be willing to share to get stats back from the server to monitor it?

I was thinking of tracking SessionCount, free HD space, RAM, and CPU percent used, and maybe other things.

Anyone have suggestions for anything else?

If anyone is interested I have this working: http://127.0.0.1:8080/api/stats

Returns

Sessions: 1 | HD: Gumby Free: 22 GB | RAMFree: 65 MB |

With this in HandleSpecialURL and also using the MBS plugins:

[code] If Request.Path = “stats” Then
// Session Count
Request.Print "Sessions: " + App.SessionCount.ToText + " | "

// Drive Space
Dim theAppFolderItem As folderItem = GetFolderItem( "" )
Request.Print "HD: " + theAppFolderItem.ParentVolumeMBS.Name + " "
Request.Print "Free: " + TextBytesFormatted( theAppFolderItem.VolumeFreeSizeMBS ) + " | "

// RAM
Request.Print "RAMFree: " + TextBytesFormatted( SystemInformationMBS.AvailableRAM ) + " | "

// Reply to the Request
Request.Status = 200
Return True

End If[/code]

The method “TextBytesFormatted” is part of what we call “xol”: https://github.com/campsoftware/Xojo-OpenLib