Imported Upstream version 4.3.4
This commit is contained in:
parent
7faf575ca1
commit
dac8330c0a
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ autom4te.cache
|
|||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
daemon-init
|
daemon-init
|
||||||
|
openrc-init
|
||||||
Makefile
|
Makefile
|
||||||
tags
|
tags
|
||||||
.deps/
|
.deps/
|
||||||
|
165
CONTRIBUTING.md
Normal file
165
CONTRIBUTING.md
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
Thank you for considering contributing your time and effort to this Nagios project.
|
||||||
|
This document serves as our guidelines for contribution. Keep in mind that these
|
||||||
|
are simply *guidelines* - nothing here is set in stone.
|
||||||
|
|
||||||
|
## Questions
|
||||||
|
|
||||||
|
If you have a question, you don't need to file an Issue. You can simply connect
|
||||||
|
with the Nagios Support Team via the
|
||||||
|
[Nagios Support Forum](https://support.nagios.com/forum/).
|
||||||
|
|
||||||
|
Not to say that you **can't** open an Issue - but you'll likely get a much faster
|
||||||
|
response by posting it on the forum.
|
||||||
|
|
||||||
|
## Ideas
|
||||||
|
|
||||||
|
If you have an idea your best bet is to open an Issue. This gets it on the radar much
|
||||||
|
quicker than any other method.
|
||||||
|
|
||||||
|
First, let's define what an "Idea" really is. An Idea is simply an
|
||||||
|
[Enhancement](#enhancements) request in its infancy.
|
||||||
|
There's really nothing to it!
|
||||||
|
|
||||||
|
Something as simple as "I think that this project should somehow connect with a
|
||||||
|
widget" is a valid Idea.
|
||||||
|
|
||||||
|
These are unrefined and raw. That's why you open an issue - so everyone gets a chance
|
||||||
|
to chime in and come up with a plan!
|
||||||
|
|
||||||
|
## Feedback
|
||||||
|
|
||||||
|
Feedback can be given via several methods. The *easiest* method is by opening an Issue.
|
||||||
|
You're more than welcome to leave feedback on the
|
||||||
|
[Nagios Support Forum](https://support.nagios.com/forum/) as well.
|
||||||
|
|
||||||
|
By opening an Issue, however, you're insuring that the maintainers and reviewers are
|
||||||
|
the first ones to see the feedback. In most cases, this is likely ideal.
|
||||||
|
|
||||||
|
## Bugs
|
||||||
|
|
||||||
|
Here's where it starts to get serious.
|
||||||
|
|
||||||
|
Following the guidelines outlined in this section allows the maintainers, developers, and
|
||||||
|
community to understand and reproduce your bug report.
|
||||||
|
|
||||||
|
Make sure to search existing open and closed [Issues](https://guides.github.com/features/issues/)
|
||||||
|
before opening a bug report. If you find a closed Issue that seems like it's the same
|
||||||
|
thing that you're experiencing, open a new Issue and include a link to the original Issue
|
||||||
|
in the body of the new one.
|
||||||
|
|
||||||
|
**If you have a bug, you *NEED* to open an Issue.**
|
||||||
|
|
||||||
|
Not only that, but when you open the Issue, this is what we ***absolutely require***:
|
||||||
|
|
||||||
|
* Use a clear and concise title for the Issue to identify the problem accurately
|
||||||
|
|
||||||
|
* Describe the bug with as much detail as you can
|
||||||
|
|
||||||
|
* Include the version of the project containing the bug you're reporting
|
||||||
|
|
||||||
|
* Include your operating system information (`uname -a`)
|
||||||
|
|
||||||
|
* Include a list of third party modules that are installed and/or loaded
|
||||||
|
|
||||||
|
* Explain the behavior you expected to see (and why) vs. what actually happened
|
||||||
|
|
||||||
|
Once you've got that covered - there's still more to include if you want to
|
||||||
|
make a ***killer*** report:
|
||||||
|
|
||||||
|
* Describe the ***exact steps*** that reproduce the problem
|
||||||
|
|
||||||
|
* Provide **specific** examples to demonstrate those steps
|
||||||
|
|
||||||
|
* If your bug is from an older version, make sure test against the latest (and/or the `maint` branch)
|
||||||
|
|
||||||
|
* Include any screenshots that can help explain the issue
|
||||||
|
|
||||||
|
* Include a file containing `strace` and/or `valgrind` output
|
||||||
|
|
||||||
|
* Explain when the problem started happening: was it after an upgrade? or was it always present?
|
||||||
|
|
||||||
|
* Define how reliably you can reproduce the bug
|
||||||
|
|
||||||
|
* Any other information that you decide is relevant is also welcome
|
||||||
|
|
||||||
|
## Enhancements
|
||||||
|
|
||||||
|
An enhancement is either a completely new feature or an improvement to existing
|
||||||
|
functionality. We consider it to be a bit different than idea - based solely
|
||||||
|
on the fact that it's more detailed than an idea would be.
|
||||||
|
|
||||||
|
So you've got an idea for an ehancement? Great!
|
||||||
|
|
||||||
|
Following the guidelines outlined in this section allows maintainers, developers, and
|
||||||
|
the community to understand your enhancement and determine whether or not it's worth
|
||||||
|
doing and/or what's involved in carrying it out.
|
||||||
|
|
||||||
|
Make sure to search open and closed Issues and Pull Requests to determine if
|
||||||
|
someone has either submitted the enhancement. If you feel like your enhancement
|
||||||
|
is similar to one found, make sure to link the original in your request.
|
||||||
|
|
||||||
|
Enhancements are submitted by opening an Issue.
|
||||||
|
|
||||||
|
Unlike an [Idea](#idea), when you decide to submit your enhancement and open
|
||||||
|
the Issue, we require at least the following information:
|
||||||
|
|
||||||
|
* Use a clear and descriptive title to illustrate the enhancement you're requesting
|
||||||
|
|
||||||
|
* Describe the current behavior (if it exists) and what changes you think should be made
|
||||||
|
|
||||||
|
* Explain the enhancement in detail - make sure it makes sense and is easily understandable
|
||||||
|
|
||||||
|
* Specify why the enhancement would be useful and who it would be useful to
|
||||||
|
|
||||||
|
* If there is some other project or program where this enhancement already exists, make sure
|
||||||
|
to link to it
|
||||||
|
|
||||||
|
Beyond that, there are a few more things you can do to make sure you **really** get your
|
||||||
|
point across:
|
||||||
|
|
||||||
|
* Create a mockup of the enhancement (if applicable) and attach whatever files you can
|
||||||
|
|
||||||
|
* Provide a step-by-step description of the suggested enhancement
|
||||||
|
|
||||||
|
* Generate a fully dressed use-case for the enhancement request
|
||||||
|
|
||||||
|
* Create a specification for the preferred implementation of the enhancement
|
||||||
|
|
||||||
|
* Include a timeline regarding development expectations towards the request
|
||||||
|
|
||||||
|
## Submitting Code
|
||||||
|
|
||||||
|
Everything else in this document has lead up to this moment - how can ***you*** submit
|
||||||
|
code to the **project**.
|
||||||
|
|
||||||
|
We allow code submissions via [Pull Requests](https://help.github.com/articles/about-pull-requests/).
|
||||||
|
These let you (and us) discuss and review any changes to code in any repository you've made.
|
||||||
|
|
||||||
|
How to create and manage Pull Requests is outside of the scope of this document, but make
|
||||||
|
sure to check out GitHub's official documentation ([link here](https://help.github.com/))
|
||||||
|
to get a handle on it.
|
||||||
|
|
||||||
|
While you're forking the repository to create a patch or an enhancement, create a *new
|
||||||
|
branch* to make the change - it will be easier to submit a pull request using a new
|
||||||
|
branch in your forked repository!
|
||||||
|
|
||||||
|
When you submit a Pull Request, make sure you follow the guidelines:
|
||||||
|
|
||||||
|
* Make sure you're submitting to the proper branch. Branch `maint` is used for the
|
||||||
|
**next** bugfix release. The next enhancement release branch will vary.
|
||||||
|
|
||||||
|
* ***NEVER*** submit a Pull Request to `master` branch.
|
||||||
|
|
||||||
|
* Keep commit messages as concise as possible.
|
||||||
|
* Update the appropriate files in regards to your changes:
|
||||||
|
|
||||||
|
* `CHANGES`
|
||||||
|
|
||||||
|
* `THANKS`
|
||||||
|
|
||||||
|
* End all committed files with a newline.
|
||||||
|
|
||||||
|
* Test your changes and include the results as a comment.
|
||||||
|
|
23
Changelog
23
Changelog
@ -2,7 +2,28 @@
|
|||||||
Nagios Core 4 Change Log
|
Nagios Core 4 Change Log
|
||||||
########################
|
########################
|
||||||
|
|
||||||
4.3.2 - xxxx-xx-xx
|
|
||||||
|
4.3.4 - 2017-08-24
|
||||||
|
------------------
|
||||||
|
* Improved config file parsing (Mark Felder)
|
||||||
|
* Fixed configure script to check for existence of /run for lock file (in regards to CVE-2017-12847, Bryan Heden)
|
||||||
|
* Use absolute paths when deleting check results files (Emmanuel Dreyfus)
|
||||||
|
* Add sanity checking in reassign_worker (sq5bpf)
|
||||||
|
|
||||||
|
|
||||||
|
4.3.3 - 2017-08-12
|
||||||
|
------------------
|
||||||
|
* xodtemplate.c wrong option-deprecation code warning (alex2grad / John Frickson)
|
||||||
|
* On-demand host check always use cached host state (John Frickson)
|
||||||
|
* 'á' causes Serivce Status Information to not be displayed (John Frickson)
|
||||||
|
* New Macro(s) to generate URL for host / service object (John Frickson)
|
||||||
|
* Fix minor map issues (Troy Lea)
|
||||||
|
* Fix lockfile issues (Bryan Heden)
|
||||||
|
* Switch order of daemon_init and drop_priveleges (CVE-2017-12847, Bryan Heden)
|
||||||
|
* Add an OpenRC init script (Michael Orlitzky)
|
||||||
|
|
||||||
|
|
||||||
|
4.3.2 - 2017-05-09
|
||||||
------------------
|
------------------
|
||||||
FIXED
|
FIXED
|
||||||
* Every 15sec /var/log/messages is flooded with "nagios: set_environment_var" (John Frickson)
|
* Every 15sec /var/log/messages is flooded with "nagios: set_environment_var" (John Frickson)
|
||||||
|
@ -197,7 +197,7 @@ distclean: clean
|
|||||||
cd $(SRC_TTAP) && $(MAKE) $@
|
cd $(SRC_TTAP) && $(MAKE) $@
|
||||||
cd $(SRC_WORKERS) && $(MAKE) $@
|
cd $(SRC_WORKERS) && $(MAKE) $@
|
||||||
rm -f sample-config/*.cfg sample-config/*.conf sample-config/template-object/*.cfg
|
rm -f sample-config/*.cfg sample-config/*.conf sample-config/template-object/*.cfg
|
||||||
rm -f daemon-init pkginfo
|
rm -f daemon-init openrc-init pkginfo
|
||||||
rm -f Makefile subst
|
rm -f Makefile subst
|
||||||
rm -f config.log config.status config.cache
|
rm -f config.log config.status config.cache
|
||||||
rm -f tags
|
rm -f tags
|
||||||
|
7
THANKS
7
THANKS
@ -70,6 +70,7 @@ wrong, please let me know.
|
|||||||
* David Kmoch
|
* David Kmoch
|
||||||
* David Schlecht
|
* David Schlecht
|
||||||
* David Tilloy
|
* David Tilloy
|
||||||
|
* David Walser
|
||||||
* Dawid Golunski
|
* Dawid Golunski
|
||||||
* Dean Lane
|
* Dean Lane
|
||||||
* Denis Seleznyov
|
* Denis Seleznyov
|
||||||
@ -183,10 +184,12 @@ wrong, please let me know.
|
|||||||
* Luigi Balzano
|
* Luigi Balzano
|
||||||
* Luiz Felipe R E
|
* Luiz Felipe R E
|
||||||
* Luke Ross
|
* Luke Ross
|
||||||
|
* Emmanuel Dreyfus
|
||||||
* Marc Powell
|
* Marc Powell
|
||||||
* Marcus Fleige
|
* Marcus Fleige
|
||||||
* Marcus Hildenbrand
|
* Marcus Hildenbrand
|
||||||
* Mark DeTrano
|
* Mark DeTrano
|
||||||
|
* Mark Felder
|
||||||
* Mark Frost
|
* Mark Frost
|
||||||
* Mark Goldfinch
|
* Mark Goldfinch
|
||||||
* Mark Schenker
|
* Mark Schenker
|
||||||
@ -218,6 +221,7 @@ wrong, please let me know.
|
|||||||
* Michael Lubben
|
* Michael Lubben
|
||||||
* Michael Marineau
|
* Michael Marineau
|
||||||
* Michael O'Reilly
|
* Michael O'Reilly
|
||||||
|
* Michael Orlitzky
|
||||||
* Michael Smedius
|
* Michael Smedius
|
||||||
* Michal Zimen
|
* Michal Zimen
|
||||||
* Michelle Craft
|
* Michelle Craft
|
||||||
@ -258,6 +262,7 @@ wrong, please let me know.
|
|||||||
* Ralph Rossner
|
* Ralph Rossner
|
||||||
* Ray Bengen
|
* Ray Bengen
|
||||||
* Remi Paulmier
|
* Remi Paulmier
|
||||||
|
* Rémi Verschelde
|
||||||
* Rene Klootwijk
|
* Rene Klootwijk
|
||||||
* Ricardo Maraschini
|
* Ricardo Maraschini
|
||||||
* Richard Mayhew
|
* Richard Mayhew
|
||||||
@ -282,6 +287,7 @@ wrong, please let me know.
|
|||||||
* Sergio Guzman
|
* Sergio Guzman
|
||||||
* Shad Lords
|
* Shad Lords
|
||||||
* Simon Beale
|
* Simon Beale
|
||||||
|
* sq5bpf
|
||||||
* Stanley Hopcroft
|
* Stanley Hopcroft
|
||||||
* Stefan Rompf
|
* Stefan Rompf
|
||||||
* Stefan Schurtz
|
* Stefan Schurtz
|
||||||
@ -318,6 +324,7 @@ wrong, please let me know.
|
|||||||
* Tomer Okavi
|
* Tomer Okavi
|
||||||
* Ton Voon
|
* Ton Voon
|
||||||
* Torsten Huebler
|
* Torsten Huebler
|
||||||
|
* Troy Lea
|
||||||
* Tyler Lund
|
* Tyler Lund
|
||||||
* Uwe Knop
|
* Uwe Knop
|
||||||
* Uwe Knop
|
* Uwe Knop
|
||||||
|
@ -400,7 +400,6 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
|
|||||||
char *temp_ptr = NULL;
|
char *temp_ptr = NULL;
|
||||||
servicedependency *temp_dependency = NULL;
|
servicedependency *temp_dependency = NULL;
|
||||||
service *master_service = NULL;
|
service *master_service = NULL;
|
||||||
int state_changes_use_cached_state = TRUE; /* TODO - 09/23/07 move this to a global variable */
|
|
||||||
int flapping_check_done = FALSE;
|
int flapping_check_done = FALSE;
|
||||||
|
|
||||||
|
|
||||||
@ -676,7 +675,7 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
|
|||||||
else {
|
else {
|
||||||
/* can we use the last cached host state? */
|
/* can we use the last cached host state? */
|
||||||
/* usually only use cached host state if no service state change has occurred */
|
/* usually only use cached host state if no service state change has occurred */
|
||||||
if((state_change == FALSE || state_changes_use_cached_state == TRUE) && temp_host->has_been_checked == TRUE && ((current_time - temp_host->last_check) <= cached_host_check_horizon)) {
|
if(state_change == FALSE && temp_host->has_been_checked == TRUE && ((current_time - temp_host->last_check) <= cached_host_check_horizon)) {
|
||||||
log_debug_info(DEBUGL_CHECKS, 1, "* Using cached host state: %d\n", temp_host->current_state);
|
log_debug_info(DEBUGL_CHECKS, 1, "* Using cached host state: %d\n", temp_host->current_state);
|
||||||
update_check_stats(ACTIVE_ONDEMAND_HOST_CHECK_STATS, current_time);
|
update_check_stats(ACTIVE_ONDEMAND_HOST_CHECK_STATS, current_time);
|
||||||
update_check_stats(ACTIVE_CACHED_HOST_CHECK_STATS, current_time);
|
update_check_stats(ACTIVE_CACHED_HOST_CHECK_STATS, current_time);
|
||||||
@ -770,7 +769,7 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
|
|||||||
log_debug_info(DEBUGL_CHECKS, 1, "Host is currently UP, so we'll recheck its state to make sure...\n");
|
log_debug_info(DEBUGL_CHECKS, 1, "Host is currently UP, so we'll recheck its state to make sure...\n");
|
||||||
|
|
||||||
/* only run a new check if we can and have to */
|
/* only run a new check if we can and have to */
|
||||||
if(execute_host_checks && (state_change == TRUE && state_changes_use_cached_state == FALSE) && temp_host->last_check + cached_host_check_horizon < current_time) {
|
if(execute_host_checks && state_change == TRUE && temp_host->last_check + cached_host_check_horizon < current_time) {
|
||||||
schedule_host_check(temp_host, current_time, CHECK_OPTION_DEPENDENCY_CHECK);
|
schedule_host_check(temp_host, current_time, CHECK_OPTION_DEPENDENCY_CHECK);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -786,7 +785,7 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
|
|||||||
|
|
||||||
log_debug_info(DEBUGL_CHECKS, 1, "Host is currently %s.\n", host_state_name(temp_host->current_state));
|
log_debug_info(DEBUGL_CHECKS, 1, "Host is currently %s.\n", host_state_name(temp_host->current_state));
|
||||||
|
|
||||||
if(execute_host_checks && (state_change == TRUE && state_changes_use_cached_state == FALSE)) {
|
if(execute_host_checks && state_change == TRUE) {
|
||||||
schedule_host_check(temp_host, current_time, CHECK_OPTION_NONE);
|
schedule_host_check(temp_host, current_time, CHECK_OPTION_NONE);
|
||||||
}
|
}
|
||||||
/* else fake the host check, but (possibly) resend host notifications to contacts... */
|
/* else fake the host check, but (possibly) resend host notifications to contacts... */
|
||||||
|
@ -107,7 +107,7 @@ int read_main_config_file(char *main_config_file) {
|
|||||||
/* open the config file for reading */
|
/* open the config file for reading */
|
||||||
if((thefile = mmap_fopen(main_config_file)) == NULL) {
|
if((thefile = mmap_fopen(main_config_file)) == NULL) {
|
||||||
logit(NSLOG_CONFIG_ERROR, TRUE, "Error: Cannot open main configuration file '%s' for reading!", main_config_file);
|
logit(NSLOG_CONFIG_ERROR, TRUE, "Error: Cannot open main configuration file '%s' for reading!", main_config_file);
|
||||||
return ERROR;
|
exit(ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save the main config file macro */
|
/* save the main config file macro */
|
||||||
@ -175,6 +175,11 @@ int read_main_config_file(char *main_config_file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(!strcmp(variable, "website_url")) {
|
||||||
|
my_free(website_url);
|
||||||
|
website_url = strdup(value);
|
||||||
|
}
|
||||||
|
|
||||||
else if(!strcmp(variable, "loadctl_options"))
|
else if(!strcmp(variable, "loadctl_options"))
|
||||||
error = set_loadctl_options(value, strlen(value)) != OK;
|
error = set_loadctl_options(value, strlen(value)) != OK;
|
||||||
else if(!strcmp(variable, "check_workers"))
|
else if(!strcmp(variable, "check_workers"))
|
||||||
@ -1267,12 +1272,11 @@ int read_main_config_file(char *main_config_file) {
|
|||||||
my_free(value);
|
my_free(value);
|
||||||
|
|
||||||
/* make sure a log file has been specified */
|
/* make sure a log file has been specified */
|
||||||
strip(log_file);
|
if(log_file == NULL) {
|
||||||
if(!strcmp(log_file, "")) {
|
logit(NSLOG_CONFIG_ERROR, TRUE, "Error: Log file is not specified anywhere in main config file '%s'!", main_config_file);
|
||||||
if(daemon_mode == FALSE)
|
exit(ERROR);
|
||||||
printf("Error: Log file is not specified anywhere in main config file '%s'!\n", main_config_file);
|
|
||||||
return ERROR;
|
|
||||||
}
|
}
|
||||||
|
strip(log_file);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -593,6 +593,22 @@ int main(int argc, char **argv) {
|
|||||||
my_free(mac->x[MACRO_PROCESSSTARTTIME]);
|
my_free(mac->x[MACRO_PROCESSSTARTTIME]);
|
||||||
asprintf(&mac->x[MACRO_PROCESSSTARTTIME], "%llu", (unsigned long long)program_start);
|
asprintf(&mac->x[MACRO_PROCESSSTARTTIME], "%llu", (unsigned long long)program_start);
|
||||||
|
|
||||||
|
/* enter daemon mode (unless we're restarting...) */
|
||||||
|
if(daemon_mode == TRUE && sigrestart == FALSE) {
|
||||||
|
|
||||||
|
result = daemon_init();
|
||||||
|
|
||||||
|
/* we had an error daemonizing, so bail... */
|
||||||
|
if(result == ERROR) {
|
||||||
|
logit(NSLOG_PROCESS_INFO | NSLOG_RUNTIME_ERROR, TRUE, "Bailing out due to failure to daemonize. (PID=%d)", (int)getpid());
|
||||||
|
cleanup();
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get new PID */
|
||||||
|
nagios_pid = (int)getpid();
|
||||||
|
}
|
||||||
|
|
||||||
/* drop privileges */
|
/* drop privileges */
|
||||||
if(drop_privileges(nagios_user, nagios_group) == ERROR) {
|
if(drop_privileges(nagios_user, nagios_group) == ERROR) {
|
||||||
|
|
||||||
@ -612,21 +628,6 @@ int main(int argc, char **argv) {
|
|||||||
/* error has already been logged */
|
/* error has already been logged */
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
/* enter daemon mode (unless we're restarting...) */
|
|
||||||
if(daemon_mode == TRUE && sigrestart == FALSE) {
|
|
||||||
|
|
||||||
result = daemon_init();
|
|
||||||
|
|
||||||
/* we had an error daemonizing, so bail... */
|
|
||||||
if(result == ERROR) {
|
|
||||||
logit(NSLOG_PROCESS_INFO | NSLOG_RUNTIME_ERROR, TRUE, "Bailing out due to failure to daemonize. (PID=%d)", (int)getpid());
|
|
||||||
cleanup();
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get new PID */
|
|
||||||
nagios_pid = (int)getpid();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this must be logged after we read config data, as user may have changed location of main log file */
|
/* this must be logged after we read config data, as user may have changed location of main log file */
|
||||||
logit(NSLOG_PROCESS_INFO, TRUE, "Nagios %s starting... (PID=%d)\n", PROGRAM_VERSION, (int)getpid());
|
logit(NSLOG_PROCESS_INFO, TRUE, "Nagios %s starting... (PID=%d)\n", PROGRAM_VERSION, (int)getpid());
|
||||||
|
17
base/utils.c
17
base/utils.c
@ -189,6 +189,7 @@ int free_child_process_memory;
|
|||||||
int child_processes_fork_twice;
|
int child_processes_fork_twice;
|
||||||
|
|
||||||
char *use_timezone;
|
char *use_timezone;
|
||||||
|
char *website_url;
|
||||||
|
|
||||||
int allow_empty_hostgroup_assignment;
|
int allow_empty_hostgroup_assignment;
|
||||||
|
|
||||||
@ -263,6 +264,7 @@ void init_main_cfg_vars(int first_time) {
|
|||||||
|
|
||||||
nagios_user = NULL;
|
nagios_user = NULL;
|
||||||
nagios_group = NULL;
|
nagios_group = NULL;
|
||||||
|
website_url = NULL;
|
||||||
|
|
||||||
use_regexp_matches = FALSE;
|
use_regexp_matches = FALSE;
|
||||||
use_true_regexp_matching = FALSE;
|
use_true_regexp_matching = FALSE;
|
||||||
@ -2131,7 +2133,11 @@ int process_check_result_queue(char *dirname) {
|
|||||||
|
|
||||||
/* if the file is too old, we delete it */
|
/* if the file is too old, we delete it */
|
||||||
if (stat_buf.st_mtime + max_check_result_file_age < time(NULL)) {
|
if (stat_buf.st_mtime + max_check_result_file_age < time(NULL)) {
|
||||||
delete_check_result_file(dirfile->d_name);
|
|
||||||
|
if (delete_check_result_file(file) != OK
|
||||||
|
&& delete_check_result_file(dirfile->d_name) != OK)
|
||||||
|
logit(NSLOG_RUNTIME_WARNING, TRUE, "Error: Unable to delete '%s' or '%s'!", file, dirfile->d_name);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2361,16 +2367,17 @@ int process_check_result_file(char *fname) {
|
|||||||
/* deletes as check result file, as well as its ok-to-go file */
|
/* deletes as check result file, as well as its ok-to-go file */
|
||||||
int delete_check_result_file(char *fname) {
|
int delete_check_result_file(char *fname) {
|
||||||
char *temp_buffer = NULL;
|
char *temp_buffer = NULL;
|
||||||
|
int result = OK;
|
||||||
|
|
||||||
/* delete the result file */
|
/* delete the result file */
|
||||||
unlink(fname);
|
result = unlink(fname);
|
||||||
|
|
||||||
/* delete the ok-to-go file */
|
/* delete the ok-to-go file */
|
||||||
asprintf(&temp_buffer, "%s.ok", fname);
|
asprintf(&temp_buffer, "%s.ok", fname);
|
||||||
unlink(temp_buffer);
|
result |= unlink(temp_buffer);
|
||||||
my_free(temp_buffer);
|
my_free(temp_buffer);
|
||||||
|
|
||||||
return OK;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3383,6 +3390,7 @@ void free_memory(nagios_macros *mac) {
|
|||||||
my_free(command_file);
|
my_free(command_file);
|
||||||
mac->x[MACRO_COMMANDFILE] = NULL; /* assigned from command_file */
|
mac->x[MACRO_COMMANDFILE] = NULL; /* assigned from command_file */
|
||||||
my_free(log_archive_path);
|
my_free(log_archive_path);
|
||||||
|
my_free(website_url);
|
||||||
|
|
||||||
for (i = 0; i < MAX_USER_MACROS; i++) {
|
for (i = 0; i < MAX_USER_MACROS; i++) {
|
||||||
my_free(macro_user[i]);
|
my_free(macro_user[i]);
|
||||||
@ -3442,6 +3450,7 @@ int reset_variables(void) {
|
|||||||
|
|
||||||
my_free(ocsp_command);
|
my_free(ocsp_command);
|
||||||
my_free(ochp_command);
|
my_free(ochp_command);
|
||||||
|
my_free(website_url);
|
||||||
|
|
||||||
/* Next re-initialize configuration variables */
|
/* Next re-initialize configuration variables */
|
||||||
init_main_cfg_vars(0);
|
init_main_cfg_vars(0);
|
||||||
|
@ -604,9 +604,13 @@ static void fo_reassign_wproc_job(void *job_)
|
|||||||
{
|
{
|
||||||
struct wproc_job *job = (struct wproc_job *)job_;
|
struct wproc_job *job = (struct wproc_job *)job_;
|
||||||
job->wp = get_worker(job->command);
|
job->wp = get_worker(job->command);
|
||||||
|
if (job->wp != NULL) {
|
||||||
job->id = get_job_id(job->wp);
|
job->id = get_job_id(job->wp);
|
||||||
/* macros aren't used right now anyways */
|
/* macros aren't used right now anyways */
|
||||||
wproc_run_job(job, NULL);
|
wproc_run_job(job, NULL);
|
||||||
|
} else {
|
||||||
|
logit(NSLOG_RUNTIME_WARNING, TRUE, "wproc: Error: can't get_worker() in fo_reassign_wproc_job\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_worker_result(int sd, int events, void *arg)
|
static int handle_worker_result(int sd, int events, void *arg)
|
||||||
|
229
cgi/cgiutils.c
229
cgi/cgiutils.c
@ -1088,33 +1088,37 @@ const char *url_encode(const char *input) {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char * copy_wc_to_output(wchar_t wc, char *outstp, int output_max) {
|
static inline char* encode_character(char in, char *outcp, int output_max)
|
||||||
|
{
|
||||||
|
char *entity = NULL;
|
||||||
|
int rep_lth, out_len = outcp - encoded_html_string;
|
||||||
|
|
||||||
int wctomb_result;
|
switch(in) {
|
||||||
char mbtemp[ 10];
|
case '&': entity = "&"; break;
|
||||||
|
case '"': entity = """; break;
|
||||||
wctomb_result = wctomb(mbtemp, wc);
|
case '\'': entity = "'"; break;
|
||||||
if(( wctomb_result > 0) &&
|
case '<': entity = "<"; break;
|
||||||
((( outstp - encoded_html_string) + wctomb_result) < output_max)) {
|
case '>': entity = ">"; break;
|
||||||
strncpy( outstp, mbtemp, wctomb_result);
|
|
||||||
outstp += wctomb_result;
|
|
||||||
}
|
|
||||||
return outstp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char * encode_character(wchar_t wc, char *outstp, int output_max) {
|
if (entity) {
|
||||||
|
rep_lth = strlen(entity);
|
||||||
char temp_expansion[11];
|
if (out_len + rep_lth < output_max) {
|
||||||
|
strcpy(outcp, entity);
|
||||||
sprintf(temp_expansion, "&#%u;", (unsigned int)wc);
|
outcp += rep_lth;
|
||||||
if(((outstp - encoded_html_string) + strlen(temp_expansion)) <
|
|
||||||
(unsigned int)output_max) {
|
|
||||||
strncpy(outstp, temp_expansion, strlen( temp_expansion));
|
|
||||||
outstp += strlen( temp_expansion);
|
|
||||||
}
|
}
|
||||||
return outstp;
|
return outcp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (out_len + 6 >= output_max)
|
||||||
|
return outcp;
|
||||||
|
|
||||||
|
sprintf(outcp, "&#%u", (unsigned int)in);
|
||||||
|
outcp += strlen(outcp);
|
||||||
|
|
||||||
|
return outcp;
|
||||||
|
}
|
||||||
|
|
||||||
#define WHERE_OUTSIDE_TAG 0 /* Not in an HTML tag */
|
#define WHERE_OUTSIDE_TAG 0 /* Not in an HTML tag */
|
||||||
#define WHERE_IN_TAG_NAME 1 /* In HTML tag name (either opening
|
#define WHERE_IN_TAG_NAME 1 /* In HTML tag name (either opening
|
||||||
or closing tag) */
|
or closing tag) */
|
||||||
@ -1131,11 +1135,8 @@ static char * encode_character(wchar_t wc, char *outstp, int output_max) {
|
|||||||
char * html_encode(char *input, int escape_newlines) {
|
char * html_encode(char *input, int escape_newlines) {
|
||||||
int len;
|
int len;
|
||||||
int output_max;
|
int output_max;
|
||||||
char *outstp;
|
char *incp, *outcp;
|
||||||
wchar_t *wcinput;
|
char *tagname = "";
|
||||||
wchar_t *inwcp;
|
|
||||||
wchar_t *tagname = L"";
|
|
||||||
size_t mbstowcs_result;
|
|
||||||
int x;
|
int x;
|
||||||
int where_in_tag = WHERE_OUTSIDE_TAG; /* Location in HTML tag */
|
int where_in_tag = WHERE_OUTSIDE_TAG; /* Location in HTML tag */
|
||||||
wchar_t attr_value_start = (wchar_t)0; /* character that starts the
|
wchar_t attr_value_start = (wchar_t)0; /* character that starts the
|
||||||
@ -1145,135 +1146,124 @@ char * html_encode(char *input, int escape_newlines) {
|
|||||||
/* we need up to six times the space to do the conversion */
|
/* we need up to six times the space to do the conversion */
|
||||||
len = (int)strlen(input);
|
len = (int)strlen(input);
|
||||||
output_max = len * 6;
|
output_max = len * 6;
|
||||||
if(( outstp = encoded_html_string = (char *)malloc(output_max + 1)) == NULL)
|
if(( outcp = encoded_html_string = (char *)malloc(output_max + 1)) == NULL)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
strcpy(encoded_html_string, "");
|
strcpy(encoded_html_string, "");
|
||||||
|
|
||||||
/* Convert the string to a wide character string */
|
|
||||||
if(( wcinput = malloc( len * sizeof( wchar_t))) == NULL) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if((mbstowcs_result = mbstowcs( wcinput, input, len)) == (size_t)-1) {
|
|
||||||
free( wcinput);
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process all converted characters */
|
/* Process all converted characters */
|
||||||
for( x = 0, inwcp = wcinput; x < (int)mbstowcs_result && '\0' != *inwcp;
|
for (x = 0, incp = input; x < len && *incp; x++, incp++) {
|
||||||
x++, inwcp++) {
|
|
||||||
|
|
||||||
/* Most ASCII characters don't get encoded */
|
/* Most ASCII characters don't get encoded */
|
||||||
if(( *inwcp >= 0x20 && *inwcp <= 0x7e) &&
|
if (*incp >= 0x20 && *incp <= 0x7e && !strchr("'\"&^<>", *incp)) {
|
||||||
( !( '"' == *inwcp || '&' == *inwcp || '\'' == *inwcp ||
|
*outcp++ = *incp;
|
||||||
'<' == *inwcp || '>' == *inwcp))) {
|
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
|
||||||
switch(where_in_tag) {
|
switch(where_in_tag) {
|
||||||
|
|
||||||
case WHERE_IN_TAG_NAME:
|
case WHERE_IN_TAG_NAME:
|
||||||
switch(*inwcp) {
|
switch(*incp) {
|
||||||
case 0x20:
|
case 0x20:
|
||||||
where_in_tag = WHERE_IN_TAG_OUTSIDE_ATTRIBUTE;
|
where_in_tag = WHERE_IN_TAG_OUTSIDE_ATTRIBUTE;
|
||||||
*inwcp = 0;
|
*incp = 0;
|
||||||
break;
|
break;
|
||||||
case '!':
|
case '!':
|
||||||
where_in_tag = WHERE_IN_COMMENT;
|
where_in_tag = WHERE_IN_COMMENT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WHERE_IN_TAG_OUTSIDE_ATTRIBUTE:
|
case WHERE_IN_TAG_OUTSIDE_ATTRIBUTE:
|
||||||
if(*inwcp != 0x20) {
|
if(*incp != 0x20)
|
||||||
where_in_tag = WHERE_IN_TAG_IN_ATTRIBUTE_NAME;
|
where_in_tag = WHERE_IN_TAG_IN_ATTRIBUTE_NAME;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WHERE_IN_TAG_IN_ATTRIBUTE_NAME:
|
case WHERE_IN_TAG_IN_ATTRIBUTE_NAME:
|
||||||
if(*inwcp == '=') {
|
if(*incp == '=')
|
||||||
where_in_tag = WHERE_IN_TAG_AT_EQUALS;
|
where_in_tag = WHERE_IN_TAG_AT_EQUALS;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WHERE_IN_TAG_AT_EQUALS:
|
case WHERE_IN_TAG_AT_EQUALS:
|
||||||
if(*inwcp != 0x20) {
|
if(*incp != 0x20) {
|
||||||
attr_value_start = *inwcp;
|
attr_value_start = *incp;
|
||||||
where_in_tag = WHERE_IN_TAG_IN_ATTRIBUTE_VALUE;
|
where_in_tag = WHERE_IN_TAG_IN_ATTRIBUTE_VALUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WHERE_IN_TAG_IN_ATTRIBUTE_VALUE:
|
case WHERE_IN_TAG_IN_ATTRIBUTE_VALUE:
|
||||||
if((*inwcp == 0x20) && (attr_value_start != '"') &&
|
if((*incp == 0x20) && (attr_value_start != '"') && (attr_value_start != '\''))
|
||||||
(attr_value_start != '\'')) {
|
|
||||||
where_in_tag = WHERE_IN_TAG_OUTSIDE_ATTRIBUTE;
|
where_in_tag = WHERE_IN_TAG_OUTSIDE_ATTRIBUTE;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Special handling for quotes */
|
/* Special handling for quotes */
|
||||||
else if(FALSE == escape_html_tags &&
|
else if(escape_html_tags == FALSE && (*incp == '"' || *incp == '\'')) {
|
||||||
('"' == *inwcp || '\'' == *inwcp)) {
|
|
||||||
switch(where_in_tag) {
|
switch(where_in_tag) {
|
||||||
|
|
||||||
case WHERE_OUTSIDE_TAG:
|
case WHERE_OUTSIDE_TAG:
|
||||||
if(tag_depth >0) {
|
if (tag_depth > 0)
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
}
|
else
|
||||||
else {
|
outcp = encode_character(*incp, outcp, output_max);
|
||||||
outstp = encode_character(*inwcp, outstp, output_max);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WHERE_IN_COMMENT:
|
case WHERE_IN_COMMENT:
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WHERE_IN_TAG_AT_EQUALS:
|
case WHERE_IN_TAG_AT_EQUALS:
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
attr_value_start = *inwcp;
|
attr_value_start = *incp;
|
||||||
where_in_tag = WHERE_IN_TAG_IN_ATTRIBUTE_VALUE;
|
where_in_tag = WHERE_IN_TAG_IN_ATTRIBUTE_VALUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WHERE_IN_TAG_IN_ATTRIBUTE_VALUE:
|
case WHERE_IN_TAG_IN_ATTRIBUTE_VALUE:
|
||||||
if(*(inwcp-1) == '\\') {
|
if(*(incp-1) == '\\')
|
||||||
/* This covers the case where the quote is backslash
|
/* This covers the case where the quote is backslash escaped. */
|
||||||
escaped. */
|
*outcp++ = *incp;
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
else if(attr_value_start == *incp) {
|
||||||
}
|
|
||||||
else if(attr_value_start == *inwcp) {
|
|
||||||
/* If the quote is the same type of quote that started
|
/* If the quote is the same type of quote that started
|
||||||
the attribute value and it is not backslash
|
the attribute value and it is not backslash
|
||||||
escaped, it signals the end of the attribute value */
|
escaped, it signals the end of the attribute value */
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
where_in_tag = WHERE_IN_TAG_OUTSIDE_ATTRIBUTE;
|
where_in_tag = WHERE_IN_TAG_OUTSIDE_ATTRIBUTE;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* If we encounter an quote that did not start the
|
|
||||||
attribute value and is not backslash escaped,
|
|
||||||
use it as is */
|
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (tag_depth > 0 && !wcscmp(tagname, L"script"))
|
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
|
||||||
else
|
else
|
||||||
outstp = encode_character(*inwcp, outstp, output_max);
|
/* If we encounter an quote that did not start the attribute
|
||||||
|
value and is not backslash escaped, use it as is */
|
||||||
|
*outcp++ = *incp;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (tag_depth > 0 && !strcmp(tagname, "script"))
|
||||||
|
*outcp++ = *incp;
|
||||||
|
else
|
||||||
|
outcp = encode_character(*incp, outcp, output_max);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* newlines turn to <BR> tags */
|
/* newlines turn to <BR> tags */
|
||||||
else if(escape_newlines == TRUE && '\n' == *inwcp) {
|
else if(escape_newlines == TRUE && *incp == '\n') {
|
||||||
strncpy( outstp, "<BR>", 4);
|
strncpy( outcp, "<BR>", 4);
|
||||||
outstp += 4;
|
outcp += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(escape_newlines == TRUE && '\\' == *inwcp && '\n' == *( inwcp + 1)) {
|
else if(escape_newlines == TRUE && *incp == '\\' && *(incp + 1) == '\n') {
|
||||||
strncpy( outstp, "<BR>", 4);
|
strncpy( outcp, "<BR>", 4);
|
||||||
outstp += 4;
|
outcp += 4;
|
||||||
inwcp++; /* needed so loop skips two wide characters */
|
incp++; /* needed so loop skips two characters */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO - strip all but allowed HTML tags out... */
|
/* TODO - strip all but allowed HTML tags out... */
|
||||||
else if(('<' == *inwcp) && (FALSE == escape_html_tags)) {
|
else if (*incp == '<' && escape_html_tags == FALSE) {
|
||||||
|
|
||||||
switch(where_in_tag) {
|
switch(where_in_tag) {
|
||||||
case WHERE_OUTSIDE_TAG:
|
case WHERE_OUTSIDE_TAG:
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
where_in_tag = WHERE_IN_TAG_NAME;
|
where_in_tag = WHERE_IN_TAG_NAME;
|
||||||
switch(*(inwcp+1)) {
|
switch(*(incp+1)) {
|
||||||
case '/':
|
case '/':
|
||||||
tag_depth--;
|
tag_depth--;
|
||||||
break;
|
break;
|
||||||
@ -1281,68 +1271,73 @@ char * html_encode(char *input, int escape_newlines) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tag_depth++;
|
tag_depth++;
|
||||||
tagname = inwcp + 1;
|
tagname = incp + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (tag_depth > 0 && !wcscmp(tagname, L"script"))
|
if (tag_depth > 0 && !strcmp(tagname, "script"))
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
else
|
else
|
||||||
outstp = encode_character(*inwcp, outstp, output_max);
|
outcp = encode_character(*incp, outcp, output_max);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(('>' == *inwcp) && (FALSE == escape_html_tags)) {
|
else if( *incp == '>' && escape_html_tags == FALSE) {
|
||||||
|
|
||||||
switch(where_in_tag) {
|
switch(where_in_tag) {
|
||||||
case WHERE_IN_TAG_NAME:
|
case WHERE_IN_TAG_NAME:
|
||||||
case WHERE_IN_TAG_OUTSIDE_ATTRIBUTE:
|
case WHERE_IN_TAG_OUTSIDE_ATTRIBUTE:
|
||||||
case WHERE_IN_COMMENT:
|
case WHERE_IN_COMMENT:
|
||||||
case WHERE_IN_TAG_IN_ATTRIBUTE_NAME:
|
case WHERE_IN_TAG_IN_ATTRIBUTE_NAME:
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
where_in_tag = WHERE_OUTSIDE_TAG;
|
where_in_tag = WHERE_OUTSIDE_TAG;
|
||||||
*inwcp = 0;
|
*incp = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WHERE_IN_TAG_IN_ATTRIBUTE_VALUE:
|
case WHERE_IN_TAG_IN_ATTRIBUTE_VALUE:
|
||||||
if((attr_value_start != '"') && (attr_value_start != '\'')) {
|
if((attr_value_start != '"') && (attr_value_start != '\'')) {
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
where_in_tag = WHERE_OUTSIDE_TAG;
|
where_in_tag = WHERE_OUTSIDE_TAG;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
outstp = encode_character(*inwcp, outstp, output_max);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (tag_depth > 0 && !wcscmp(tagname, L"script"))
|
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
|
||||||
else
|
else
|
||||||
outstp = encode_character(*inwcp, outstp, output_max);
|
outcp = encode_character(*incp, outcp, output_max);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (tag_depth > 0 && !strcmp(tagname, "script"))
|
||||||
|
*outcp++ = *incp;
|
||||||
|
else
|
||||||
|
outcp = encode_character(*incp, outcp, output_max);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check_multi puts out a '&ndash' so don't encode the '&' in that case */
|
/* check_multi puts out a '&ndash' so don't encode the '&' in that case */
|
||||||
else if (*inwcp == '&' && escape_html_tags == FALSE) {
|
else if (*incp == '&' && escape_html_tags == FALSE) {
|
||||||
if (tag_depth > 0 && !wcsncmp(inwcp, L"&ndash", 6))
|
if (tag_depth > 0 && !strcmp(incp, "&ndash"))
|
||||||
outstp = copy_wc_to_output(*inwcp, outstp, output_max);
|
*outcp++ = *incp;
|
||||||
else
|
else
|
||||||
outstp = encode_character(*inwcp, outstp, output_max);
|
outcp = encode_character(*incp, outcp, output_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if ((unsigned char)*incp > 0x7f)
|
||||||
|
/* pass through UTF-8 characters */
|
||||||
|
*outcp++ = *incp;
|
||||||
|
|
||||||
/* for simplicity, all other chars represented by their numeric value */
|
/* for simplicity, all other chars represented by their numeric value */
|
||||||
else {
|
else
|
||||||
outstp = encode_character(*inwcp, outstp, output_max);
|
outcp = encode_character(*incp, outcp, output_max);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Null terminate the encoded string */
|
/* Null terminate the encoded string */
|
||||||
*outstp = '\x0';
|
*outcp = '\x0';
|
||||||
encoded_html_string[ output_max - 1] = '\x0';
|
encoded_html_string[ output_max - 1] = '\x0';
|
||||||
|
|
||||||
return encoded_html_string;
|
return encoded_html_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -689,6 +689,7 @@ int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, char *ar
|
|||||||
/* HOST MACROS */
|
/* HOST MACROS */
|
||||||
/***************/
|
/***************/
|
||||||
case MACRO_HOSTGROUPNAMES:
|
case MACRO_HOSTGROUPNAMES:
|
||||||
|
case MACRO_HOSTINFOURL:
|
||||||
*free_macro = TRUE;
|
*free_macro = TRUE;
|
||||||
case MACRO_HOSTNAME:
|
case MACRO_HOSTNAME:
|
||||||
case MACRO_HOSTALIAS:
|
case MACRO_HOSTALIAS:
|
||||||
@ -828,6 +829,7 @@ int grab_macrox_value_r(nagios_macros *mac, int macro_type, char *arg1, char *ar
|
|||||||
/* SERVICE MACROS */
|
/* SERVICE MACROS */
|
||||||
/******************/
|
/******************/
|
||||||
case MACRO_SERVICEGROUPNAMES:
|
case MACRO_SERVICEGROUPNAMES:
|
||||||
|
case MACRO_SERVICEINFOURL:
|
||||||
*free_macro = TRUE;
|
*free_macro = TRUE;
|
||||||
case MACRO_SERVICEDESC:
|
case MACRO_SERVICEDESC:
|
||||||
case MACRO_SERVICESTATE:
|
case MACRO_SERVICESTATE:
|
||||||
@ -1813,6 +1815,12 @@ int grab_standard_host_macro_r(nagios_macros *mac, int macro_type, host *temp_ho
|
|||||||
*output = (char *)mkstr("%u", temp_host->hourly_value +
|
*output = (char *)mkstr("%u", temp_host->hourly_value +
|
||||||
host_services_value(temp_host));
|
host_services_value(temp_host));
|
||||||
break;
|
break;
|
||||||
|
case MACRO_HOSTINFOURL:
|
||||||
|
buf1 = get_url_encoded_string(temp_host->name);
|
||||||
|
asprintf(output, "%s/cgi-bin/extinfo.cgi?type=1&host=%s",
|
||||||
|
website_url ? website_url : "website_url not set", buf1);
|
||||||
|
my_free(buf1);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************/
|
/***************/
|
||||||
@ -2145,6 +2153,21 @@ int grab_standard_service_macro_r(nagios_macros *mac, int macro_type, service *t
|
|||||||
case MACRO_SERVICEIMPORTANCE:
|
case MACRO_SERVICEIMPORTANCE:
|
||||||
*output = (char *)mkstr("%u", temp_service->hourly_value);
|
*output = (char *)mkstr("%u", temp_service->hourly_value);
|
||||||
break;
|
break;
|
||||||
|
case MACRO_SERVICEINFOURL:
|
||||||
|
|
||||||
|
buf1 = get_url_encoded_string(temp_service->host_name);
|
||||||
|
buf2 = get_url_encoded_string(temp_service->description);
|
||||||
|
asprintf(output, "%s/cgi-bin/extinfo.cgi?type=2&host=%s&service=%s",
|
||||||
|
website_url ? website_url : "website_url not set",
|
||||||
|
buf1, buf2);
|
||||||
|
my_free(buf1);
|
||||||
|
my_free(buf2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
my_free(buf1);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************/
|
/***************/
|
||||||
@ -2778,6 +2801,8 @@ int init_macrox_names(void) {
|
|||||||
add_macrox_name(SERVICEIMPORTANCE);
|
add_macrox_name(SERVICEIMPORTANCE);
|
||||||
add_macrox_name(HOSTANDSERVICESIMPORTANCE);
|
add_macrox_name(HOSTANDSERVICESIMPORTANCE);
|
||||||
add_macrox_name(HOSTGROUPMEMBERADDRESSES);
|
add_macrox_name(HOSTGROUPMEMBERADDRESSES);
|
||||||
|
add_macrox_name(HOSTINFOURL);
|
||||||
|
add_macrox_name(SERVICEINFOURL);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
21
configure
vendored
21
configure
vendored
@ -1405,7 +1405,8 @@ Optional Packages:
|
|||||||
sets path to check results spool directory
|
sets path to check results spool directory
|
||||||
--with-temp-dir=<path> sets path to temp directory
|
--with-temp-dir=<path> sets path to temp directory
|
||||||
--with-init-dir=<path> sets directory to place init script into
|
--with-init-dir=<path> sets directory to place init script into
|
||||||
--with-lockfile=<path> sets path and file name for lock file
|
--with-lockfile=<path> sets path for lock file (default:
|
||||||
|
[/var]/run/nagios.lock)
|
||||||
--with-iobroker=<method>
|
--with-iobroker=<method>
|
||||||
specify the method to use with iobroker: epoll,
|
specify the method to use with iobroker: epoll,
|
||||||
poll, or select
|
poll, or select
|
||||||
@ -2353,9 +2354,9 @@ ac_config_headers="$ac_config_headers include/config.h lib/snprintf.h lib/iobrok
|
|||||||
|
|
||||||
PKG_NAME=nagios
|
PKG_NAME=nagios
|
||||||
|
|
||||||
PKG_VERSION="4.3.2"
|
PKG_VERSION="4.3.4"
|
||||||
PKG_HOME_URL="https://www.nagios.org/"
|
PKG_HOME_URL="https://www.nagios.org/"
|
||||||
PKG_REL_DATE="2017-05-09"
|
PKG_REL_DATE="2017-08-24"
|
||||||
|
|
||||||
ac_aux_dir=
|
ac_aux_dir=
|
||||||
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
||||||
@ -4942,11 +4943,17 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
default_lockfile_path=/var/run/nagios.lock
|
||||||
|
if test -d /run; then
|
||||||
|
default_lockfile_path=/run/nagios.lock
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether --with-lockfile was given.
|
# Check whether --with-lockfile was given.
|
||||||
if test "${with_lockfile+set}" = set; then :
|
if test "${with_lockfile+set}" = set; then :
|
||||||
withval=$with_lockfile; lockfile=$withval
|
withval=$with_lockfile; lockfile=$withval
|
||||||
else
|
else
|
||||||
lockfile=$localstatedir/nagios.lock
|
lockfile=$default_lockfile_path
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -4954,7 +4961,6 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case $host_os in
|
case $host_os in
|
||||||
linux*)
|
linux*)
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glibc at least version 2.4" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glibc at least version 2.4" >&5
|
||||||
@ -5978,7 +5984,7 @@ if test -z "$UNZIP"; then
|
|||||||
as_fn_error $? "Cannot continue without unzip!" "$LINENO" 5
|
as_fn_error $? "Cannot continue without unzip!" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile lib/Makefile subst pkginfo base/Makefile common/Makefile contrib/Makefile cgi/Makefile html/Makefile module/Makefile worker/Makefile worker/ping/Makefile xdata/Makefile daemon-init t/Makefile t-tap/Makefile"
|
ac_config_files="$ac_config_files Makefile lib/Makefile subst pkginfo base/Makefile common/Makefile contrib/Makefile cgi/Makefile html/Makefile module/Makefile worker/Makefile worker/ping/Makefile xdata/Makefile daemon-init openrc-init t/Makefile t-tap/Makefile"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -6604,6 +6610,7 @@ do
|
|||||||
"worker/ping/Makefile") CONFIG_FILES="$CONFIG_FILES worker/ping/Makefile" ;;
|
"worker/ping/Makefile") CONFIG_FILES="$CONFIG_FILES worker/ping/Makefile" ;;
|
||||||
"xdata/Makefile") CONFIG_FILES="$CONFIG_FILES xdata/Makefile" ;;
|
"xdata/Makefile") CONFIG_FILES="$CONFIG_FILES xdata/Makefile" ;;
|
||||||
"daemon-init") CONFIG_FILES="$CONFIG_FILES daemon-init" ;;
|
"daemon-init") CONFIG_FILES="$CONFIG_FILES daemon-init" ;;
|
||||||
|
"openrc-init") CONFIG_FILES="$CONFIG_FILES openrc-init" ;;
|
||||||
"t/Makefile") CONFIG_FILES="$CONFIG_FILES t/Makefile" ;;
|
"t/Makefile") CONFIG_FILES="$CONFIG_FILES t/Makefile" ;;
|
||||||
"t-tap/Makefile") CONFIG_FILES="$CONFIG_FILES t-tap/Makefile" ;;
|
"t-tap/Makefile") CONFIG_FILES="$CONFIG_FILES t-tap/Makefile" ;;
|
||||||
|
|
||||||
@ -7363,8 +7370,6 @@ perl subst sample-config/template-object/printer.cfg
|
|||||||
perl subst sample-config/template-object/switch.cfg
|
perl subst sample-config/template-object/switch.cfg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: *** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: *** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&5
|
||||||
|
21
configure.ac
21
configure.ac
@ -10,9 +10,9 @@ AC_PREFIX_DEFAULT(/usr/local/nagios)
|
|||||||
|
|
||||||
PKG_NAME=nagios
|
PKG_NAME=nagios
|
||||||
|
|
||||||
PKG_VERSION="4.3.2"
|
PKG_VERSION="4.3.4"
|
||||||
PKG_HOME_URL="https://www.nagios.org/"
|
PKG_HOME_URL="https://www.nagios.org/"
|
||||||
PKG_REL_DATE="2017-05-09"
|
PKG_REL_DATE="2017-08-24"
|
||||||
|
|
||||||
dnl Figure out how to invoke "install" and what install options to use.
|
dnl Figure out how to invoke "install" and what install options to use.
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
@ -265,15 +265,22 @@ AC_ARG_WITH(init_dir,
|
|||||||
AC_SUBST(init_dir)
|
AC_SUBST(init_dir)
|
||||||
|
|
||||||
dnl User can override lock file location
|
dnl User can override lock file location
|
||||||
|
dnl Use the /var/run/ path by default
|
||||||
|
dnl and use /run if it is available
|
||||||
|
|
||||||
|
default_lockfile_path=/var/run/nagios.lock
|
||||||
|
if test -d /run; then
|
||||||
|
default_lockfile_path=/run/nagios.lock
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_WITH(lockfile,
|
AC_ARG_WITH(lockfile,
|
||||||
AC_HELP_STRING([--with-lockfile=<path>],
|
AC_HELP_STRING([--with-lockfile=<path>],
|
||||||
[sets path and file name for lock file]),
|
[sets path for lock file (default: [/var]/run/nagios.lock)]),
|
||||||
lockfile=$withval,
|
lockfile=$withval,
|
||||||
lockfile=$localstatedir/nagios.lock
|
lockfile=$default_lockfile_path
|
||||||
)
|
)
|
||||||
AC_SUBST(lockfile)
|
AC_SUBST(lockfile)
|
||||||
|
|
||||||
|
|
||||||
dnl Determine the library to be used by the iobroker
|
dnl Determine the library to be used by the iobroker
|
||||||
|
|
||||||
dnl epoll_*() is linux specific and was added to glibc 2.3.2, so we
|
dnl epoll_*() is linux specific and was added to glibc 2.3.2, so we
|
||||||
@ -794,7 +801,7 @@ if test -z "$UNZIP"; then
|
|||||||
AC_MSG_ERROR([Cannot continue without unzip!])
|
AC_MSG_ERROR([Cannot continue without unzip!])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_OUTPUT(Makefile lib/Makefile subst pkginfo base/Makefile common/Makefile contrib/Makefile cgi/Makefile html/Makefile module/Makefile worker/Makefile worker/ping/Makefile xdata/Makefile daemon-init t/Makefile t-tap/Makefile)
|
AC_OUTPUT(Makefile lib/Makefile subst pkginfo base/Makefile common/Makefile contrib/Makefile cgi/Makefile html/Makefile module/Makefile worker/Makefile worker/ping/Makefile xdata/Makefile daemon-init openrc-init t/Makefile t-tap/Makefile)
|
||||||
|
|
||||||
|
|
||||||
perl subst include/locations.h
|
perl subst include/locations.h
|
||||||
@ -821,8 +828,6 @@ perl subst sample-config/template-object/printer.cfg
|
|||||||
perl subst sample-config/template-object/switch.cfg
|
perl subst sample-config/template-object/switch.cfg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dnl Review options
|
dnl Review options
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -91,6 +91,10 @@ check_config ()
|
|||||||
echo "ERROR: Could not delete '$NagiosCfgtestFile'"
|
echo "ERROR: Could not delete '$NagiosCfgtestFile'"
|
||||||
exit 8
|
exit 8
|
||||||
fi
|
fi
|
||||||
|
if ! su $NagiosUser -c "touch $NagiosCfgtestFile"; then
|
||||||
|
echo "ERROR: Could not create or update '$NagiosCfgtestFile'"
|
||||||
|
exit 8
|
||||||
|
fi
|
||||||
|
|
||||||
TMPFILE=$(mktemp /tmp/.configtest.XXXXXXXX)
|
TMPFILE=$(mktemp /tmp/.configtest.XXXXXXXX)
|
||||||
$NagiosBin -vp $NagiosCfgFile > "$TMPFILE"
|
$NagiosBin -vp $NagiosCfgFile > "$TMPFILE"
|
||||||
@ -99,24 +103,18 @@ check_config ()
|
|||||||
|
|
||||||
if test "$WARN" = "0" && test "${ERR}" = "0"; then
|
if test "$WARN" = "0" && test "${ERR}" = "0"; then
|
||||||
echo "OK - Configuration check verified" > $NagiosCfgtestFile
|
echo "OK - Configuration check verified" > $NagiosCfgtestFile
|
||||||
chmod 0644 $NagiosCfgtestFile
|
|
||||||
chown -h $NagiosUser:$NagiosGroup $NagiosCfgtestFile
|
|
||||||
/bin/rm "$TMPFILE"
|
/bin/rm "$TMPFILE"
|
||||||
return 0
|
return 0
|
||||||
elif test "${ERR}" = "0"; then
|
elif test "${ERR}" = "0"; then
|
||||||
# Write the errors to a file we can have a script watching for.
|
# Write the errors to a file we can have a script watching for.
|
||||||
echo "WARNING: Warnings in config files - see log for details: $NagiosCfgtestFile" > $NagiosCfgtestFile
|
echo "WARNING: Warnings in config files - see log for details: $NagiosCfgtestFile" > $NagiosCfgtestFile
|
||||||
egrep -i "(^warning|^error)" "$TMPFILE" >> $NagiosCfgtestFile
|
egrep -i "(^warning|^error)" "$TMPFILE" >> $NagiosCfgtestFile
|
||||||
chmod 0644 $NagiosCfgtestFile
|
|
||||||
chown -h $NagiosUser:$NagiosGroup $NagiosCfgtestFile
|
|
||||||
/bin/rm "$TMPFILE"
|
/bin/rm "$TMPFILE"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
# Write the errors to a file we can have a script watching for.
|
# Write the errors to a file we can have a script watching for.
|
||||||
echo "ERROR: Errors in config files - see log for details: $NagiosCfgtestFile" > $NagiosCfgtestFile
|
echo "ERROR: Errors in config files - see log for details: $NagiosCfgtestFile" > $NagiosCfgtestFile
|
||||||
egrep -i "(^warning|^error)" "$TMPFILE" >> $NagiosCfgtestFile
|
egrep -i "(^warning|^error)" "$TMPFILE" >> $NagiosCfgtestFile
|
||||||
chmod 0644 $NagiosCfgtestFile
|
|
||||||
chown -h $NagiosUser:$NagiosGroup $NagiosCfgtestFile
|
|
||||||
cat "$TMPFILE"
|
cat "$TMPFILE"
|
||||||
exit 8
|
exit 8
|
||||||
fi
|
fi
|
||||||
@ -209,10 +207,9 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch $NagiosVarDir/nagios.log $NagiosRetentionFile
|
su $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"
|
||||||
remove_commandfile
|
remove_commandfile
|
||||||
touch $NagiosRunFile
|
touch $NagiosRunFile
|
||||||
chown -h $NagiosUser:$NagiosGroup $NagiosRunFile $NagiosVarDir/nagios.log $NagiosRetentionFile
|
|
||||||
$NagiosBin -d $NagiosCfgFile
|
$NagiosBin -d $NagiosCfgFile
|
||||||
if [ -d $NagiosLockDir ]; then touch $NagiosLockDir/$NagiosLockFile; fi
|
if [ -d $NagiosLockDir ]; then touch $NagiosLockDir/$NagiosLockFile; fi
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
PROJECT_NAME = Nagios
|
PROJECT_NAME = Nagios
|
||||||
PROJECT_NUMBER = 4.3.2
|
PROJECT_NUMBER = 4.3.4
|
||||||
PROJECT_BRIEF = "Dev docs for Nagios core and neb-module hackers"
|
PROJECT_BRIEF = "Dev docs for Nagios core and neb-module hackers"
|
||||||
|
|
||||||
INPUT = lib/ docs/
|
INPUT = lib/ docs/
|
||||||
|
@ -7,10 +7,10 @@ angular.module("mapApp")
|
|||||||
cgiurl: "@cgiurl",
|
cgiurl: "@cgiurl",
|
||||||
layoutIndex: "@layout",
|
layoutIndex: "@layout",
|
||||||
dimensions: "@dimensions",
|
dimensions: "@dimensions",
|
||||||
ulxValue: "@ulx",
|
ulx: "@ulx",
|
||||||
ulyValue: "@uly",
|
uly: "@uly",
|
||||||
lrxValue: "@lrx",
|
lrx: "@lrx",
|
||||||
lryValue: "@lry",
|
lry: "@lry",
|
||||||
root: "=root",
|
root: "=root",
|
||||||
maxzoom: "=maxzoom",
|
maxzoom: "=maxzoom",
|
||||||
nolinks: "@nolinks",
|
nolinks: "@nolinks",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once(dirname(__FILE__).'/includes/utils.inc.php');
|
include_once(dirname(__FILE__).'/includes/utils.inc.php');
|
||||||
|
|
||||||
$this_version = '4.3.2';
|
$this_version = '4.3.4';
|
||||||
$this_year = '2017';
|
$this_year = '2017';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
@ -140,7 +140,7 @@ $this_year = '2017';
|
|||||||
<div id="currentversioninfo">
|
<div id="currentversioninfo">
|
||||||
<div class="product">Nagios<sup><span style="font-size: small;">®</span></sup> Core<sup><span style="font-size: small;">™</span></sup></div>
|
<div class="product">Nagios<sup><span style="font-size: small;">®</span></sup> Core<sup><span style="font-size: small;">™</span></sup></div>
|
||||||
<div class="version">Version <?php echo $this_version; ?></div>
|
<div class="version">Version <?php echo $this_version; ?></div>
|
||||||
<div class="releasedate">May 09, 2017</div>
|
<div class="releasedate">August 24, 2017</div>
|
||||||
<div class="checkforupdates"><a href="https://www.nagios.org/checkforupdates/?version=<?php echo $this_version; ?>&product=nagioscore" target="_blank">Check for updates</a></div>
|
<div class="checkforupdates"><a href="https://www.nagios.org/checkforupdates/?version=<?php echo $this_version; ?>&product=nagioscore" target="_blank">Check for updates</a></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
12
html/map.php
12
html/map.php
@ -27,6 +27,18 @@
|
|||||||
if ($layout > 10 || $layout < 0)
|
if ($layout > 10 || $layout < 0)
|
||||||
$layout = 6;
|
$layout = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This allows a user supplied layout */
|
||||||
|
if (
|
||||||
|
filter_input(INPUT_GET, 'layout', FILTER_VALIDATE_INT) === 0 ||
|
||||||
|
filter_input(INPUT_GET, 'layout', FILTER_VALIDATE_INT, array(
|
||||||
|
"options" => array("min_range"=>1, "max_range"=>10)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$layout = $_GET['layout'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($layout == 4)
|
if ($layout == 4)
|
||||||
$layout = 6;
|
$layout = 6;
|
||||||
?>
|
?>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once(dirname(__FILE__).'/includes/utils.inc.php');
|
include_once(dirname(__FILE__).'/includes/utils.inc.php');
|
||||||
|
|
||||||
$this_version = '4.3.2';
|
$this_version = '4.3.4';
|
||||||
$link_target = 'main';
|
$link_target = 'main';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
#define PROGRAM_VERSION "4.3.2"
|
#define PROGRAM_VERSION "4.3.4"
|
||||||
#define PROGRAM_MODIFICATION_DATE "2017-05-09"
|
#define PROGRAM_MODIFICATION_DATE "2017-08-24"
|
||||||
|
|
||||||
NAGIOS_BEGIN_DECL
|
NAGIOS_BEGIN_DECL
|
||||||
|
|
||||||
@ -66,6 +66,7 @@ extern int obsess_over_hosts;
|
|||||||
extern int enable_timing_point;
|
extern int enable_timing_point;
|
||||||
|
|
||||||
extern char *config_file_dir;
|
extern char *config_file_dir;
|
||||||
|
extern char *website_url;
|
||||||
|
|
||||||
#ifdef HAVE_TZNAME
|
#ifdef HAVE_TZNAME
|
||||||
#ifdef CYGWIN
|
#ifdef CYGWIN
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#define MAX_USER_MACROS 256 /* maximum number of $USERx$ macros */
|
#define MAX_USER_MACROS 256 /* maximum number of $USERx$ macros */
|
||||||
|
|
||||||
#define MACRO_X_COUNT 157 /* size of macro_x[] array */
|
#define MACRO_X_COUNT 159 /* size of macro_x[] array */
|
||||||
|
|
||||||
NAGIOS_BEGIN_DECL
|
NAGIOS_BEGIN_DECL
|
||||||
|
|
||||||
@ -218,6 +218,8 @@ typedef struct nagios_macros nagios_macros;
|
|||||||
#define MACRO_SERVICEIMPORTANCE 154
|
#define MACRO_SERVICEIMPORTANCE 154
|
||||||
#define MACRO_HOSTANDSERVICESIMPORTANCE 155
|
#define MACRO_HOSTANDSERVICESIMPORTANCE 155
|
||||||
#define MACRO_HOSTGROUPMEMBERADDRESSES 156
|
#define MACRO_HOSTGROUPMEMBERADDRESSES 156
|
||||||
|
#define MACRO_HOSTINFOURL 157
|
||||||
|
#define MACRO_SERVICEINFOURL 158
|
||||||
|
|
||||||
|
|
||||||
/************* MACRO CLEANING OPTIONS *****************/
|
/************* MACRO CLEANING OPTIONS *****************/
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
Summary: Open Source host, service and network monitoring program
|
Summary: Open Source host, service and network monitoring program
|
||||||
Name: nagios
|
Name: nagios
|
||||||
Version: 4.3.2
|
Version: 4.3.4
|
||||||
Release: 2%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
|
66
openrc-init.in
Normal file
66
openrc-init.in
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
# This is a custom variable, and has the following default value if a
|
||||||
|
# specific config file is not defined by the user.
|
||||||
|
: ${NAGIOS_CONFIG:="@sysconfdir@/nagios.cfg"}
|
||||||
|
|
||||||
|
# These two facilitate the bindir variable substitution below.
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
|
||||||
|
# The rest are OpenRC variables.
|
||||||
|
extra_commands="checkconfig"
|
||||||
|
extra_started_commands="reload"
|
||||||
|
|
||||||
|
# We put "--daemon" in command_args and not command_args_background
|
||||||
|
# because the latter interacts weirdly with the config file argument.
|
||||||
|
command="@bindir@/nagios"
|
||||||
|
command_args="--daemon ${NAGIOS_CONFIG}"
|
||||||
|
pidfile="@lockfile@"
|
||||||
|
|
||||||
|
depend(){
|
||||||
|
# Most daemons don't really *need* the network; they're happy with
|
||||||
|
# the loopback interface. However, nagios might start generating
|
||||||
|
# "EVERYTHING IS DOWN" alerts if it starts before the real live
|
||||||
|
# network comes up.
|
||||||
|
need net
|
||||||
|
use logger
|
||||||
|
after mysql postgresql
|
||||||
|
}
|
||||||
|
|
||||||
|
reload(){
|
||||||
|
checkconfig || return $?
|
||||||
|
ebegin "Reloading configuration"
|
||||||
|
start-stop-daemon --signal HUP --pidfile "${pidfile}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
checkconfig(){
|
||||||
|
ebegin "Verifying config files"
|
||||||
|
|
||||||
|
# Save the output in case verification fails and errors are printed.
|
||||||
|
OUTPUT=$( ${command} --verify-config "${NAGIOS_CONFIG}" )
|
||||||
|
|
||||||
|
# Save the exit code from the verification so that `echo` doesn't
|
||||||
|
# clobber it. Then, if verification failed, show its
|
||||||
|
# output. Otherwise, succeed quietly.
|
||||||
|
local exit_code=$?
|
||||||
|
[ $exit_code -ne 0 ] && echo "${OUTPUT}" >&2
|
||||||
|
eend $exit_code
|
||||||
|
}
|
||||||
|
|
||||||
|
start_pre() {
|
||||||
|
# Without this, the "start" action will appear to succeed even if
|
||||||
|
# the config file contains errors, and the daemon fails to start.
|
||||||
|
# Another approach would be to wait for the PID file to appear, but
|
||||||
|
# this is fast enough and feels cleaner.
|
||||||
|
checkconfig || return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_pre() {
|
||||||
|
# If this is a restart, check to make sure the user's config
|
||||||
|
# isn't busted before we stop the running daemon.
|
||||||
|
if [ "${RC_CMD}" = "restart" ] ; then
|
||||||
|
checkconfig || return $?
|
||||||
|
fi
|
||||||
|
}
|
@ -12,10 +12,10 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Current version number
|
# Current version number
|
||||||
CURRENTVERSION=4.3.2
|
CURRENTVERSION=4.3.4
|
||||||
|
|
||||||
# Last date
|
# Last date
|
||||||
LASTDATE=2017-05-09
|
LASTDATE=2017-08-24
|
||||||
|
|
||||||
if [ "x$1" = "x" ]
|
if [ "x$1" = "x" ]
|
||||||
then
|
then
|
||||||
|
@ -679,12 +679,28 @@ int xodtemplate_process_config_file(char *filename, int options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check validity of object type */
|
/* check validity of object type */
|
||||||
if(strcmp(input, "timeperiod") && strcmp(input, "command") && strcmp(input, "contact") && strcmp(input, "contactgroup") && strcmp(input, "host") && strcmp(input, "hostgroup") && strcmp(input, "servicegroup") && strcmp(input, "service") && strcmp(input, "servicedependency") && strcmp(input, "serviceescalation") && strcmp(input, "hostgroupescalation") && strcmp(input, "hostdependency") && strcmp(input, "hostescalation")) {
|
if( strcmp(input, "timeperiod")
|
||||||
if(strcmp(input, "hostextinfo") && strcmp(input, "serviceextinfo")) {
|
&& strcmp(input, "command")
|
||||||
|
&& strcmp(input, "contact")
|
||||||
|
&& strcmp(input, "contactgroup")
|
||||||
|
&& strcmp(input, "host")
|
||||||
|
&& strcmp(input, "hostgroup")
|
||||||
|
&& strcmp(input, "servicegroup")
|
||||||
|
&& strcmp(input, "service")
|
||||||
|
&& strcmp(input, "servicedependency")
|
||||||
|
&& strcmp(input, "serviceescalation")
|
||||||
|
&& strcmp(input, "hostgroupescalation")
|
||||||
|
&& strcmp(input, "hostdependency")
|
||||||
|
&& strcmp(input, "hostescalation")) {
|
||||||
|
|
||||||
|
if ( strcmp(input, "hostextinfo")
|
||||||
|
&& strcmp(input, "serviceextinfo")) {
|
||||||
|
|
||||||
logit(NSLOG_CONFIG_ERROR, TRUE, "Error: Invalid object definition type '%s' in file '%s' on line %d.\n", input, filename, current_line);
|
logit(NSLOG_CONFIG_ERROR, TRUE, "Error: Invalid object definition type '%s' in file '%s' on line %d.\n", input, filename, current_line);
|
||||||
result = ERROR;
|
result = ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
logit(NSLOG_CONFIG_WARNING, TRUE, "WARNING: Extinfo objects are deprecated and will be removed in future versions\n");
|
logit(NSLOG_CONFIG_WARNING, TRUE, "WARNING: Extinfo objects are deprecated and will be removed in future versions\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2399,7 +2415,7 @@ int xodtemplate_add_object_property(char *input, int options) {
|
|||||||
}
|
}
|
||||||
else if(!strcmp(variable, "retry_interval") || !strcmp(variable, "retry_check_interval")) {
|
else if(!strcmp(variable, "retry_interval") || !strcmp(variable, "retry_check_interval")) {
|
||||||
if(!strcmp(variable, "retry_check_interval"))
|
if(!strcmp(variable, "retry_check_interval"))
|
||||||
logit(NSLOG_CONFIG_WARNING, TRUE, "WARNING: The normal_retry_interval attribute is deprecated and will be removed in future versions. Please use retry_interval instead.\n");
|
logit(NSLOG_CONFIG_WARNING, TRUE, "WARNING: The retry_check_interval attribute is deprecated and will be removed in future versions. Please use retry_interval instead.\n");
|
||||||
temp_host->retry_interval = strtod(value, NULL);
|
temp_host->retry_interval = strtod(value, NULL);
|
||||||
temp_host->have_retry_interval = TRUE;
|
temp_host->have_retry_interval = TRUE;
|
||||||
}
|
}
|
||||||
@ -2858,7 +2874,7 @@ int xodtemplate_add_object_property(char *input, int options) {
|
|||||||
}
|
}
|
||||||
else if(!strcmp(variable, "retry_interval") || !strcmp(variable, "retry_check_interval")) {
|
else if(!strcmp(variable, "retry_interval") || !strcmp(variable, "retry_check_interval")) {
|
||||||
if(!strcmp(variable, "retry_check_interval"))
|
if(!strcmp(variable, "retry_check_interval"))
|
||||||
logit(NSLOG_CONFIG_WARNING, TRUE, "WARNING: The normal_retry_interval attribute is deprecated and will be removed in future versions. Please use retry_interval instead.\n");
|
logit(NSLOG_CONFIG_WARNING, TRUE, "WARNING: The retry_check_interval attribute is deprecated and will be removed in future versions. Please use retry_interval instead.\n");
|
||||||
temp_service->retry_interval = strtod(value, NULL);
|
temp_service->retry_interval = strtod(value, NULL);
|
||||||
temp_service->have_retry_interval = TRUE;
|
temp_service->have_retry_interval = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -237,6 +237,7 @@ int xsddefault_save_status_data(void) {
|
|||||||
fprintf(fp, "\tcheck_command=%s\n", (temp_host->check_command == NULL) ? "" : temp_host->check_command);
|
fprintf(fp, "\tcheck_command=%s\n", (temp_host->check_command == NULL) ? "" : temp_host->check_command);
|
||||||
fprintf(fp, "\tcheck_period=%s\n", (temp_host->check_period == NULL) ? "" : temp_host->check_period);
|
fprintf(fp, "\tcheck_period=%s\n", (temp_host->check_period == NULL) ? "" : temp_host->check_period);
|
||||||
fprintf(fp, "\tnotification_period=%s\n", (temp_host->notification_period == NULL) ? "" : temp_host->notification_period);
|
fprintf(fp, "\tnotification_period=%s\n", (temp_host->notification_period == NULL) ? "" : temp_host->notification_period);
|
||||||
|
fprintf(fp, "\timportance=%u\n", temp_host->hourly_value);
|
||||||
fprintf(fp, "\tcheck_interval=%f\n", temp_host->check_interval);
|
fprintf(fp, "\tcheck_interval=%f\n", temp_host->check_interval);
|
||||||
fprintf(fp, "\tretry_interval=%f\n", temp_host->retry_interval);
|
fprintf(fp, "\tretry_interval=%f\n", temp_host->retry_interval);
|
||||||
fprintf(fp, "\tevent_handler=%s\n", (temp_host->event_handler == NULL) ? "" : temp_host->event_handler);
|
fprintf(fp, "\tevent_handler=%s\n", (temp_host->event_handler == NULL) ? "" : temp_host->event_handler);
|
||||||
@ -303,6 +304,7 @@ int xsddefault_save_status_data(void) {
|
|||||||
fprintf(fp, "\tcheck_command=%s\n", (temp_service->check_command == NULL) ? "" : temp_service->check_command);
|
fprintf(fp, "\tcheck_command=%s\n", (temp_service->check_command == NULL) ? "" : temp_service->check_command);
|
||||||
fprintf(fp, "\tcheck_period=%s\n", (temp_service->check_period == NULL) ? "" : temp_service->check_period);
|
fprintf(fp, "\tcheck_period=%s\n", (temp_service->check_period == NULL) ? "" : temp_service->check_period);
|
||||||
fprintf(fp, "\tnotification_period=%s\n", (temp_service->notification_period == NULL) ? "" : temp_service->notification_period);
|
fprintf(fp, "\tnotification_period=%s\n", (temp_service->notification_period == NULL) ? "" : temp_service->notification_period);
|
||||||
|
fprintf(fp, "\timportance=%u\n", temp_service->hourly_value);
|
||||||
fprintf(fp, "\tcheck_interval=%f\n", temp_service->check_interval);
|
fprintf(fp, "\tcheck_interval=%f\n", temp_service->check_interval);
|
||||||
fprintf(fp, "\tretry_interval=%f\n", temp_service->retry_interval);
|
fprintf(fp, "\tretry_interval=%f\n", temp_service->retry_interval);
|
||||||
fprintf(fp, "\tevent_handler=%s\n", (temp_service->event_handler == NULL) ? "" : temp_service->event_handler);
|
fprintf(fp, "\tevent_handler=%s\n", (temp_service->event_handler == NULL) ? "" : temp_service->event_handler);
|
||||||
|
Loading…
Reference in New Issue
Block a user