Skip to content

A java library providing a client to send nagios check results to a remote NRDP server

Notifications You must be signed in to change notification settings

knackworks/jsend-nrdp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jsend-nrdp

jsend-nrdp is a java library for submitting Nagios passive check results to a remote NRDP server.

Maven

<dependency>
  <groupId>ch.shamu</groupId>
  <artifactId>jsend-nrdp</artifactId>
  <version>${jsend-nrdp.version}</version>
</dependency>

Configuration

this example uses Spring, but you can use any mean of bean creation.

<bean id="nrdp-connection-settings" class="ch.shamu.jsendnrdp.NRDPServerConnectionSettings">
	<constructor-arg name="url" value="${nrdp.url}"/>
	<constructor-arg name="token" value="${nrdp.token}"/>
	<constructor-arg name="timeout" value="${nrdp.timeout}"/>
</bean>

Async sending of check results

The NonBlockingNagiosCheckSender implementation uses a java Executor to process the "send" in a separate thread. It returns after adding the job in the executor queue, eventual details about errors are logged.

NagiosCheckSender resultSender = new NonBlockingNagiosCheckSender(nrdpConnectionSettings, CONCURRENCY_LEVEL, MAX_BACKLOG_SIZE);
NagiosCheckResult resultToSend = new NagiosCheckResult(host, serviceName, serviceState, notif.getMessage());
Collection<NagiosCheckResult> resultsToSend = Lists.newArrayList();
resultsToSend.add(resultToSend);
try {
	resultSender.send(resultsToSend);
}
catch (Exception e) {
	logger.error("Error sending check result to nagios", e);
}

About

A java library providing a client to send nagios check results to a remote NRDP server

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%