Data for PA Server Monitor is stored in a database, and some customers want to access that data for additional uses. This is fairly easy to do. Reading data is fine. We recommend NOT writing to the databases.
Before you go much further, you need to know if you are using the embedded SQLite databases, or a MS SQL Server database. This can be seen in the Database Settings dialog. Your application will either use the same or a similar connection string to connect to the MS SQL Server database, or one of the many available connectors for the SQLite databases.
The most common case requested is access to the numeric data such as comes from performance counters, disk space measurements, ping and web page response times, etc.
To find the data you want, look in the Statistics table. The rows in this table define each individual statistic for which data is kept. The CompID column is the ID for the device. You can see these IDs in the Console by choosing the View > Show Object IDs in Navigation Tree menu option. You can also look in the ConfigCompInfo table to map computer names to CompIDs.
SQLite vs MS SQL Server: Unlike MS SQL Server which keeps all the data in a single database, with SQLite data is split up among separate databases in separate database files. These are kept in a folder shown in the Database Settings page.
There will be a separate database file per monitor type. For example, Ping response data is kept in PingResponse.db and Disk Space data is kept in FreeDiskSpace.db. The ConfigCompInfo table is in the ConfigInfo.db file.
Each SQLite database file will contain the Statistics table, and the StatData table. With MS SQL Server, there is a single Statitics table for all monitor types. There may be a single StatData table, or that table might have been split into multiple tables for large installations.
What searching the Statistics table for the data you want, look at the OwnerType column - this indicates the type of monitor that the data came from. The values for Owner Type are:
|Monitor Type||Owner Type|
|Execute Script (custom values)||5|
|Service Monitor (up/down state)||3|
|Web Page Monitor||6|
SQLite Locking: When doing reads or writes to an SQLite database, the entire database file is locked for everyone. So make sure your queries run as quickly as possible so the database locking doesn't affect the monitoring process.