bash - how to create multi user paramerter in zabbix from a script -


this shell script return 2 values 1 packet loss percentage , true or false :

server_ip=$1  checkip=`ping -c 2 -w 2 $server_ip | grep "packet loss" | cut -d " " -f 6  | cut -d "%" -f1` test1=$?  echo $checkip  if [ $test1 -eq 0 ];   echo "1"  else   echo "0"  fi  

in zabbix when create item enter 1 parameter value have 2 values 1 packet loss , second ping result (0 , 1)

how can create 2 items 1 packet lost percentage , second ping health check script? dont want create 1

thanks andre

try script guide want :

#!/bin/bash      case $1 in      packetloss) ping -c2 -w1 -q 8.8.8.8 | grep -op '\d+(?=% packet loss)' ;;     timeout) ping -c2 -q 8.8.8.8 | grep 'time' | awk -f',' '{ print$4}' | awk '{print $2}' | cut -c 1-4 ;;     *) echo "use: packetloss , timeout";;      esac 

try (im in zsh):

zabbix_agentd -t ping.loss\[timeout\]    ping.loss[timeout]                            [t|1000] 

or in zabbix server use ( im in zsh here too):

zabbix_get -s 172.20.4.49 -k ping.loss\[timeout\]          1001 

now create items these keys.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -