xVlady
xVlady

Reputation: 43

zabbix UserParameter return 2 or more values

i use

 UserParameter=Firebird[*],F:\tools\zabbix_agent\firebird\Firebird.bat $1

How can I get for 1 run bat file two or more values?

Upvotes: 3

Views: 11367

Answers (2)

Jan Garaj
Jan Garaj

Reputation: 28724

It's impossible - it's zabbix agent architecture. One item = one value.

But you can use some workaround: 1.) zabbix_sender you script (bat file) implement your monitoring logic and collected metrics will be sent by zabbix_sender. These zabbix sender items must be Zabbix trapper type. You can send also many metrics in one go (see manual -i)

Manual: https://www.zabbix.com/documentation/2.4/manpages/zabbix_sender

Zabbix item will be type Zabbix trapper in this case.

2.) save value into file your script will save all collected metrics into tmp file and then you have to create special items for parsing this tmp file. Key vfs.file.regexp is the best for this job:

vfs.file.regexp[/tmp/file.txt,^(\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ \w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ \w+ \w+ (\w+),,,,\1]

Source: Zabbix external checks

3.) similar concept as 2nd one, but instead of file you will use shared memory it can be over engineering, but if you care about IOps.

I use https://gist.github.com/jangaraj/edc9dde939cbd577bbba for Raspberry Pi - system on SD card so I need to minimize IOPs. I'll store ping output into shared memory segment and then I'm parsing ping output from different items (ping.max, ping.avg, ping.min, ...)

Upvotes: 0

Related Questions