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; boolean debug = false; 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); } 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; } String qmgr = args[0]; int port = Integer.parseInt(args[1]); String mqServerName = args[2]; String channelName = args[3]; String queueName = args[4]; try (MQ sender = new MQ(qmgr, port, mqServerName, channelName, 0, debug) ) { sender.InitQueue(queueName, true); depth = sender.getDepth(); } catch (Exception e) { //e.printStackTrace(); System.out.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(3); } 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 */