Notifications

161 views

Issue:

After upgrading NagiosXI to 5.5.2 the connector no longer works - classCastException error: failed to run 3PC java.lang.ClassCastException

 

The cause:

The issue started when customer upgraded NagiosXI 5.5.1 to 5.5.2. 

 

  1. When you run "test connector" it works correctly.  
  2. When the connector schedule runs it encounters the following error "classCastException error: failed to run 3PC java.lang.ClassCastException"

 

The solution:

In MID Server Script Include NagiosXI: 

1.   script include > NagiosXI

2.   Replace the getJSONFromResponse function with the following:

-------

getJSONFromResponse : function (response) { 

if (response == null) { 
this.addError("NagiosJS Connector: Failed to bring data. Null response"); 
return null; 


if (response.getStatusCode() != 200) { 
this.addError("NagiosJS Connector Error Code: " + response.getStatusCode()); 
return null; 


var parser = new JSONParser(); 
var resultJson = parser.parse(response.getBody() ); 

if (resultJson.error != undefined) { 
this.addError("NagiosJS Connector: Failed to bring data: " + resultJson.error); 
return null; 

var res; 
if (!resultJson.statehistory) { 
res.statehistory = resultJson; 
} else { 
res = resultJson; 

ms.log("NagiosJS Connector: res stringify " + JSON.stringify(res)); 
ms.log("NagiosJS Connector: Found " + res.statehistory.recordcount + " records"); 
return res; 

}, 

---

The official fix will be in the future London release.

Article Information

Last Updated:2018-08-13 18:04:07
Published:2018-08-14