Nagios Server Communication - Using JAVA Stand alone
-
ravikishore999
- Posts: 5
- Joined: Mon Sep 16, 2013 6:58 am
Nagios Server Communication - Using JAVA Stand alone
Hi Guys,
If any body knows the NAGIOS server communication using JAVA program or any JAVA API. Please let me know how to do that step by step.
Regards,
Ravi
If any body knows the NAGIOS server communication using JAVA program or any JAVA API. Please let me know how to do that step by step.
Regards,
Ravi
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Nagios Server Communication - Using JAVA Stand alone
There are no java specific apis for nagios. You can certainly query the standard CGIs and APIs available via the core interface. Are you looking for some information in particular?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
-
ravikishore999
- Posts: 5
- Joined: Mon Sep 16, 2013 6:58 am
Re: Nagios Server Communication - Using JAVA Stand alone
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
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
Re: Nagios Server Communication - Using JAVA Stand alone
As this is high priority, I would highly suggest you contact the developer of the application, or use the community for the agent:
http://code.google.com/p/jsendnsca/
Even though nsca was developed in house, jsend is a third party community project. I do not think that anyone in the office here has had any experience with this agent . . .
EDIT: And your problem is with an exception in jsend, not with the nsca protocol.
http://code.google.com/p/jsendnsca/
Even though nsca was developed in house, jsend is a third party community project. I do not think that anyone in the office here has had any experience with this agent . . .
EDIT: And your problem is with an exception in jsend, not with the nsca protocol.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
ravikishore999
- Posts: 5
- Joined: Mon Sep 16, 2013 6:58 am
Re: Nagios Server Communication - Using JAVA Stand alone
Hi Guys,
Is there any way to communicate with the NAGIOS server by either PUSH & PULL mechanism is available through JAVA Program ? IF so please let me know the details..
Coomunicate with the nagios server and based on request we need to get it back the monitored specific (groups of) HOST/NETWORK/SERVICE details ? Do you know any kind of JAVA program related to this requirement ? If you know please let me know the ideas or blogs or links ....
Thanks in advance....
Regards,
Ravi
Is there any way to communicate with the NAGIOS server by either PUSH & PULL mechanism is available through JAVA Program ? IF so please let me know the details..
Coomunicate with the nagios server and based on request we need to get it back the monitored specific (groups of) HOST/NETWORK/SERVICE details ? Do you know any kind of JAVA program related to this requirement ? If you know please let me know the ideas or blogs or links ....
Thanks in advance....
Regards,
Ravi
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Nagios Server Communication - Using JAVA Stand alone
Off the top of my head I can't think of any, I don't see many java based apps around that are involved with monitoring. It sounds like you are asking for a java agent equivalent to NSCA or NRPE which there is not.
-
ravikishore999
- Posts: 5
- Joined: Mon Sep 16, 2013 6:58 am
Re: Nagios Server Communication - Using JAVA Stand alone
Yes exactly, did you know any JAVA agents which are ready to communicate with nagios server and get the results or LIVE status of the NAGIOS server monitored devices or networks or Applications etc ?
Please update me if you know any such kind of tools or agents or code what ever it may be.....
Thanks in advance....
Regards,
Ravi
Please update me if you know any such kind of tools or agents or code what ever it may be.....
Thanks in advance....
Regards,
Ravi
Re: Nagios Server Communication - Using JAVA Stand alone
Not really. You could write your own java app to get the html from the cgi's and scrape the information you need. There is a JSON branch for core 4 that offers a cgi GET interface for ajax calls to retrieve status and object information in JSON format.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
ravikishore999
- Posts: 5
- Joined: Mon Sep 16, 2013 6:58 am
Re: Nagios Server Communication - Using JAVA Stand alone
Hi abrist,
How to do the JSON branch for core 4 CGI and all those things, from where i can get those. Could you please give me the link of the sites URLs....
Thanks in advane.....
Regards,
Ravi
How to do the JSON branch for core 4 CGI and all those things, from where i can get those. Could you please give me the link of the sites URLs....
Thanks in advane.....
Regards,
Ravi
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Nagios Server Communication - Using JAVA Stand alone
Followed the Google tree: "JSON branch for core 4"
And that leads us here, which should be the correct branch:
http://sourceforge.net/p/nagios/nagiosc ... json/tree/
And that leads us here, which should be the correct branch:
http://sourceforge.net/p/nagios/nagiosc ... json/tree/