-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathwinconfig.pl
More file actions
executable file
·135 lines (131 loc) · 5.56 KB
/
winconfig.pl
File metadata and controls
executable file
·135 lines (131 loc) · 5.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
use strict;
use File::Basename;
use Getopt::Long qw(:config no_ignore_case getopt_compat);
# --with-seekfiles-dir=PATH sets directory for the state files (default=/tmp)
# --with-protocols-dir=PATH sets directory for the protocol files (default=/tmp)
# --with-trusted-path=PATH sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)
# --with-perl=PATH sets path to perl executable
# --with-gzip=PATH sets path to gzip executable
my($opt_with_seekfiles_dir, $opt_with_protocols_dir, $opt_with_trusted_path,
$opt_with_perl, $opt_with_gzip);
my $release = "";
open CFGAC, "configure.ac";
while (<CFGAC>) {
$release = $1 if /^AC_INIT\(.*,([\d\.]+)\)/;
}
close CFGAC;
if (! GetOptions(
"with-seekfiles-dir=s" => \$opt_with_seekfiles_dir,
"with-protocols-dir=s" => \$opt_with_protocols_dir,
"with-trusted-path=s" => \$opt_with_trusted_path,
"with-perl=s" => \$opt_with_perl,
"with-gzip=s" => \$opt_with_gzip,
)) {
printf "nonono\n";
exit;
}
$opt_with_seekfiles_dir = 'C:\TEMP' if ! $opt_with_seekfiles_dir;
$opt_with_protocols_dir = 'C:\TEMP' if ! $opt_with_protocols_dir;
$opt_with_trusted_path = '' if ! $opt_with_trusted_path;
$opt_with_perl = 'C:\strawberry\perl\bin\perl' if ! $opt_with_perl;
$opt_with_gzip = '' if ! $opt_with_gzip;
if (open CHECKLOGFILES, ">./plugins-scripts/check_logfiles") {
printf CHECKLOGFILES "#! %s\n", $opt_with_perl;
if (open CHECKLOGFILESPM, './plugins-scripts/Nagios/Tivoli/Config/Logfile.pm') {
printf CHECKLOGFILES qq{# line %d "%s"\n}, 1, './plugins-scripts/Nagios/Tivoli/Config/Logfile.pm';
while(defined($_=<CHECKLOGFILESPM>)) {
s/^1;//g;
s/#SEEKFILES_DIR#/$opt_with_seekfiles_dir/g;
s/#PROTOCOLS_DIR#/$opt_with_protocols_dir/g;
s/#TRUSTED_PATH#/$opt_with_trusted_path/g;
s/#PACKAGE_VERSION#/$release/g;
printf CHECKLOGFILES "%s", $_;
}
close CHECKLOGFILESPM;
}
if (open CHECKLOGFILESPM, './plugins-scripts/Nagios/CheckLogfiles.pm') {
printf CHECKLOGFILES qq{# line %d "%s"\n}, 1, './plugins-scripts/Nagios/CheckLogfiles.pm';
while(defined($_=<CHECKLOGFILESPM>)) {
s/^1;//g;
s/#SEEKFILES_DIR#/$opt_with_seekfiles_dir/g;
s/#PROTOCOLS_DIR#/$opt_with_protocols_dir/g;
s/#TRUSTED_PATH#/$opt_with_trusted_path/g;
s/#PACKAGE_VERSION#/$release/g;
printf CHECKLOGFILES "%s", $_;
}
close CHECKLOGFILESPM;
}
if (open CHECKLOGFILESPM, './plugins-scripts/Nagios/CheckLogfiles/Search/Psloglist.pm') {
printf CHECKLOGFILES qq{# line %d "%s"\n}, 1, './plugins-scripts/Nagios/CheckLogfiles/Search/Psloglist.pm';
while(defined($_=<CHECKLOGFILESPM>)) {
s/^1;//g;
s/#SEEKFILES_DIR#/$opt_with_seekfiles_dir/g;
s/#PROTOCOLS_DIR#/$opt_with_protocols_dir/g;
s/#TRUSTED_PATH#/$opt_with_trusted_path/g;
s/#PACKAGE_VERSION#/$release/g;
printf CHECKLOGFILES "%s", $_;
}
close CHECKLOGFILESPM;
}
if (open CHECKLOGFILESPM, './plugins-scripts/Nagios/CheckLogfiles/Search/Dumpel.pm') {
printf CHECKLOGFILES qq{# line %d "%s"\n}, 1, './plugins-scripts/Nagios/CheckLogfiles/Search/Dumpel.pm';
while(defined($_=<CHECKLOGFILESPM>)) {
s/^1;//g;
s/#SEEKFILES_DIR#/$opt_with_seekfiles_dir/g;
s/#PROTOCOLS_DIR#/$opt_with_protocols_dir/g;
s/#TRUSTED_PATH#/$opt_with_trusted_path/g;
s/#PACKAGE_VERSION#/$release/g;
printf CHECKLOGFILES "%s", $_;
}
close CHECKLOGFILESPM;
}
if (open CHECKLOGFILESPM, './plugins-scripts/Nagios/CheckLogfiles/Search/Eventlog.pm') {
printf CHECKLOGFILES qq{# line %d "%s"\n}, 1, './plugins-scripts/Nagios/CheckLogfiles/Search/Eventlog.pm';
while(defined($_=<CHECKLOGFILESPM>)) {
s/^1;//g;
s/#SEEKFILES_DIR#/$opt_with_seekfiles_dir/g;
s/#PROTOCOLS_DIR#/$opt_with_protocols_dir/g;
s/#TRUSTED_PATH#/$opt_with_trusted_path/g;
s/#PACKAGE_VERSION#/$release/g;
printf CHECKLOGFILES "%s", $_;
}
close CHECKLOGFILESPM;
}
if (open CHECKLOGFILESPM, './plugins-scripts/Nagios/CheckLogfiles/Search/Wevtutil.pm') {
printf CHECKLOGFILES qq{# line %d "%s"\n}, 1, './plugins-scripts/Nagios/CheckLogfiles/Search/Wevtutil.pm';
while(defined($_=<CHECKLOGFILESPM>)) {
s/^1;//g;
s/#SEEKFILES_DIR#/$opt_with_seekfiles_dir/g;
s/#PROTOCOLS_DIR#/$opt_with_protocols_dir/g;
s/#TRUSTED_PATH#/$opt_with_trusted_path/g;
s/#PACKAGE_VERSION#/$release/g;
printf CHECKLOGFILES "%s", $_;
}
close CHECKLOGFILESPM;
}
if (open CHECKLOGFILESPM, './plugins-scripts/Nagios/CheckLogfiles/Search/Dummy.pm') {
printf CHECKLOGFILES qq{# line %d "%s"\n}, 1, './plugins-scripts/Nagios/CheckLogfiles/Search/Dummy.pm';
while(defined($_=<CHECKLOGFILESPM>)) {
s/^1;//g;
s/#SEEKFILES_DIR#/$opt_with_seekfiles_dir/g;
s/#PROTOCOLS_DIR#/$opt_with_protocols_dir/g;
s/#TRUSTED_PATH#/$opt_with_trusted_path/g;
s/#PACKAGE_VERSION#/$release/g;
printf CHECKLOGFILES "%s", $_;
}
close CHECKLOGFILESPM;
}
if (open CHECKLOGFILESPL, './plugins-scripts/check_logfiles.pl') {
printf CHECKLOGFILES qq{# line %d "%s"\n}, 1, './plugins-scripts/check_logfiles.pl';
while(defined($_=<CHECKLOGFILESPL>)) {
s/^1;//g;
s/#SEEKFILES_DIR#/$opt_with_seekfiles_dir/g;
s/#PROTOCOLS_DIR#/$opt_with_protocols_dir/g;
s/#TRUSTED_PATH#/$opt_with_trusted_path/g;
s/#PACKAGE_VERSION#/$release/g;
printf CHECKLOGFILES "%s", $_;
}
close CHECKLOGFILESPL;
}
close CHECKLOGFILES;
}