This post gives an Introduction to Server Monitoring Enhancements in CF 9 updater 1. Server Monitoring helps the user to monitor various statistics such as slow requests, load at any point of time, active requests, requests with errors etc,. In the updater version of ColdFusion, an embedded server - Jetty is added which listens to a different port: 5500. A page - Monitoring Settings is added to the administrator where in the user can check the current status of server monitor. This avoids the step of launching and checking whether monitoring, profiling and memory tracking are enabled/disabled.
Configuring and starting Server Monitor:
By default Server Monitor will run on the same port on which coldfusion is running (i.e. without Jetty). However, to improve the performance the embedded server jetty can be enabled. There are three ways of starting Server monitoring with Jetty on a different port:
- ColdFusion administrator: Sever Monitoring -> Monitoring Settings.
- Manually by configuring jetty.xml and neo-monitoring.xml
- Using Admin API.
Configure and start Server Monitor using the Administrator:
Login into the administrator with the administrator credentials and navigate to Server Monitoring -> Monitoring settings.
The monitoring settings page shows the current status of the Server Monitor; one can enable/disable the same. To enable Jetty check Enable Monitoring Server and specify the port. By default port 5500 will be used. Changes made here will be reflected in the jetty.xml file which can be found in the lib directory. Any attempt made to change the port to a port which is currently not available will result in an error.
Manually by configuring jetty.xml and neo-monitoring.xml:
Monitoring server can be started manually by setting 'ismonitoringserverenabled' in neo-monitoring.xml to true and restarting the server so that the changes are picked up. As mentioned earlier, the default port at which monitoring server would start is 5500. One can change this in jetty.xml file. One can always change the port number to any other number by referring jetty.xml connector section
Configure and start Server Monitor using Admin API:
Several methods have been added to servermonitoring.cfc, these can be used to configure server monitor. The list of methods added are as mentioned below:
- setMonitoringServerPort(port_number): This method will change the monitoring server port to the port_number passed in as an argument. As mentioned earlier 5500 port will be used as a default port. However this will not start the monitoring server.
- getMonitoringServerPort(): This method returns the current monitoring server port number.
- getMonitoringServerProtocol(): This method will return http or https based on jetty.xml configuration.
- stopMonitoringServer(): This method will stop monitoring server.
- startMonitoringServer(): This method will start monitoring server.
- isMonitoringServerRunning(): This method will check whether a separate monitoring server is running.
- configureMonitoringServer(flag,port_number): This method can be used to start/stop the monitoring server.
- flag (true/false): when set to true will start the monitoring server.
- port_number: port at which a separate monitoring server should start.
With CF 901 a page Monitoring Settings was added under Server Monitoring section. One can not only enable/disable the monitoring server and monitoring port but can also start/stop server monitoring settings: Monitoring, Profiling and Memory tracking. This will also avoid the step of launching the server monitor to check the status of the same.