hi,
i am writing a Zabbix agent in REXX.
Zabbix has its own protocol for messages. If you want to send data tot the zabbix server here are a few examples in other languages:
JAVA:
byte[] header = new byte[] {
'Z', 'B', 'X', 'D', '\1',
(byte)(data.length & 0xFF),
(byte)((data.length >> 8) & 0xFF),
(byte)((data.length >> 16) & 0xFF),
(byte)((data.length >> 24) & 0xFF),
'\0', '\0', '\0', '\0'};
byte[] packet = new byte[header.length + data.length];
System.arraycopy(header, 0, packet, 0, header.length);
System.arraycopy(data, 0, packet, header.length, data.length);
PHP:
$packet = "ZBXD\1" . pack('P', strlen($data)) . $data;
or
$packet = "ZBXD\1" . pack('V', strlen($data)) . "\0\0\0\0" . $data;
Perl:
my $packet = "ZBXD\1" . pack('<Q', length($data)) . $data;
or
my $packet = "ZBXD\1" . pack('V', length($data)) . "\0\0\0\0" . $data;
Python:
packet = "ZBXD\1" + struct.pack('<Q', len(data)) + data
How do i do this in REXX?
any help appreciated!
Allard
i am writing a Zabbix agent in REXX.
Zabbix has its own protocol for messages. If you want to send data tot the zabbix server here are a few examples in other languages:
JAVA:
byte[] header = new byte[] {
'Z', 'B', 'X', 'D', '\1',
(byte)(data.length & 0xFF),
(byte)((data.length >> 8) & 0xFF),
(byte)((data.length >> 16) & 0xFF),
(byte)((data.length >> 24) & 0xFF),
'\0', '\0', '\0', '\0'};
byte[] packet = new byte[header.length + data.length];
System.arraycopy(header, 0, packet, 0, header.length);
System.arraycopy(data, 0, packet, header.length, data.length);
PHP:
$packet = "ZBXD\1" . pack('P', strlen($data)) . $data;
or
$packet = "ZBXD\1" . pack('V', strlen($data)) . "\0\0\0\0" . $data;
Perl:
my $packet = "ZBXD\1" . pack('<Q', length($data)) . $data;
or
my $packet = "ZBXD\1" . pack('V', length($data)) . "\0\0\0\0" . $data;
Python:
packet = "ZBXD\1" + struct.pack('<Q', len(data)) + data
How do i do this in REXX?
any help appreciated!
Allard