You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
Bash
47 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
# Create a basic hosts.cfg file given hostname, ip/dns, and potentially a template list
|
|
|
|
myIP=""
|
|
myHost=""
|
|
myGroup=""
|
|
myUse="generic-host"
|
|
|
|
while [ -n "$1" ]; do
|
|
case "$1" in
|
|
-h|--host) myHost="$2"; shift 2;;
|
|
-i|--ip) myIP="$2"; shift 2;;
|
|
-g|--group) myGroup="$2"; shift 2;;
|
|
-t) myUse="$2"; shift 2;;
|
|
*) shift 1;;
|
|
esac
|
|
done
|
|
|
|
|
|
#define host {
|
|
# host_name SKSLSW001-L3-Srv1
|
|
# use xiwizard_switch_host
|
|
# address 10.189.4.129
|
|
# hostgroups network-devices
|
|
# max_check_attempts 5
|
|
# check_interval 5
|
|
# retry_interval 1
|
|
# check_period xi_timeperiod_24x7
|
|
# contacts vmpanait
|
|
# contact_groups IT Network
|
|
# notification_interval 60
|
|
# notification_period xi_timeperiod_24x7
|
|
# icon_image switch.png
|
|
# statusmap_image switch.png
|
|
# _xiwizard switch
|
|
# register 1
|
|
#}
|
|
|
|
|
|
echo "define host {"
|
|
echo " host_name $mHost"
|
|
echo " address $myIP"
|
|
[ -n "$myUse" ] && echo " use $myUse"
|
|
[ -n "$myGroup" ] && echo " hostgroups $myGroup"
|
|
echo "}"
|