How to pass name of the host into tick script .exec() event handler

743 Views Asked by At

I am currently working in tick script, I want to pass host name as an argument when alert triggers from that specific host, so I am unable to find the exact variable to pass to that script.

            var trigger = data
                |alert()
                    .crit(lambda: "value" > crit)
                    .message(message)
                    .id(idVar)
                    .idTag(idTag)
                    .levelTag(levelTag)
                    .messageField(messageField)
                    .durationField(durationField)
                    .exec('/usr/bin/python', '/home/scripts/pythons/memory.py' ) // here need to pass host name
1

There are 1 best solutions below

0
chrisckwong821 On

in front of var trigger, you have var name for name of that scipt, just pass string(name) inside .exec as the second argument