File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments