web stats
External Mirth Monitoring...how I did it - Mirth Community

Go Back   Mirth Community > Mirth Connect > General Discussion

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11-15-2012, 08:10 AM
Bostad Bostad is offline
Level 85 Channel Wizard
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default External Mirth Monitoring...how I did it

Howdy All;

A few weeks back we had an issue with some hardware that caused Mirth to slow down to a crawl on certain channels. (It was actually a cascading problem coupled with our HIS).

I have custom email alerts in Mirth that email me when a problem occurs. The issue here was that they were late coming (and I missed them in a deluge of email).

My boss likes it when I know about problems before the users notice. He asked me to come up with a solution where alerts wouldn't rely on Mirth. "What if Mirth is completely down?" was his question.

What I came up with was a web (intranet) based solution involving PHP, MYSQL, and of course JQuery, Javascript and HTML.

This is how it works.

I add a destination in a channel I want to monitor;
For every message is writes timelag (difference between MSH time and system time) , error count and queue count to a table in the MYSQL database.

After that is deployed and starts writing to the database, a script I have triggered by a refreshing webpage on my "webserver" (an XP VM box), writes the channel to a table storing monitored channels.

The same scheduler webpage triggers a PHP script that does the following:

Checks the last time Mirth updated the current metrics table and triggers an alarm if its been too long.

If it passes that, for each channel in the database it:

-checks how long there has been no activity
-what the message lag is
-trends queue and error rates over the past 5 minutes

If any of these values exceed parameters, it triggers an alarm and emails the appropriate people (sms functionality coming soon!).

It will cancel the alert if the condition goes away, or resend the alert email every 60 minutes.

I also created a dashboard of sorts to show statistics and alert history (screen shot attached).

I've still got a couple off things to work out, after that, if I can find the time to clean up and comment my code, I'll post everything on my blog.
Attached Images
File Type: jpg mirthmonv1.jpg (326.9 KB, 368 views)
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com

Test all my code suggestions prior to implementation
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 12:15 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation