|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.altlinux.jabbix.JabbixProtocol
public class JabbixProtocol
Constants and functions for the base Zabbix agent-server protocol.
The base Zabbix protocol for agent-server communication is a kind of a simple binary protocol and is used to transfer arbitrary portions of data between a Zabbix-compatible agent (for instance, Jabbix based program) and a Zabbix server.
Each such a transfer is called a message. Each message has the following form (structure):
| 4 Bytes | 1 Byte | 8 Bytes | LENGTH Bytes | HEADER VERION LENGTH MESSAGE DATAThe
HEADER
field is a 4 byte 4 ASCII character sequence, currently
defined as ZBXD
. The next VERSION
one byte width
field states the used protocol version. The supported version now
is 1 (which is 01h).
The next 8 byte field LENGTH
contains the little-endian 64
bit integer number defining the length of the next MESSAGE
DATA
part. All numeric data is presented as little-endian numbres
too.
For compatibility and to simplify the agent-server programs, the another separator-based protocol can be used. In that protocol the messages has no predefined structure, instead of that one of the separator characters is used to mark the end of each message. Because of the newline character (0Ah) is also in separator set, the plaintext messages can be transferred as is.
The main use of the unstructured plaintext message protocol is the Zabbix server to passive agent communication: the server sends a plaintext metric key to the passive agent without any header. However, the agent is not restricted to use the plaintext protocol and can answer using the structured version if convenient.
Also, the unstructurred answers can be originated by a Zabbix server in some cases.
AgentServer
Field Summary | |
---|---|
static int |
AGENT_PORT
The default agent port number (10050). |
static String |
HEADER
Four-letter protocol header. |
static String |
SEPARATORS
The set of message separators. |
static int |
SERVER_PORT
The default Zabbix server port number (10051). |
static String |
VERSION
Protocol version (one byte). |
Constructor Summary | |
---|---|
JabbixProtocol()
|
Method Summary | |
---|---|
static JabbixReader |
getReader(InputStream in)
Returns a reader connected to the specified stream. |
static JabbixWriter |
getWriter(OutputStream out)
Returns a writer connected to the specified stream. |
static boolean |
isSeparator(char c)
Indicates if the specified character is a message separator. |
static String |
removeSeparators(String str)
Returns the given string with all separator characters removed. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String HEADER
For Zabbix the character sequence ZBXD
is used.
public static String VERSION
Currently the protocol version is 1 (01h).
public static String SEPARATORS
If length of the message is not explicitly stated in the header, the end of the message is determined by a separator character. This string contains the sequence of that sort of characters.
Currently the separator characters are:
public static int AGENT_PORT
public static int SERVER_PORT
Constructor Detail |
---|
public JabbixProtocol()
Method Detail |
---|
public static JabbixReader getReader(InputStream in)
in
- the input stream to read from
public static JabbixWriter getWriter(OutputStream out)
out
- the output stream to write to
public static boolean isSeparator(char c)
c
- the character to test
SEPARATORS
public static String removeSeparators(String str)
str
- a string
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |