You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 lines
509 B

2 years ago
  1. #/usr/bin/env bash
  2. # Description: determines if the IP address is available on this server
  3. # Author: Lesovsky A.V. <lesovsky@gmail.com>
  4. PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
  5. IPADDR=$1
  6. [[ $1 ]] || { echo "ZBX_NOTSUPPORTED, need at least one parameter in which IP address must be specified."; exit 1; }
  7. [[ -f $(which ip 2>/dev/null) ]] || { echo "ZBX_NOTSUPPORTED, ip utility from iproute2 not found."; exit 1; }
  8. if ip addr show |grep -qo $IPADDR; then echo "1"; else echo "0"; fi

Powered by TurnKey Linux.