. . .

Configure Monitoring Extras

If the monitoring service runs on several nodes, each service has to be informed about the URL of the service registry and each node uses a different server port number.

To configure services, create a /config directory in the installation directory (/opt by default) and create an application.yml file in it:

# Password for the default "user"
security:
user:
password: secret
 
# Tomcat URL for monitoring the JMX values via Jolokia - requires an installation of the jolokia war (https://jolokia.org/download.html)
#tomcat:
# url: http://localhost:8080
 
# Change the port number for the running service; the default port is displayed after startup in the logs.
#server:
# port: 9999
 
eureka:
instance:
# Set your unique hostname here for proper display in eureka
hostname: localhost
client:
serviceUrl:
# URL of the service registry
defaultZone: http://localhost:8761/eureka
 
# Port of other JMX services
jmx:
host: localhost
port: 13991
 
# Storage to use - default is in memory, MongoDB can also be used (without auth)
storage:
useMongo: false
serverNames: localhost
 
# Mbeans to add to monitoring; provide comma separated list of JMX values
mbean:
names: java.lang:type=OperatingSystem,java.lang:type=Runtime,java.lang:type=Threading

Example - Monitoring Service on two Nodes

The following example shows the configuration of two Monitoring instances. On node1 Yambas, Dashboard, ServiceRegistry and Monitoring1 is running. On node2 another Yambas and Monitoring2 is running.
The goal is to get the values of each Monitoring instance while working with the Dashboard. Therefore the configuration files of both Monitoring instances look like the following:

# Password for the default "user"
security:
user:
password: secret
 
# Tomcat URL for monitoring the JMX port
#tomcat:
# url: http://localhost:8080
 
# URL of the service registry
eureka:
instance:
hostname: 192.168.177.13
client:
serviceUrl:
defaultZone: http://192.168.177.13:8761/eureka
 
# Port of other JMX services
jmx:
host:localhost
port:13991
 
# Storage to use - default is in memory, MongoDB can also be used (without auth)
#storage:
#useMongo: true
#serverNames: localhost
 
# Mbeans to add to monitoring; provide comma separated list of JMX values
mbean:
names: java.lang:type=OperatingSystem,java.lang:type=Runtime,java.lang:type=Threading
# Password for the default "user"
security:
user:
password: secret
 
# Tomcat URL for monitoring the JMX port
#tomcat:
# url: http://localhost:8080
 
# URL of the service registry
eureka:
instance:
hostname: 192.168.177.14
client:
serviceUrl:
defaultZone: http://192.168.177.13:8761/eureka
 
server:
port: 9998
 
# Port of other JMX services
jmx:
host:localhost
port:13991
 
# Storage to use - default is in memory, MongoDB can also be used (without auth)
#storage:
#useMongo: true
#serverNames: localhost
 
# Mbeans to add to monitoring; provide comma separated list of JMX values
mbean:
names: java.lang:type=OperatingSystem,java.lang:type=Runtime,java.lang:type=Threading

It is important that both Monitoring Services run on different Ports that are not already in use (Node1=8090 (default) and Node2=9998).

After configuring those Monitoring instances you need to stop them. Restart the service registry on node 1 like shown in Debian package Installation .

Check if service registry is reachable (e.g. via curl http://<node_ip_serviceregistry>:8761 or via tail -fn 30 /var/log/apiomat-serviceregistry.log) and start the Monitroing services on node 1 and node 2.