package com.traiana.utils.mq; import com.ibm.mq.MQException; import java.io.PrintStream; public class MQDepth { public static void main(String[] args) { int depth = 0; int warning = 2147483647; int critical = 2147483647; if (args.length < 5) { System.out.println("usage: java com.traiana.utils.mq.MQDepth [qmgr] [port] [mqServerName] [channelName] [queueName] {-w [warning threshold]} {-c [critical threshold]} {-debug}"); System.exit(3); } MQ sender = null; try { boolean debug = false; for (int i = 4; i < args.length; i++) { String arg = args[i]; if (arg.equals("-w")) warning = Integer.parseInt(args[(i + 1)]); else if (arg.equals("-c")) critical = Integer.parseInt(args[(i + 1)]); else if (arg.equals("-debug")) debug = true; } sender = new MQ(args[0], Integer.parseInt(args[1]), args[2], args[3], 0, debug); sender.InitQueue(args[4], true); depth = sender.getDepth(); } catch (Exception e) { //e.printStackTrace(); System.out.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(3); } finally { if (sender != null) try { sender.close(); } catch (MQException e) { e.printStackTrace(); } } if (depth < warning) { System.out.println("OK: depth=" + depth); System.exit(0); } else if (depth >= critical) { System.out.println("CRITICAL: depth=" + depth); System.exit(2); } else { System.out.println("WARNING: depth=" + depth); System.exit(1); } } } /* Location: C:\Users\thn\workspace\mq-utils.jar * Qualified Name: com.traiana.utils.mq.MQDepth * JD-Core Version: 0.6.2 */