buenas, Tengo el siguiente shell script configurados en una maquina Linux, al ejecutar el script en la maquina local, me trae los datos al pasarlos por el NRPE hacia la maquina con Nagios, no me lleva los datos.
Este el el programa: #!/bin/bash debug=$(echo "$@" | sed -e "s/.*\(-D\).*/\1/g") if [ "$debug" = "-D" ]; then opcion=$( expr "$#" - 1 ) else opcion="$#" fi function retorna_estado { ############################################################################################## status=$(/usr/sbin/asterisk -rx "core show channels" | grep "active calls" | awk '{ print $3" "$2" "$1}') register=$(/usr/sbin/asterisk -rx "sip show peers " | grep "OK" | awk '{ print $3" "$2" "$1}' | wc -l) usadas=$(echo $status | awk '{ print $3 }') libres=$(echo "$register - $usadas" | bc) #echo "Call simultaneas: $usadas Total Registros: $register Chanels No Activos: $libres" ############################################################################################## prused=$(echo "$usadas - $libres" | bc -l | sed -e "s/\(^.....\).*/\1/g" ) #echo $register echo "Call OK: Totalles $(echo "$usadas")x, Registros $register x, Free $libres x" #echo $register exit 0 if [ "$1" = 0 ]; then echo "-" ################################## elif [ "$1" = 1 ]; then if [ "$libres" -le "$(echo "$2" | bc)" ]; then echo "Call WARNING:$(echo "$register" | bc )Kb, Used:$(echo "$usadas" | bc )Kb, Free:$(echo "$libres" | bc )Kb $status" exit 1 elif [ "$libres" -gt "$(echo "$2" | bc)" ];then echo "Call OK: Total:$(echo "$register" | bc )Kb, Used:$(echo "$usadas" | bc )Kb, Free:$(echo "$libres" | bc )Kb $status" exit 0 fi #################################### elif [ "$1" = 2 ];then if [ "$libres" -le "$(echo "$2" | bc)" ];then echo "MEM CRITICAL: Total:$(echo "$register" | bc )Kb, Used:$(echo "$usadas" | bc )Kb, Free:$(echo "$libres" | bc )Kb $status" exit 2 elif [ "$libres" -gt "$(echo "$2" | bc)" ];then echo "MEM OK: Total:$(echo "$register" | bc )Kb, Used:$(echo "$usadas" | bc )Kb, Free:$(echo "$libres" | bc )Kb $status" exit 0 fi #################################### elif [ "$1" = 3 ];then if [ "$libres" -le "$(echo "$3" | b) " ];then echo "MEM CRITICAL: Total:$(echo "$register" | bc )Kb, Used:$(echo "$usadas" | bc )Kb, Free:$(echo "$libres" | bc )Kb $status" exit 2 elif [ "$libres" -le "$(echo "$2" | bc)" ];then echo "MEM WARNING: Total:$(echo "$register" | bc )Kb, Used:$(echo "$usadas" | bc )Kb, Free:$(echo "$libres" | bc )Kb $status" exit 1 elif [ "$libres" -gt "$(echo "$2" | bc)" ];then echo "MEM OK: Total:$(echo "$register" | bc )Kb, Used:$(echo "$usadas" | bc )Kb, Free:$(echo "$libres" | bc )Kb $status" exit 0 fi #################################### return 0 fi } if [ "$1" = "-?" ];then echo "" echo "uso: $0 -w INTEGER -c INTEGER -D" echo "-w : umbral de warning(INTEGER)" echo "-c : umbral de critical(INTEGER)" echo "-D : Debug de memoria(APAN)" echo "-? : esta ayuda" echo "" elif [ "$#" = 1 ] && [ "$1" = "-D" ] || [ "$#" = 0 ];then retorna_estado 0 elif [ "$opcion" = 2 ];then if [ "$1" == "-w" ] && [ "$2" != "" ]; then retorna_estado 1 $2 elif [ "$1" == "-c" ] && [ "$2" != "" ];then retorna_estado 2 $2 else echo "$0: error de parametros" exit 4 fi elif [ "$opcion" = 4 ];then if [ "$1" == "-w" ] && [ "$2" != "" ] && [ "$3" == "-c" ] && [ "$4" != "" ];then retorna_estado 3 $2 $4 else echo "$0: error de parametros" exit 4 fi else echo "$0: error en parametros" echo "" echo "uso: $0 -w INTEGER -c INTEGER" echo "-w : umbral de warning(INTEGER)" echo "-c : umbral de critical(INTEGER)" echo "-? : esta ayuda" echo "" fi Atte. Fernando Quil Ayala _______________________________________________ CentOS-es mailing list CentOS-es@centos.org http://lists.centos.org/mailman/listinfo/centos-es