/[projects]/miscJava/thn_mqutils/src/com/traiana/utils/mq/MQDepth.java
ViewVC logotype

Annotation of /miscJava/thn_mqutils/src/com/traiana/utils/mq/MQDepth.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1980 - (hide annotations) (download)
Fri May 10 09:16:32 2013 UTC (11 years ago) by torben
File size: 1657 byte(s)
Initial import
1 torben 1980 package com.traiana.utils.mq;
2    
3     import com.ibm.mq.MQException;
4     import java.io.PrintStream;
5    
6     public class MQDepth
7     {
8     public static void main(String[] args)
9     {
10     int depth = 0;
11    
12     int warning = 2147483647;
13     int critical = 2147483647;
14    
15     if (args.length < 5) {
16     System.out.println("usage: java com.traiana.utils.mq.MQDepth [qmgr] [port] [mqServerName] [channelName] [queueName] {-w [warning threshold]} {-c [critical threshold]} {-debug}");
17     System.exit(3);
18     }
19     MQ sender = null;
20     try {
21    
22     boolean debug = false;
23     for (int i = 4; i < args.length; i++) {
24     String arg = args[i];
25     if (arg.equals("-w"))
26     warning = Integer.parseInt(args[(i + 1)]);
27     else if (arg.equals("-c"))
28     critical = Integer.parseInt(args[(i + 1)]);
29     else if (arg.equals("-debug"))
30     debug = true;
31     }
32     sender = new MQ(args[0], Integer.parseInt(args[1]), args[2], args[3], 0, debug);
33     sender.InitQueue(args[4], true);
34     depth = sender.getDepth();
35    
36    
37     } catch (MQException e) {
38     e.printStackTrace();
39     System.exit(255);
40     } finally {
41     if (sender != null)
42     try {
43     sender.close();
44     } catch (MQException e) {
45     e.printStackTrace();
46     }
47     }
48    
49     if (depth < warning) {
50     System.out.println("OK: depth=" + depth);
51     System.exit(0);
52     } else if (depth >= critical) {
53     System.out.println("CRITICAL: depth=" + depth);
54     System.exit(2);
55     } else {
56     System.out.println("WARNING: depth=" + depth);
57     System.exit(1);
58     }
59    
60    
61     }
62     }
63    
64     /* Location: C:\Users\thn\workspace\mq-utils.jar
65     * Qualified Name: com.traiana.utils.mq.MQDepth
66     * JD-Core Version: 0.6.2
67     */

  ViewVC Help
Powered by ViewVC 1.1.20