Retrieving statistics from the server
Prev | Chapter 44. Server Monitoring | Next

## Retrieving statistics from the server

By default we can retrieve server statistics using XMPP. After a successful setup of the section called “Setting Up Remote Monitoring in the Server” we can enable additional@@, configured methods (JMX, HTTP, etc).

### Retrieving statistics using XMPP

Accessing statistics over XMPP protocol requires any XMPP client capable of executing XEP-0050: Ad-Hoc Commands. It’s essential to remember, that only administrator (a user whose JID is configured as administrative) can access the statistics.

#### Psi XMPP Client

For the purpose of this guide a Psi client will be used. After successfully configuring and connecting to account with administrative privileges we need to access Service Discovery, either from application menu or from context menu of the particular account account:

Figure 44.1. Access service discovery

In the Service Discovery window we need to find Server Statistics component:

Figure 44.2. Access statistics component in service discovery

We can either access statistics for all components or select particular component after expanding the tree. To execute ad-hoc command simply double click on the particular node which will open window with statistics:

Figure 44.3. Server statistics

In this window, in addition to see the statistics, we can adjust Stats level by selecting desired level from the list and confiming by presing Finish.

### Retrieving statistics using JMX

In order to access statistics over JMX we need to enable support for it in Tigase - the section called “Activation”. Afterwards we can use a number of tools, for example following:

#### JConsole

After opening JConsole we either select local process or provide details of the remote process, including IP, port and credentials from etc/jmx.* files:

Afterwards we navigate to MBeans tab from where we can access `tigase.stats` MBean. It offers similar options to XMPP - either accessing statistics for all components or only for particular component as well as adjusting level for which we want to obtain statistics:

#### StatsDumper.groovy

In order to collect statistics over period of time following groovy script can be used: StatsDumper.groovy. It’s a Simple JMX client that connects to Tigase and periodically save all statistics to files.

It takes following parameters:

    $ groovy StatsDumper.groovy [hostname] [username] [password] [dir] [port] [delay(ms)] [interval(ms)] [loadhistory(bool)]

- hostname - address of the instance
- username - JMX username
- password - JMX username
- dir - directory to which save the files with statistics
- port - port on which to make the connection
- delay(ms) - initial delay in milliseconds after which statistics should be saved
- interval(ms) - interval between each retrieval/saving of statistics
- loadhistory(bool) - indicates whether or not load statistics history from server (if such is enabled in Tigase)

Prev | Up | Next
Chapter 44. Server Monitoring | Home | Chapter 45. Tips and Tricks