Monitoring
Monitoring CData Virtuality Server
You can see the server log in real-time. Use tail
(or Tail for Windows if you are not using a Linux system) to read the activity stream from the command line. Additionally, you can monitor the Java process behind the server. We will give a brief description of the tools usable if you want to monitor the Java process for performance counters or network communication.
Process Monitoring on Linux
Linux offers some basic and useful tools out of the box. There are four tools which help monitor and trace the server process: top, htop, netstat and tail. The tools top and htop allow you to follow the resource consumption of the programs and services running on the machine. Maybe the htop tool is not yet installed (top most certainly is), but you can quickly get it via apt, yum, or the package manager you use on the system. The netstat command-line tool is useful to see your system's TCP and UDP connections, and you can combine it with grep to filter the output table. After you noted the process id (PID) of the CData Virtuality Server process, you can execute netstat -aon | grep %PID%
and receive all bindings that the server uses for connections as well as the listening port and IP. The last tool, tail, opens a file and will automatically refresh and show you the last lines of the file you are watching. This is an excellent way of real-time auditing the server and checking for anomalies. All the tools are command-line and can be started from a terminal session.
Overview of typical monitoring tools:
- top and htop;
- netstat (use
netstat -aon | grep %PID%
to get all network data from a specific process); - tail.
Process Monitoring on Windows
On Windows, you can use the standard tools that are provided by the system. The Task Manager can be used to check which processes are running and what their resource consumption is. Go to the Resource Monitor to have a graphical visualization of different performance counters. Not only can the CPU and RAM usage be audited, but the network rate and disc performance are also displayable. If you want some information but do not care about visualization in the form of small graphs, you can modify the Task Manager slightly to give more details about the running processes. This is also very useful when you want to have the process id (PID) used for the CData Virtuality Server. For example, you can use this information to check which ports the CData Virtuality Server is listening on and whether there are any open connections to remote hosts with the command line tool netstat. Start the Task Manager and go to the Processes tab. Then click on the menu item View and choose Select columns. Now you have a variety of extra columns to monitor your server's performance. After you have checked the PID of the CData Virtuality Server process, you can use the command-line tool netstat and the parameters -aon to get a list of all processes with their TCP and UDP connections.
Overview of typical monitoring tools
- Task Manager and Resource Monitor (Windows built-in for performance auditing);
- netstat (Windows built-in command-line tool to check and manage network connections and configurations);
- Tail for Windows (Third-party software to watch log files in real-time).
Local and Remote Monitoring Using JConsole
If you want to monitor the Java Virtual Machine encapsulating the CData Virtuality Server in detail, use the tool JConsole. Once the JDK is installed, it is part of the Java JDK available on both Linux and Windows systems. Typically, after the installation, you have a bin folder somewhere on your system (e.g., /usr/lib/jvm/java-7-oracle/bin on Linux or C:\Program Files\Java\jdk1.7.0_60\bin on Windows) where the jconsole is located. After obtaining the PID of the CData Virtuality Server via top (Linux) or Task Manager (Windows), you can run jconsole
via one of the following commands:
jconsole $PID$
example: jconsole 3225
jconsole %host%:%Port%
example1: jconsole myserv.mycorp.local:9999
example2: jconsole 155.2.113.9:9999
You can also execute jconsole
and enter the connection parameter by hand. Note that the PID-based connection is only possible for local instances. Any remote management requires the connection via host and port.
Please note that the default jconsole
management port for the CData Virtuality Server is 9999
. If you want to change it, you have to modify the dvserver-standalone.xml file at the tag <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
. Remember to open the port by a firewall rule. For more information about ports, see Network Configuration.
System Tables to Monitor
As it is possible to access the system tables and procedures via JDBC or ODBC, most monitoring systems can easily check them using simple SQL queries.
SYSADMIN.ScheduleJobRun
- To check for failed jobs, you can check for
status = 'failed'
and get thefailureReason
; To look for long-running queries, you can check, for example, queries that are running longer than 60 seconds with the following statement:
SQLSELECT sqlCommand,startTime,endTime,status,failureReason FROM SYSADMIN.ScheduleJobRun WHERE TIMESTAMPDIFF( SQL_TSI_SECOND, startTime, endTime ) > 60
See Date and Time Functions for other time intervals to check and Jobs and Schedules for more information.
SYSADMIN.Queries
This table enables you to monitor all queries that have been issued against the CData Virtuality Server.
In this example, we are checking for queries running for more than 60 seconds:
SELECT query,startTime,endTime,status,failureReason FROM SYSADMIN.Queries WHERE TIMESTAMPDIFF( SQL_TSI_SECOND, startTime, endTime ) > 60
See Date and Time Functions for other time intervals to check.
SYSADMIN.getAllDataSourcesMetadataDiff()
This procedure returns metadata difference for the specified data source:
SYSADMIN.getDataSourceMetadataDiff(IN name string)
WildFly Metrics
WildFly can expose a set of metrics that are available over the http://host:port/metrics URL (where the host and port are the ones of the WildFly management interface). By default, the WildFly metrics for the CData Virtuality Server are available at http://localhost:9990/metrics. The host can be configured in the dvserver-standalone.xml file as follows:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:YOUR_HOST}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
The change requires restarting the CData Virtuality Server. After this, the metrics will be available at http://YOUR_HOST:9990/metrics.
Prometheus JMX Exporter
The CData Virtuality Server also supports Prometheus JMX Exporter as an alternative to standard WildFly metrics. To configure the Prometheus JMX Exporter metrics, follow these steps:
1. Download the Prometheus JMX Exporter java agent (.jar file) and place it in the /dvserver/bin folder.
2. In the /dvserver/bin/standalone.conf (for *nix) or /dvserver/bin/standalone.conf.bat (Windows) file, uncomment the #Prometheus JMX Exporter configuration and update the last line as follows:
rem #Prometheus JMX Exporter
set "JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djboss.modules.system.pkgs=org.jboss.logmanager -Dsun.util.logging.disableCallerCheck=true"
set "JAVA_OPTS=%JAVA_OPTS% -Xbootclasspath/a:%DVSERVERROOTDIR%\modules\system\layers\base\org\jboss\logmanager\main\jboss-logmanager-2.1.14.Final.jar;%DVSERVERROOTDIR%\modules\system\layers\base\org\wildfly\common\main\wildfly-common-1.5.2.Final.jar"
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:%DVSERVERROOTDIR%\bin\YOUR_PROMETHEUS_AGENT.jar=YOUR_HOST:YOUR_PORT:%DVSERVERROOTDIR%\bin\jmx_prometheus_config.yml"
Make sure that YOUR_PROMETHEUS_AGENT
file name, YOUR_HOST
, and YOUR_PORT
values are correct. Please do not copy the jboss-logmanager and Wildfly paths from this example and use the values that are in your config file by default.
3. Create a jmx_prometheus_config.yml config file in the /dvserver/bin folder. Please refer to the Prometheus JMX Exporter documentation for the contents of the jmx_prometheus_config.yml config file.
4. The change requires restarting the CData Virtuality Server. After this, the metrics will be available at http://YOUR_HOST:YOUR_PORT/metrics.