Skip to content

Commit fdb14df

Browse files
authored
Merge branch 'master' into feature/issue29_endless_loop
2 parents c7922f4 + c90c8e8 commit fdb14df

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ Steps, that need to be taken to build the exporter:
138138
mvn package
139139
```
140140

141-
4. After processing is completed, go to mq-java-exporter/target. dependency-jars directory and mq_exporter.jar should appear there.
141+
4. After processing is completed, go to mq-java-exporter/target. lib directory and mq_exporter.jar should appear there.
142142

143143
#### Run
144144
<sub><sup> [Back to TOC.](#table-of-contents) </sup></sub><br/>
145-
To run exporter, dependency-jars directory (and all jars in it) and
145+
To run exporter, lib directory (and all jars in it) and
146146
mq_exporter.jar should be located in the same folder.
147147

148148
##### Running exporter as mq service

lib/com.ibm.mq.allclient.jar

-7.83 MB
Binary file not shown.

pom.xml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,32 @@
88
<packaging>jar</packaging>
99
<properties>
1010
<jdk.version>1.8</jdk.version>
11-
<mq.allclient.version>9.0.0.1</mq.allclient.version>
11+
<mq.allclient.version>9.1.2.0</mq.allclient.version>
1212
<snakeyaml.version>1.23</snakeyaml.version>
1313
<prometheus.version>0.6.0</prometheus.version>
1414
<log4j.version>2.11.2</log4j.version>
15-
<mq.allclient.jar.path>/lib/com.ibm.mq.allclient.jar</mq.allclient.jar.path>
1615
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1716
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
1817
</properties>
1918
<dependencies>
20-
<!--When patch from IBM would appear - we will use latest version from Maven repo -->
21-
<!-- <dependency><groupId>com.ibm.mq</groupId><artifactId>com.ibm.mq.allclient</artifactId><version>9.0.5.0</version></dependency>-->
22-
<!-- <dependency><groupId>com.ibm.mq</groupId><artifactId>com.ibm.mq.allclient</artifactId><version>${mq.allclient.version}</version><scope>system</scope></dependency>-->
2319
<dependency>
2420
<groupId>com.ibm.mq</groupId>
2521
<artifactId>com.ibm.mq.allclient</artifactId>
2622
<version>${mq.allclient.version}</version>
27-
<scope>system</scope>
28-
<systemPath>${basedir}${mq.allclient.jar.path}</systemPath>
23+
<exclusions>
24+
<exclusion>
25+
<groupId>org.bouncycastle</groupId>
26+
<artifactId>bcprov-jdk15on</artifactId>
27+
</exclusion>
28+
<exclusion>
29+
<groupId>org.bouncycastle</groupId>
30+
<artifactId>bcpkix-jdk15on</artifactId>
31+
</exclusion>
32+
<exclusion>
33+
<groupId>javax.jms</groupId>
34+
<artifactId>javax.jms-api</artifactId>
35+
</exclusion>
36+
</exclusions>
2937
</dependency>
3038
<dependency>
3139
<groupId>org.yaml</groupId>
@@ -81,7 +89,7 @@
8189
<!-- Jar file entry point -->
8290
<addClasspath>true</addClasspath>
8391
<mainClass>ru.cinimex.exporter.ExporterLauncher</mainClass>
84-
<classpathPrefix>dependency-jars/</classpathPrefix>
92+
<classpathPrefix>lib/</classpathPrefix>
8593
</manifest>
8694
</archive>
8795
</configuration>
@@ -99,7 +107,7 @@
99107
</goals>
100108
<configuration>
101109
<includeScope>runtime</includeScope>
102-
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
110+
<outputDirectory>${project.build.directory}/lib/</outputDirectory>
103111
</configuration>
104112
</execution>
105113
</executions>

src/main/java/ru/cinimex/exporter/mq/MQPCFSubscriber.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,22 @@ private void updateMetricsWithWildcards(PCFMessage[] pcfResponse) {
115115
/**
116116
* Retrieves info about all objects from input array via direct pcf commands.
117117
*
118-
* @param objectNames - input array with objects.
118+
* @param objectNames - input list with objects.
119119
*/
120-
private void updateWithDirectPCFCommand(ArrayList<String> objectNames) {
120+
private void updateWithDirectPCFCommand(List<String> objectNames) {
121121
for (String objectName : objectNames) {
122122
MQObject directObject = new MQObject(objectName, object.getType());
123123
try {
124124
PCFMessage[] directPCFResponse = agent.send(directObject.getPcfCmd());
125125
updateMetricWithoutWildcards(directPCFResponse[0], objectName);
126126
} catch (PCFException e) {
127127
//This error means, that channel has status "inactive".
128-
if (e.reasonCode == MQConstants.MQRCCF_CHL_STATUS_NOT_FOUND) {
128+
if (object.getType() == MQObject.MQType.CHANNEL && e.reasonCode == MQConstants.MQRCCF_CHL_STATUS_NOT_FOUND) {
129129
logger.warn("Channel {} is possibly inactive.", objectName);
130130
MetricsManager.updateMetric(MetricsReference.getMetricName(object.getType()), MetricsReference.getMetricValue(object.getType(), MQConstants.MQCHS_INACTIVE), queueManagerName, objectName);
131+
} else if (object.getType() == MQObject.MQType.LISTENER && e.reasonCode == MQConstants.MQRC_UNKNOWN_OBJECT_NAME) {
132+
MetricsManager.updateMetric(MetricsReference.getMetricName(object.getType()), MetricsReference.getMetricValue(object.getType(), MQConstants.MQSVC_STATUS_STOPPED), queueManagerName, objectName);
133+
logger.warn("Listener {} is possibly stopped.", objectName);
131134
} else {
132135
logger.error("Error occurred during sending PCF command: ", e);
133136
}
@@ -165,13 +168,14 @@ public void run() {
165168
}
166169
logger.debug("PCF response for object type {} with name {} was processed successfully.", object.getType(), object.getName());
167170
} catch (PCFException e) {
168-
if (e.reasonCode == MQConstants.MQRCCF_CHL_STATUS_NOT_FOUND) {
171+
if (object.getType() == MQObject.MQType.CHANNEL && e.reasonCode == MQConstants.MQRCCF_CHL_STATUS_NOT_FOUND) {
169172
logger.warn("Channel {} is possibly inactive.", object.getName());
170173
MetricsManager.updateMetric(MetricsReference.getMetricName(object.getType()), MetricsReference.getMetricValue(object.getType(), MQConstants.MQCHS_INACTIVE), queueManagerName, object.getName());
171-
}
172-
if (object.getType() == MQObject.MQType.LISTENER && e.reasonCode == MQConstants.MQRC_UNKNOWN_OBJECT_NAME) {
174+
} else if (object.getType() == MQObject.MQType.LISTENER && e.reasonCode == MQConstants.MQRC_UNKNOWN_OBJECT_NAME) {
173175
MetricsManager.updateMetric(MetricsReference.getMetricName(object.getType()), MetricsReference.getMetricValue(object.getType(), MQConstants.MQSVC_STATUS_STOPPED), queueManagerName, object.getName());
174176
logger.warn("Listener {} is possibly stopped.", object.getName());
177+
} else {
178+
logger.error("Error occurred during sending PCF command: ", e);
175179
}
176180
} catch (MQException | IOException e) {
177181
logger.error("Error occurred during sending PCF command: ", e);

0 commit comments

Comments
 (0)