Accessibility

ColdFusion Article

 

ColdFusion 8 server monitoring – Part 3: Automated monitoring and request management with Alerts and Snapshots


Table of Contents

Substantial diagnostic details with Snapshots

The second major feature discussed in this part of the series on the Server Monitor will be the Snapshots feature. Have you ever wished you could gather a list of all the pertinent statistics about the processing of your ColdFusion environment, such as how many requests are running or queued, or how much memory is free or used? It's true that this information is available in the Server Monitor interface, but what if you wanted that information stored in a file as of a point in time?

Some of you may know that this sort of information can indeed be gathered in log files by enabling something called JRun metrics, which (if enabled) are typically written at regular intervals to the same -out log file described in previous sections.

But what if you also wanted to see such details as the number of cached queries, the query cache hit ratio, and, optionally, details on each cached query and the total size in bytes of the query cache? Or information on each data source and its database pooling statistics? Or a Java stack trace (or thread dump) of the ColdFusion environment? This is information that just isn't provided in any ColdFusion logs, but it is available with the new Snapshots feature, which is a text file with all this information and more.

The Snapshots page

The previous discussion of available Alert actions mentioned that you could create a snapshot when an alert was triggered. However, snapshots are such a valuable feature that there's a separate interface in the Server Monitor, which can be used independently of alerts, to trigger and view snapshots. It has its own tab at the top of the Server Monitor interface (see Figure 3).

The Snapshots page

Figure 3. The Snapshots page

But the Snapshots page does list only those snapshots that are created manually using the Trigger Snapshot button on this page. As mentioned in the Alerts section, to view snapshots created as a result of an alert, you use the Alerts page in the Alerts tab.

Viewing snapshots

Whichever list of snapshots you're observing, when you're ready to view one of them, you'll notice an icon displayed to the left of the snapshot. The ones in Figure 3, for instance, are indeed the same ones shown for the alerts that had snapshot icons displayed in Figure 2. Clicking that icon (in either page) will open a display of the snapshot in a new browser window.

The snapshot is, in fact, just a plain text file that may possibly have hundreds of lines of information, depending on the number of applications and users running in your environment at the time the snapshot is taken. A subset of that information is shown in Figure 4.

Display of snapshot details

Figure 4. Display of snapshot details

Note: As mentioned before, regarding alert-generated snapshots, if you choose both Dump Snapshot and Send Email as actions when configuring an alert, the snapshot will be included as an attachment to the e-mail notification.

Stack traces within the Snapshot

Most of the information in the snapshot is self-explanatory. The stack trace (or “thread dump”) is something perhaps new to some ColdFusion developers and administrators. This is a depiction of all the currently running requests (and other threads, including some running on behalf of the underlying JRun or other J2EE server, as well as threads doing work on ColdFusion’s behalf.) With respect to CFML pages, they also generally show a reference to the exact line of CFML code (and template path) currently executing at the time of the stack trace.

You can learn more about ColdFusion stack traces and thread dumps in articles such as http://www.adobe.com/go/tn_18339. Though this discusses obtaining them in a manual approach, the ColdFusion 8 Server Monitor makes this much easier, and the discussion of how to analyze and interpret stack traces will be very useful.

Accessing past snapshot data

As in the case of Alerts notifications, this display of snapshots will only remain in the Server Monitor as long as ColdFusion is running. Upon restart, the information is cleared. But, as with the alert notifications, the snapshots are not lost either, as the snapshots are saved as text files.

The snapshot files are stored in a snapshots directory under the ColdFusion logs directory. In a stand-alone edition, that directory would be C:\ColdFusion8\logs\snapshots\. The file names used for these snapshots will begin with either snapshot_sysgen (system-generated) for those generated by alerts, or snapshot_usrgen (user-generated) for those generated manually in the Snapshots page. The remainder of the filename is a numeric representation of the current date and time of the dump. The file name for manually-generated snapshots is shown on the Snapshots page itself, while the filename for alert-generated snapshots is shown in the monitor.log file mentioned in the discussion on alerts.

As for managing user-generated snapshot files, the Snapshots page offers an icon next to each snapshot, which, if selected, will delete the snapshot file. Where the section on alerts also discussed how alert notifications could be deleted, that action would also delete any system-generated snapshot associated with that alert.

Snapshots can be useful in understanding the state of your system when problems are starting to happen, to offer you additional diagnostic information that may help resolve those problems. This can of course be useful for post-mortem analysis if a snapshot is taken before a server crash. It can be helpful, as well, to take a snapshot at a quiet time to provide baseline, comparative data.

Where to go from here

The Server Monitor provides online help and it's also documented in the ColdFusion 8 manual, Configuring and Administering ColdFusion.

In the fourth and final part, I'll conclude with discussions of the MultiServer monitor (which is key if you need to manage more than one server), the Admin API (enabling you to access all this monitoring data programmatically), and various Monitor configuration settings (including how better to monitor requests for frameworks or other front controllers where all requests go through a single index.cfm).

Check out the other parts of the ColdFusion 8 server monitoring series: