Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 11ec140

Browse files
Create generate_win_host_config.sh
To Generate Windows Host Configuration with in Minute, Generate N number of servers.
1 parent 9dc5723 commit 11ec140

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎generate_win_host_config.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
## Purpose: To Generate Nagios Configuration files within minute of time.
3+
## Author: Ankam Ravi Kumar
4+
5+
mkdir -p /scripts/WinServers
6+
cat /scripts/serverlist.txt | while read LINE
7+
do
8+
HostIP=`echo $LINE | cut -d, -f1`
9+
HostName=`echo $LINE | cut -d, -f2`
10+
11+
NSCLIENTSTATE=$(/usr/local/nagios/libexec/check_nt -H $HostIP -p 12489 -v CLIENTVERSION -s Password | echo $?)
12+
if [ $NSCLIENTSTATE -eq 0 ]; then
13+
sed -e "s/XXXX/$HostName/g; s/ZZZZ/$HostIP/g" /scripts/Template-Windows.cfg > /scripts/WinServers/$HostName.cfg
14+
15+
for i in D E F G H I J K L M N O P Q R S T U V W X Y Z;
16+
do
17+
/usr/local/nagios/libexec/check_nt -H $HostIP -p 12489 -v USEDDISKSPACE -s Password -l $i -w 90 -c 95
18+
COMMANDSTATUS=$(echo $?)
19+
if [ $COMMANDSTATUS -eq 0 ] || [ $COMMANDSTATUS -eq 2 ];then
20+
sed -e "s/XXXX/$HostName/g; s/ZZZZ/$i/g" /scripts/Drives.cfg >> /scripts/WinServers/$HostName.cfg
21+
fi
22+
done
23+
fi
24+
done

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /