Page 1 of 1

Upgrade from 0.3.9 to 0.5.2

Posted: Tue Nov 12, 2019 2:19 am
by bizertegladbach
Hello,
I have problems to upgrade my nsc.ini config file from the 0.3.9 to the nsclient.ini from the 0.5.2 version. my problem is the external scripts here are the configuration on the 0.3.9

[External Scripts]
check_oracle=modules\check_oracle.bat $ARG1$
check_logfile_sp=modules\check_logfile.exe --config=modules\check_logfile.ini
check_sql_plugin=modules\javaSQLPlugin.bat $ARG1$
check_file_plugin=modules\javaFilePlugin.bat $ARG1$
check_ea=modules\eansplug.bat $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
check_lprqf_plugin=modules\LPRQFPlugin.bat $ARG1$

could some please help me?
Regards

Re: Upgrade from 0.3.9 to 0.5.2

Posted: Tue Nov 12, 2019 3:52 pm
by tgriep
In the new nsclient.ini file, the external script definitions are under this section.

Code: Select all

[/settings/external scripts/scripts]
So make sure they are put there.

Re: Upgrade from 0.3.9 to 0.5.2

Posted: Thu Nov 14, 2019 4:20 am
by bizertegladbach
thank you tgriep

I have one more question, I hope someone could help me

I have java application which is sending reuqests to the nsclient++ plug in. with the version 0.3.9, it' working fine, after installing the new version, I'm getting the error message "ERROR: Failed to parse", could someone help?
the code is like following

initSocket();
return getCounter(counterName);
__________________________________________________________________________________________________
protected void initSocket() throws NSClient4JException {
if(!inited) {
try {
socket = new Socket(hostName, portNumber);
socket.setSoTimeout(socketTimeout);
is = socket.getInputStream();
os = socket.getOutputStream();
bis = new BufferedInputStream(is);
baos = new ByteArrayOutputStream();
inited = true;
}
catch (UnknownHostException ex) {
inited = false;
throw new NSClient4JException("Unknown Host:" + hostName, ex);
}
catch (IOException ex) {
inited = false;
throw new NSClient4JException("Exception Connecting to " + hostName +
":" + portNumber + " -> " + ex, ex);
}
}
}
__________________________________________________________________________________________________
public String getCounter(String commandLine) {
String result = "";
try {
result = submittRequest(commandLine);
} catch (NSClient4JException e ){
e.printStackTrace(System.out);
}
return result;
}
__________________________________________________________________________________________________
protected synchronized String submittRequest(String request) throws NSClient4JException {
byte[] buffer = new byte[1024];
// baos.reset();
String result = null;
if(!inited) {
initSocket();
System.out.println("initialize socket: " + inited);
}
try {
socket.setSoTimeout(socketTimeout);
os.write(request.getBytes());
os.flush();
while (true) {
// System.out.println("buffer: " + buffer + " connected: " + socket.isConnected() + " isOutputShutdown: " + socket.isOutputShutdown() + " bound: " + socket.isBound() );
int read = bis.read(buffer);
//System.out.println("buffer: " + buffer);
if (read > 0) {
baos.write(buffer, 0, read);
break;
}
else {
break;
}
}
result = baos.toString();
testResult(result);
this.close();
inited = false;
return result;
}
catch (Exception ex) {
inited = false;
ex.printStackTrace(System.out);
throw new NSClient4JException(ex.getMessage(), ex);
}
}

Re: Upgrade from 0.3.9 to 0.5.2

Posted: Thu Nov 14, 2019 9:25 am
by tgriep
I would guess that all of the the settings in the nsclient.ini file are not enabled for your plugin so if you can post the nsclient.ini file and the nsc.ini file, we can see what is or is not enabled and let you know what has to be done.

Also, in the C:\Program Files\NSClient++ folder, there should be a nsclient.log file. Check that for any errors.