Configure Monitoring for 10000 Hosts in one Minute with this Script
First ready with your host list, which required Server IP Address and Server name.
Open Excel file and fill the data as mentioned below.
IP Address in first column and Host name in second column
Save, Keep file name as nagios-linux.csv (Do not put any other name script will not work)
Then download the below template.
keep all the files in one directory, then run the below script.
################## Copy below script #######################
#!/bin/bash
mkdir temp-cfg
cat nagios-windows.csv | while read LINE
do
HostIP=`echo $LINE | cut -d, -f1`
HostName=`echo $LINE | cut -d, -f2`
sed -e "s/XXXX/$HostName/g; s/ZZZZ/$HostIP/g" Nagios-Template-Linux.cfg > temp-cfg/$HostName.cfg
done
mkdir temp-cfg
cat nagios-windows.csv | while read LINE
do
HostIP=`echo $LINE | cut -d, -f1`
HostName=`echo $LINE | cut -d, -f2`
sed -e "s/XXXX/$HostName/g; s/ZZZZ/$HostIP/g" Nagios-Template-Linux.cfg > temp-cfg/$HostName.cfg
done
############## END Script ##########################
copy above script to one file and save file extension with *.sh
then provide the executable permissions to the file
~]#chmod 557 file-name.sh
~]#./file-name.sh
~]#cd temp-cfg
then verify the files.
~]#ls temp-cfg
No comments:
Post a Comment