Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
networkshark
bynetworkshark, October 9, 2020
I removed ipcalc from the code and replaced it with regex, because ipcalc gave errors of missing parameters.
----- CODE -----
[...]
# Variables definition
# my PID
mypid="$$"
html_tmp="/tmp/tmp_html.$mypid"
rep_tmp="/tmp/tmp_rep.$mypid"
add_uri='https://'
end_uri='/'
PORT=''
exit_code=2
regexIPv4="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
regexIPv6=".*:.*"
[...]
# Give some brain to this script. Detect yourself if we are checking an hostname, an ipv4 or an ipv6
if [[ $1 =~ $regexIPv4 ]]
then
target=ipv4
elif [[ $1 =~ $regexIPv6 ]]; then
target=ipv6
else
# we consider here cases in which the passed argument is DNS name
target=DNS
fi
[...]
----- CODE -----
----- CODE -----
[...]
# Variables definition
# my PID
mypid="$$"
html_tmp="/tmp/tmp_html.$mypid"
rep_tmp="/tmp/tmp_rep.$mypid"
add_uri='https://'
end_uri='/'
PORT=''
exit_code=2
regexIPv4="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
regexIPv6=".*:.*"
[...]
# Give some brain to this script. Detect yourself if we are checking an hostname, an ipv4 or an ipv6
if [[ $1 =~ $regexIPv4 ]]
then
target=ipv4
elif [[ $1 =~ $regexIPv6 ]]; then
target=ipv6
else
# we consider here cases in which the passed argument is DNS name
target=DNS
fi
[...]
----- CODE -----