Hi to all,
it was discused before, but I think it would be very useable to expand macros from commandline. We use our patch of old zabbix_server because we beed it.
I think it could be implemented inside zabbix_server process protocol?
It means we need some commandline which will process stdin , find macros inside and expand them all on stdout. Or similar functionality with commandline..
Example1:
This example will return values on stdout. We use eventid 1000 to focus on.
Example2:
This example will return values on stdout. We use hosttid 1000 to focus on.
Example3:
This example will return values on stdout. We do not focus so we can expand only full name macros, not trigger or host specific.
Example4:
We expand only commandline string
Thanx !
it was discused before, but I think it would be very useable to expand macros from commandline. We use our patch of old zabbix_server because we beed it.
I think it could be implemented inside zabbix_server process protocol?
It means we need some commandline which will process stdin , find macros inside and expand them all on stdout. Or similar functionality with commandline..
Code:
zabbix_expand [-e eventid] [-t triggerid] [-h hostid] [-m macro] will expand macros specific to eventid, triggerid or hostid. If -m is used on commandline, process only string from commandline and exit. If not, process stdin and return values on stdout.
This example will return values on stdout. We use eventid 1000 to focus on.
Code:
zabbix_expand -e 1000 <<EOF
{HOSTNAME} ({PROFILE.LOCATION}),
Now: {DATE}-{TIME},
Event: {EVENT.DATE}-{EVENT.TIME},
Age: {EVENT.AGE}
EOF
This example will return values on stdout. We use hosttid 1000 to focus on.
Code:
zabbix_expand -h 1000 <<EOF
{HOSTNAME} ({PROFILE.LOCATION}),
Now: {DATE}-{TIME},
CPU load: {hostname.cpu.load.last(0)}
EOF
This example will return values on stdout. We do not focus so we can expand only full name macros, not trigger or host specific.
Code:
zabbix_expand <<EOF
Now: {DATE}-{TIME},
CPU load: {hostname.cpu.load.last(0)}
EOF
We expand only commandline string
Code:
zabbix_expand -m '{hostname.cpu.load.last(0)}'
Comment