jensritter / jsendnsca-original Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/jsendnsca
Automatically exported from code.google.com/p/jsendnsca
[deleted issue]
Following testcase should pass
@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionForInvalidLevel() throws
Exception {
final MessagePayload messagePayload = new MessagePayload();
messagePayload.setLevel(4);
}
You should only be able to set level to 0,1,2,3
Original issue reported on code.google.com by rajneeshpatel
on 18 Dec 2008 at 11:07
The current mock is unreliable and doesnt allow inspection of sent passive
checks.
Need to implement new one which is more reliable and allows you to return a
list of recieved checks for inspection.
Original issue reported on code.google.com by rajneeshpatel
on 3 May 2009 at 9:34
The NonBlockingNagiosPassiveCheckSender does not offer any shutdown method so
you can
properly shut it down. This is needed in hot deployable environments such as
OSGi or Tomcat etc
where you may hot deploy you apps.
I have created a patch with a public method for that.
Also I exposed a setter to set a custom executor if you need to be in full
control of which thread
it uses. People using J2EE servers may want to let it use a pool from those
servers.
Or e.g. at Apache we like to control the thread pool as well to also include a
thread name so you
can see what the thread does.
See for example this Helper class we use to create executors in Camel
https://svn.apache.org/repos/asf/camel/trunk/camel-
core/src/main/java/org/apache/camel/util/concurrent/ExecutorServiceHelper.java
Original issue reported on code.google.com by [email protected]
on 13 Jan 2010 at 9:54
I've implemented triple-DES support and here's a patch.
Obviously being security-related it ought to be reviewed by a security
expert, but it works for me. :-)
Original issue reported on code.google.com by [email protected]
on 8 Apr 2009 at 5:54
Attachments:
As very little of the commons jars are being used, remove them and replace
the functionality provided with an in built StringUtils and IOUtils.
Original issue reported on code.google.com by rajneeshpatel
on 1 Dec 2008 at 8:47
Story
As an API user, I want to be able to download the API and required
dependencies so that I can easily incorporate the API into my project
Notes
Need Maven to create zip and tar.gz archives which contains
* jsendnsca jar
* dependencies in lib folder with further test subfolder for test deps
* javadocs
* source
* pom
Original issue reported on code.google.com by rajneeshpatel
on 26 Jan 2010 at 9:00
In concurrent environments such as the project I work on which is Apache Camel
http://camel.apache.org/
We will have concurrent routing which may simultaneously send alerts to Nagios
and if using the
MessagePayloadBuilder then that will cause concurrency issues as its not thread
safe. It does have a
shared instance which multiple threads access. What happens is that the builder
will return a
message with data from DIFFERENT threads.
I have attached a patch to make it thread safe by not using static methods.
Original issue reported on code.google.com by [email protected]
on 13 Jan 2010 at 9:23
This exception in NagiosPassiveCheckSender
Error occured while sending passive alert
occured -> occurred
It should have 2 r in the name
Original issue reported on code.google.com by [email protected]
on 13 Jan 2010 at 9:29
I tried using the Command line client and api to send NSCA message and the
application says it is sent, but I can't see any message in nagios.log
But at the same time actual C implementation of NSCA client works properly.
Original issue reported on code.google.com by [email protected]
on 19 May 2009 at 4:06
When sending a passive check the following parts are mandatory
1. Hostname
2. Return code (level)
3. Service name
The MessagePayload object should enforce the above. If this is voilated, an
IllegalArgumentException needs to be thrown
Original issue reported on code.google.com by rajneeshpatel
on 18 Nov 2008 at 8:34
So that I can build NagiosSettings easily and more readably, as a
Developer, I would like a NagiosSettingsBuilder class
Original issue reported on code.google.com by rajneeshpatel
on 11 Feb 2009 at 9:32
Hi Jeremy, Claus
First of, Jeremy, meet Claus who has done some great work recently on
raising and fixing bugs. Claus is currently working on a Apache Camel
component which will use the API
http://issues.apache.org/activemq/browse/CAMEL-2347
I have started work on version 2.0. Essentially, taken the 1.3.1 codebase
and tidied it up e.g.
* Using enums now only instead of integers which removes a load of
validation to make sure people are setting valid levels, encryption etc
* Exposed Encryptor interface so people can roll their own encryption as
NSCA supports a whole host of which only a subset are currently
implemented
* Using nice features of Junit 4.7 such as expected exception rule and
replaced IllegalArgument checks with Validate class from commons-lang
Main thing is now using Maven for build/project management. Want to
automate as much of the release process as possible
Please feel free to check out, project is no simply called jsendnsca in trunk
If you guys have any ideas, improvements etc, can you raise issues and we
can manage them between us to ensure they make this release
Also, Claus, any experience on getting an artifact into the maven repos, I
understand this could take a while
Many thanks
Raj
Original issue reported on code.google.com by rajneeshpatel
on 24 Jan 2010 at 10:41
It would be good if we have access to a .jar which have the test classes for
unit testing.
For example this class is handy
com.googlecode.jsendnsca.core.mocks.NagiosNscaStub
Maybe there are a couple of other classes as well.
Original issue reported on code.google.com by [email protected]
on 12 Jan 2010 at 2:49
So that I can easily package a distribution of JSend NCSA, I would like to
automate the build of the distribution and upload of it
Original issue reported on code.google.com by rajneeshpatel
on 17 Nov 2008 at 12:19
Generate HTML test report from running JUnit tests
Original issue reported on code.google.com by rajneeshpatel
on 19 Jan 2009 at 3:21
The frontpage uses the static builders which has been changed in 1.3 onwards.
Maybe change the frontpage to the new style and add a note about using older
versions then with a
link to a new page with the same example using 1.2 style.
Original issue reported on code.google.com by [email protected]
on 18 Jan 2010 at 9:09
We should target against JDK 1.5 so a lot more users can use it out of the box
For example you get when using compiling a project which uses jsendnsca and
that project uses
JDK 1.5.
/Users/davsclaus/workspace/camel/components/camel-
nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java:
[19,-1]
cannot access com.googlecode.jsendnsca.core.NagiosSettings
bad class file: /Users/davsclaus/.m2/repository/com/googlecode/jsendnsca-
core/1.3.0/jsendnsca-core-1.3.0.jar(com/googlecode/jsendnsca/core/NagiosSettings
.class)
class file has wrong version 50.0, should be 49.0
Original issue reported on code.google.com by [email protected]
on 18 Jan 2010 at 5:47
For the MessagePayload object, when setting the level via a string, if the
String is not OK, WARNING or CRITICAL, it sets the level as UNKNOWN
Should really throw an IllegalArgumentException instead if not one of the
following
OK
WARNING
CRITICAL
UNKNOWN
Also, should allow case insensitive setting so OK, ok or Ok should all work.
Original issue reported on code.google.com by rajneeshpatel
on 19 Nov 2008 at 7:36
Often, a non-blocking sender is preferable so that when sending passive
checks, your main applications threads are not blocking, especially when
there are network issues slowing down delivery of passive checks to NSCA.
This is especially important if NSCA is slow or your requests are timing
out. With a non-blocking NagiosPassiveCheckSender, it can implement
internal queuing and a retry strategy, freeing up you application to carry
on processing.
If after a retry strategy is employed and the request stills fail, an
alternative action can be taken i.e. logging to a file.
Original issue reported on code.google.com by rajneeshpatel
on 12 Feb 2009 at 10:17
What steps will reproduce the problem?
this code sends an alert to nagios using the maximum size for all fields:
import java.io.IOException;
import com.googlecode.jsendnsca.core.MessagePayload;
import com.googlecode.jsendnsca.core.NagiosException;
import com.googlecode.jsendnsca.core.NagiosPassiveCheckSender;
import com.googlecode.jsendnsca.core.NagiosSettings;
import com.googlecode.jsendnsca.core.builders.MessagePayloadBuilder;
import com.googlecode.jsendnsca.core.builders.NagiosSettingsBuilder;
public class Example {
public static void main(String argv[]){
NagiosSettings nagiosSettings = NagiosSettingsBuilder
.withNagiosHost("localhost")
.withPort(5667)
.withConnectionTimeout(5000)
.withResponseTimeout(15000)
.withPassword("hasturrocks")
.create();
NagiosPassiveCheckSender sender = new NagiosPassiveCheckSender(
nagiosSettings);
final int MAX_HOSTNAME_SIZE = 64;
final int MAX_SERVICE_NAME_SIZE = 128;
final int MAX_MESSAGE_SIZE = 512;
byte[] maxHostnameBytes = new byte[MAX_HOSTNAME_SIZE];
byte[] maxServiceNameBytes = new byte[MAX_SERVICE_NAME_SIZE];
byte[] maxMessageBytes = new byte[MAX_MESSAGE_SIZE];
for(int i = 0; i < MAX_HOSTNAME_SIZE; i++){
maxHostnameBytes[i] = 'X';
}
String maxHostname = new String(maxHostnameBytes);
for(int i = 0; i < MAX_SERVICE_NAME_SIZE; i++){
maxServiceNameBytes[i] = 'Y';
}
String maxServiceName = new String(maxServiceNameBytes);
for(int i = 0; i < MAX_MESSAGE_SIZE; i++){
maxMessageBytes[i] = 'Z';
}
String maxMessage = new String(maxMessageBytes);
MessagePayload payload = MessagePayloadBuilder
.withHostname(maxHostname)
.withLevel(0)
.withServiceName(maxServiceName)
.withMessage(maxMessage)
.create();
try {
sender.send(payload);
} catch (NagiosException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
What is the expected output? What do you see instead?
nsca only shows 63 characters for the host name, 127 characters for the
service name and 511 characters for the message. Since nsca is written in C
it needs any string to be null terminated meaning that even though a nsca
packet has 64 bytes for the host name the last one would always need to be
'\0'.
Rather than imply that a 64 character host name sent by jsendnsca would
actually make it to nsca, it would probably be better to only try sending
63 in the first place.
The same kind of problem exists for the service name and the message too.
Original issue reported on code.google.com by [email protected]
on 19 Dec 2009 at 9:43
Hi,
it would be great to use bundlor or bnd to generate an OSGI-compatible
manifest. This allows jsendnsca to be integrated in an osgi environment
without custom changes. Both of them run inside ant, so changes would be
minimal.
http://www.springsource.org/bundlor
http://www.aqute.biz/Code/Bnd
Original issue reported on code.google.com by [email protected]
on 10 Jan 2010 at 8:54
I cannot edit front page so please update it with a note about the 1.3.1
release which is the 1.3.0
release that is compiled against Java 1.5 so people using JDK 1.5 can use it as
well in their projects
Original issue reported on code.google.com by [email protected]
on 18 Jan 2010 at 6:04
MessagePayload contains data to be send. We should add a toString so you can
easily log what you
are sending, and when debugging its easier to spot the correct payload as well.
Also the class could be serializable as it just contain String, int data. This
allows you to send a
payload from a remote system to a central sender etc.
Original issue reported on code.google.com by [email protected]
on 13 Jan 2010 at 9:37
NagiosSettings should throw IllegalArgumentException for null or empty strings
Currently, you will get a null pointer exception
Original issue reported on code.google.com by rajneeshpatel
on 19 Nov 2008 at 8:13
For example by testing and sending multiple messages to the NagiosNscaStub
which you then
want to iterate afterwards to check for correct order of messages. Then the
number of messages
is correct but the messages are all the same = the last message that
MessagePayloadBuilder
created.
The create method should prepare a new instance for next builder, but it doesnt
so it end up
overriding with data intended for next message
I have created a patch
public static MessagePayload create() {
MessagePayload answer = instance.payload;
// create a new instance for builder to use next time otherwise we end up
// changing the instance we just created
instance = new MessagePayloadBuilder();
return answer;
}
Original issue reported on code.google.com by [email protected]
on 12 Jan 2010 at 3:49
First of all : thanks for this - it's working like a charm.
The pom-files from maven scares the heck out of me - therefore i have to
make a whish :
Could you seperate the cli-portion ( and commons-cli ) from the main-build
? I only use the api to send notifications.
Original issue reported on code.google.com by [email protected]
on 26 Nov 2008 at 8:20
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.