web stats
Mirth Community - View Single Post - DIY Queue Depth Alerts
View Single Post
Old 11-14-2011, 01:44 PM
smeyer smeyer is offline
Mirth Newb
Join Date: Jan 2009
Posts: 12
Default Python

In my experience the channel statistics queue count hasn't been quite what i'm interested in knowing (assuming that's the same value that shows up under the 'Queued' column on the dashboard). Instead when we get a lot of messages in to a channel the only way to see how many messages are backed up has been to count the files in the queuestore folder.

So here is what we're currently doing to track our queues. It uses python, mutt, and runs on linux.

Code is in python
import os
import commands
basedir = '/path-to-appdata/queuestore/'
limit = 30
queueToChannel = {'CHANNEL ID':'CHANNEL NAME'}
#loop through queue folders
for dirname in os.listdir(basedir):
        # ls -l    lists 1 file per line,  wc -l   counts the number of lines returned
        cmd = 'ls -l ' + basedir + dirname + ' | wc -l '
        #get results of wc -l  
        filecount = commands.getoutput(cmd)
                filecount = int(filecount) -1;
                filecount = 0;
        if (filecount > limit):
                commands.getoutput('echo "mirth queuestore ' + dirname + ' representing ' + queueToChannel[dirname] + ' has ' + str(filecount) + ' files" | mutt -s "mirth queuestore for ' + queueToChannel[dirname] + ' is above limit of ' + str(limit) +'" your@emailname.com')
Anywho, this has been helpful for us but does require manual entry of the queueToChannel mappings. Not sure if it'll be helpful for you guys or not, but better to post and find out it wasn't needed than vice versa

Reply With Quote