|
|
|
@ -1,7 +1,5 @@
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
[ "$1" = "set.txt" ] && . set.txt 2> /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
declare -A myVar
|
|
|
|
declare -A myVar
|
|
|
|
myVar[Name]="servicedesc"
|
|
|
|
myVar[Name]="servicedesc"
|
|
|
|
myVar[myDelim]="[ :]"
|
|
|
|
myVar[myDelim]="[ :]"
|
|
|
|
@ -32,7 +30,6 @@ Where:
|
|
|
|
-s The result must match this value or else it will return blank
|
|
|
|
-s The result must match this value or else it will return blank
|
|
|
|
--num The result will have all non-numbers stripped from it
|
|
|
|
--num The result will have all non-numbers stripped from it
|
|
|
|
-NP Returns NAGIOS__HOSTNCPAPORT (implied default of 5693)
|
|
|
|
-NP Returns NAGIOS__HOSTNCPAPORT (implied default of 5693)
|
|
|
|
-N DEPRECATED version of -NT
|
|
|
|
|
|
|
|
-NT Look for NAGIOS__HOSTNCPA<suffix> (defaults to TOKEN)
|
|
|
|
-NT Look for NAGIOS__HOSTNCPA<suffix> (defaults to TOKEN)
|
|
|
|
Can do double lookup if -HT is specified directly: -HT TOKEN will find NAGIOS__HOSTNCPATOKEN=Level1 which then finds NAGIOS__HOSTLEVEL1TOKEN=Secret
|
|
|
|
Can do double lookup if -HT is specified directly: -HT TOKEN will find NAGIOS__HOSTNCPATOKEN=Level1 which then finds NAGIOS__HOSTLEVEL1TOKEN=Secret
|
|
|
|
Or -HT PASS will find NAGIOS__HOSTNCPAPASS=Level2 which will then find NAGIOS__HOSTLEVEL2PASS=SuperSecret
|
|
|
|
Or -HT PASS will find NAGIOS__HOSTNCPAPASS=Level2 which will then find NAGIOS__HOSTLEVEL2PASS=SuperSecret
|
|
|
|
@ -76,8 +73,8 @@ while [ -n "$1" ]; do
|
|
|
|
-s) myVar[myString]="$2"; shift 2;;
|
|
|
|
-s) myVar[myString]="$2"; shift 2;;
|
|
|
|
--pre) myVar[myPrefix]="$2"; shift 2;;
|
|
|
|
--pre) myVar[myPrefix]="$2"; shift 2;;
|
|
|
|
--post) myVar[myPostfix]="$2"; shift 2;;
|
|
|
|
--post) myVar[myPostfix]="$2"; shift 2;;
|
|
|
|
-N|-NT) myOptions[doNCPA]="true"; shift 1;;
|
|
|
|
|
|
|
|
--num) myOptions[doNumber]="true"; shift 1;;
|
|
|
|
--num) myOptions[doNumber]="true"; shift 1;;
|
|
|
|
|
|
|
|
-NT) myOptions[doNCPA]="true"; shift 1;;
|
|
|
|
-NP) myVar[Name]="NAGIOS__HOSTNCPAPORT"; myVar[Default]="5693"; shift 1;;
|
|
|
|
-NP) myVar[Name]="NAGIOS__HOSTNCPAPORT"; myVar[Default]="5693"; shift 1;;
|
|
|
|
-H) myOptions[doHost]="true"; shift 1;;
|
|
|
|
-H) myOptions[doHost]="true"; shift 1;;
|
|
|
|
-S) myOptions[doService]="true"; shift 1;;
|
|
|
|
-S) myOptions[doService]="true"; shift 1;;
|
|
|
|
|