Yes i am looking for JSEND NSCA is the JAVA API, How to make use that one by sending passive checks to nagios server. I got JAR file JsendNSCA.jar and i am using in my program. The program code is as follows :
public class TestNagios {
public static void main(String[] args) {
System.out.println("Hi Welcone to JSENDNSCA");
NagiosSettings nagiosSettings = new NagiosSettingsBuilder()
.withNagiosHost("hostname-u can give it here/ IP Address")
.withPassword("password")
.withPort(5667)
.withEncryption(Encryption.XOR)
.withConnectionTimeout(50009)
.withResponseTimeout(1500)
.create();
System.out.println("Nagios setting sobject==="+nagiosSettings.getPort());
NagiosPassiveCheckSender sender = new NagiosPassiveCheckSender(
nagiosSettings);
System.out.println("Nagios sender==="+sender);
MessagePayload payload = new MessagePayloadBuilder()
.withHostname("hostname-u can give it here/ IP Address")
.withLevel(Level.CRITICAL)
.withServiceName("Test Service Name")
.withMessage("Test Message")
.create();
System.out.println("Nagios payload==="+payload);
try {
sender.send(payload);
} catch (NagiosException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
After executing this one , I am gettting the error like as follows:
===============================================================================================================================================
Hi Welcone to JSENDNSCA
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/Validate
at com.googlecode.jsendnsca.NagiosSettings.setNagiosHost(NagiosSettings.java:138)
at com.googlecode.jsendnsca.builders.NagiosSettingsBuilder.withNagiosHost(NagiosSettingsBuilder.java:67)
at TestNagios.main(TestNagios.java:41)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.Validate
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 3 more
================================================================================================================================================
I am running the nagios server on Ubuntu Oracle virtual box. It is having some IP address. I am giving the same IP address Over there.
In my local machine i am having the above program. So after executing the above program, I am getting the error as like above. So how to communicate with the Nagios server using JSEND NSCA java API as mentioned in the above program. So, If any body knows ,Please let me know the details regarding this query as early as possible.
This post is very High prioritized one....
Thanks in advance guys......
regards,
Ravi
