Open Tin-Cup opened 1 year ago
Hey, sorry you haven't gotten a response on this issue yet. Are you still experiencing the problem?
It does look like the issue is with the classpath like you said. Specifically, it can't find the AS400 class which should be included in the jt400.jar file. I hit the exact same error if I temporarily removed the jar file. Can you confirm that does exist in the "/usr/local/nagios/libexec" directory? If it does you could verify it actually includes the class that is missing. You can do that by navigating to the directory, running "vim jt400.jar", and the searching for "com/ibm/as400/access/AS400.class". If all that is still there, I'm not sure what the problem would be. However, if you're still trying to resolve this issue I could try looking into it some more.
I looked into it further and I believe I reproduced the problem. It seems like the built nagios4i.jar file did not have include the jt400.jar file when it was built back in 2021. However, the shell commands don't add the jt400.jar file to the class path. I plan to push a change to the repo eventually that should resolve this. In the meantime though, you should be able to fix this by updating "/usr/local/nagios/libexec/host_config.sh" from:
#!/bin/bash
java -cp /usr/local/nagios/libexec/nagios4i.jar com.ibm.nagios.config.HostConfig $1 $2
To:
#!/bin/bash
java -cp "/usr/local/nagios/libexec/nagios4i.jar:/usr/local/nagios/libexec/jt400.jar" com.ibm.nagios.config.HostConfig $1 $2
Hi,
thanks. That is exactly what i did to get this solved, but forgot to comment it here.
Following error occured during setup of Nagios for IBMi (https://www.ibm.com/support/pages/node/1166188) step 3 for a IBMi lpar on the Nagios server:
[root@xxxxxxx nagios]# /bin/bash /usr/local/nagios/libexec/host_config.sh -i host Input the host address(IP):XXXXXXXXX Input the userID:YYYYYYYY Input the password: Confirm the password: Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/as400/access/AS400 at com.ibm.nagios.config.HostConfig.Insert(HostConfig.java:113) at com.ibm.nagios.config.HostConfig.main(HostConfig.java:82) Caused by: java.lang.ClassNotFoundException: com.ibm.as400.access.AS400 at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 2 more
Using nagios-plugin-for-IBM-i_20211112.tar on Nagios Core 4.4.14 tried to set $CLASSPATH to jar files, but still same result.....
How to fix this problem to add a IBMi lpar to Nagios server?