zabbix action 不被触发的几个原因:
1、条件没配置好
例如匹配选项like
2、权限问题
action step中的用户或组 需对Trigger有可读权限
shell中的select语句 与 read 编写 出来的menu区别
select 只能选择输入数字来传递值
而menu 可以随意传递任何类型的值
相对于menu来说select更加简单
[[email protected] ~]# cat test.sh #!/bin/bash select DAY in Mon Tue Wed Thu Fri Sat Sun quit #和for循环语法相似 do if [ $DAY = "Mon" ];then echo $DAY fi done #END [[email protected] ~]# ./test.sh 1) Mon 2) Tue 3) Wed 4) Thu 5) Fri 6) Sat 7) Sun 8) quit #? 1 Mon #select 最好就是与case 结合 [[email protected] ~]# cat ./test2.sh #!/bin/bash select DAY in Mon Tue Wed Thu Fri Sat Sun quit do case $DAY in Mon) echo "Today is Monday";; Tue) echo "Today is Tuesday";; Wed) echo "Today is Wednesday";; Thu) echo "Today is Thursday";; Fri) echo "Today is Friday";; Sat|Sun) echo "You can have a rest today";; q|quit) exit 0 ;; *) echo "Unknown input ,exit now" && break;; esac done [[email protected] ~]# ./test2.sh 1) Mon 2) Tue 3) Wed 4) Thu 5) Fri 6) Sat 7) Sun 8) quit #? 2 Today is Tuesday #? 1 Today is Monday #? 8 [[email protected] ~]# echo $? 0
时间: 2024-10-14 21:07:27