Added new class NscaSend.java - 1.4.0

<pre>
Added a new class which provides the equivalent API of the nsca_send.c program. (NscaSend)

Use of this class does not require log4j be used within your application, however it does require that
you include the log4j library on your classpath.

Here is a snippet on how you might choose to use it ...

NscaSend nscaSend = new NscaSend();
nscaSend.setNscaConfigFile("conf/nsca_send_clear.cfg");
nscaSend.setNagiosHost("localhost");
nscaSend.setNagiosPort("5667");
nscaSend.setNagiosVirtualHost("production");
nscaSend.setNagiosServiceName("MyApplication");
nscaSend.setUseShortHostname();
nscaSend.send(NagiosAppender.NAGIOS_CRITICAL,"server: [HOSTNAME]: something bad just happened ....");

Properties customProps = new Properties();
customProps.put("FOO", "foo");
customProps.put("BAR", "bar");
nscaSend.setMessageProperties(customProps);
nscaSend.send(NagiosAppender.NAGIOS_CRITICAL,"server: [HOSTNAME]: checking custom properties .... do you see foobar?: [FOO][BAR]");
</pre>

Posted by Jar Lyons 2009-01-06

Log in to post a comment.