org.jboss.soa.esb.nagios.transport
Class NagiosNSCAPacket

java.lang.Object
  extended by org.jboss.soa.esb.nagios.transport.NagiosNSCAPacket

public class NagiosNSCAPacket
extends java.lang.Object

Representation of a Nagios NSCA data packet. The C implementation of Nagios NSCA uses a struct to represent this data. This class constructs a byte array that mirrors that struct. There are some tricky bits here that may need adjustment for new versions of Java, new versions of GCC, or different versions of the Nagios NSCA daemon process compiled on different hardware architectures.


Constructor Summary
NagiosNSCAPacket(long timestamp, int returncode, java.lang.String host, java.lang.String servicename, java.lang.String message)
          Construct a new packet with the provided information
NagiosNSCAPacket(java.lang.String host, java.lang.String servicename, ServiceResponse response)
           
 
Method Summary
static void clearChecksumInPacket(byte[] packet)
           
 byte[] getData()
           
 java.lang.String getHost()
           
 java.lang.String getMessage()
           
 int getReturncode()
           
 java.lang.String getServicename()
           
 long getTimestamp()
           
 void setHost(java.lang.String host)
           
 void setMessage(java.lang.String message)
           
 void setReturncode(int returncode)
           
 void setServicename(java.lang.String servicename)
           
 void setTimestamp(long timestamp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NagiosNSCAPacket

public NagiosNSCAPacket(long timestamp,
                        int returncode,
                        java.lang.String host,
                        java.lang.String servicename,
                        java.lang.String message)
Construct a new packet with the provided information

Parameters:
timestamp - use the one provided upon first connection unless time on server and client are accurately synchronized
returncode - the returncode of the check
host - the Nagios host name we are reporting for
servicename - the Nagios service name we are reporting for
message - a message to Nagios from the monitor

NagiosNSCAPacket

public NagiosNSCAPacket(java.lang.String host,
                        java.lang.String servicename,
                        ServiceResponse response)
Method Detail

getHost

public java.lang.String getHost()

setHost

public void setHost(java.lang.String host)

getMessage

public java.lang.String getMessage()

setMessage

public void setMessage(java.lang.String message)

getReturncode

public int getReturncode()

setReturncode

public void setReturncode(int returncode)

getServicename

public java.lang.String getServicename()

setServicename

public void setServicename(java.lang.String servicename)

getTimestamp

public long getTimestamp()

setTimestamp

public void setTimestamp(long timestamp)

getData

public byte[] getData()

clearChecksumInPacket

public static void clearChecksumInPacket(byte[] packet)