if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) {
1948
LogError("%s: Error: cannot open the control file '%s' -- %s\n", prog, controlfile, STRERROR);
1948
LogError("Cannot open the control file '%s' -- %s\n", controlfile, STRERROR);
1949
1949
return FALSE;
1950
1950
}
1951
1951
2064
2064
2065
2065
/* Check that we do not start monit in daemon mode without having a poll time */
2066
2066
if (!Run.polltime && (Run.isdaemon || Run.init)) {
2067
LogError("%s: Error: Poll time not defined. Please define poll time in the\n control file or use the -d option when starting monit\n", prog);
2067
LogError("Poll time not defined. Please define poll time in the\n control file or use the -d option when starting monit\n");
2068
2068
cfg_errflag++;
2069
2069
}
2070
2070
2075
2075
if (s->type == TYPE_HOST) {
2076
2076
/* Verify that a remote service has a port or an icmp list */
2077
2077
if (!s->portlist && !s->icmplist) {
2078
LogError("%s: Error: 'check host' statement is incomplete: Please specify a port number to test\n or an icmp test at the remote host: '%s'\n", prog, s->name);
2078
LogError("'check host' statement is incomplete: Please specify a port number to test\n or an icmp test at the remote host: '%s'\n", s->name);
2079
2079
cfg_errflag++;
2080
2080
}
2081
2081
} else if (s->type == TYPE_PROGRAM) {
2082
2082
/* Verify that a program test has a status test */
2083
2083
if (! s->statuslist) {
2084
LogError("%s: Error: 'check program %s' is incomplete: Please add an 'if status != n' test\n", prog, s->name);
2084
LogError("'check program %s' is incomplete: Please add an 'if status != n' test\n", s->name);
2085
2085
cfg_errflag++;
2086
2086
}
2087
2087
/* Create the Command object */
2120
2120
}
2121
2121
}
2122
2122
if (! Run.mmonitcredentials)
2123
LogWarning("%s: Warning: M/Monit registration with credentials enabled, but no suitable credentials found in monit configuration file -- please add 'allow user:password' option to 'set httpd' statement\n", prog);
2123
LogWarning("M/Monit registration with credentials enabled, but no suitable credentials found in monit configuration file -- please add 'allow user:password' option to 'set httpd' statement\n");
2124
2124
}
2125
2125
} else
2126
LogWarning("%s: Warning: M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n", prog);
2126
LogWarning("M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n");
2127
2127
}
2128
2128
2129
2129
/* Check the sanity of any dependency graph */
2375
2375
2376
2376
if (t->test_changes || notime) {
2377
2377
if (! file_exist(current->path)) {
2378
DEBUG("%s: Debug: the path '%s' used in the TIMESTAMP statement refer to a non-existing object\n", prog, current->path);
2378
DEBUG("The path '%s' used in the TIMESTAMP statement refer to a non-existing object\n", current->path);
2379
2379
} else if (!(t->timestamp = file_getTimestamp(current->path, S_IFDIR|S_IFREG))) {
2380
yyerror2("cannot get the timestamp for '%s'", current->path);
2380
yyerror2("Cannot get the timestamp for '%s'", current->path);
2381
2381
}
2382
2382
}
2383
2383
2397
2397
ASSERT(ar);
2398
2398
2399
2399
if (ar->count > ar->cycle)
2400
yyerror2("the number of restarts must be less than poll cycles");
2400
yyerror2("The number of restarts must be less than poll cycles");
2401
2401
if (ar->count <= 0 || ar->cycle <= 0)
2402
yyerror2("zero or negative values not allowed in a action rate statement");
2402
yyerror2("Zero or negative values not allowed in a action rate statement");