set sane format for archived logs, so the files would be sortable
ideally this should came from config (date_format=iso8601)
---- nagios-3.4.1/base/logging.c~ 2012-05-24 17:09:34.000000000 +0300
-+++ nagios-3.4.1/base/logging.c 2012-05-24 17:10:09.466859755 +0300
-@@ -424,7 +424,7 @@
- stat_result = stat(log_file, &log_file_stat);
+diff -urNp -x '*.orig' nagios-4.4.6.org/base/logging.c nagios-4.4.6/base/logging.c
+--- nagios-4.4.6.org/base/logging.c 2021-04-19 12:04:00.320026000 +0200
++++ nagios-4.4.6/base/logging.c 2021-04-19 12:04:00.590034030 +0200
+@@ -406,7 +406,7 @@ int rotate_log_file(time_t rotation_time
+ close_log_file();
/* get the archived filename to use */
- asprintf(&log_archive, "%s%snagios-%02d-%02d-%d-%02d.log", log_archive_path, (log_archive_path[strlen(log_archive_path) - 1] == '/') ? "" : "/", t->tm_mon + 1, t->tm_mday, t->tm_year + 1900, t->tm_hour);
+ asprintf(&log_archive, "%s%snagios-%04d-%02d-%02d-%02d.log", log_archive_path, (log_archive_path[strlen(log_archive_path) - 1] == '/') ? "" : "/", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour);
- /* rotate the log file */
- rename_result = my_rename(log_file, log_archive);
---- nagios-3.4.1/cgi/cgiutils.c~ 2012-05-24 17:09:34.000000000 +0300
-+++ nagios-3.4.1/cgi/cgiutils.c 2012-05-24 17:11:08.629380008 +0300
-@@ -1143,7 +1143,7 @@
+ /* HACK: If the archive exists, don't overwrite it. This is a hack
+ because the real problem is that some log rotations are executed
+diff -urNp -x '*.orig' nagios-4.4.6.org/cgi/cgiutils.c nagios-4.4.6/cgi/cgiutils.c
+--- nagios-4.4.6.org/cgi/cgiutils.c 2021-04-19 12:04:00.296691972 +0200
++++ nagios-4.4.6/cgi/cgiutils.c 2021-04-19 12:04:00.590034030 +0200
+@@ -1468,7 +1468,7 @@ void get_log_archive_to_use(int archive,
t = localtime(&this_scheduled_log_rotation);
/* use the time that the log rotation occurred to figure out the name of the log file */
-diff -ur nagios.org/html/config.inc.php.in nagios/html/config.inc.php.in
---- nagios.org/html/config.inc.php.in 2013-09-20 21:01:20.000000000 +0200
-+++ nagios/html/config.inc.php.in 2013-10-01 21:51:45.176497587 +0200
-@@ -2,7 +2,7 @@
- //
-
-
--$cfg['cgi_config_file']='@sysconfdir@/cgi.cfg'; // location of the CGI config file
-+$cfg['cgi_config_file']='/etc/webapps/nagios/cgi.cfg'; // location of the CGI config file
-
- $cfg['cgi_base_url']='@cgiurl@';
-
---- nagios.org/Makefile.in 2013-09-20 21:01:20.000000000 +0200
-+++ nagios/Makefile.in 2013-10-01 21:51:45.176497587 +0200
-@@ -234,14 +234,14 @@ install:
+diff -urNp -x '*.orig' nagios-4.4.6.org/Makefile.in nagios-4.4.6/Makefile.in
+--- nagios-4.4.6.org/Makefile.in 2020-04-28 22:48:29.000000000 +0200
++++ nagios-4.4.6/Makefile.in 2021-04-19 12:03:30.865816616 +0200
+@@ -276,14 +276,14 @@ install:
cd $(SRC_BASE) && $(MAKE) $@
cd $(SRC_CGI) && $(MAKE) $@
cd $(SRC_HTM) && $(MAKE) $@
$(MAKE) install-basic
install-basic:
---- nagios-4.2.1/sample-config/cgi.cfg.in~ 2016-09-07 19:22:34.000000000 +0300
-+++ nagios-4.2.1/sample-config/cgi.cfg.in 2016-09-07 19:22:52.152175332 +0300
+diff -urNp -x '*.orig' nagios-4.4.6.org/html/config.inc.php.in nagios-4.4.6/html/config.inc.php.in
+--- nagios-4.4.6.org/html/config.inc.php.in 2020-04-28 22:48:29.000000000 +0200
++++ nagios-4.4.6/html/config.inc.php.in 2021-04-19 12:03:30.865816616 +0200
+@@ -2,7 +2,7 @@
+ //
+
+
+-$cfg['cgi_config_file']='@sysconfdir@/cgi.cfg'; // location of the CGI config file
++$cfg['cgi_config_file']='/etc/webapps/nagios/cgi.cfg'; // location of the CGI config file
+
+ $cfg['cgi_base_url']='@cgiurl@';
+
+diff -urNp -x '*.orig' nagios-4.4.6.org/sample-config/cgi.cfg.in nagios-4.4.6/sample-config/cgi.cfg.in
+--- nagios-4.4.6.org/sample-config/cgi.cfg.in 2020-04-28 22:48:29.000000000 +0200
++++ nagios-4.4.6/sample-config/cgi.cfg.in 2021-04-19 12:03:30.865816616 +0200
@@ -1,6 +1,6 @@
#################################################################
#
#
#
#################################################################
-@@ -42,7 +42,7 @@
+@@ -42,7 +42,7 @@ url_html_path=@htmurl@
# Values: 0 = disables context-sensitive help
# 1 = enables context-sensitive help
-@@ -263,7 +263,7 @@
+@@ -270,7 +270,7 @@ default_statuswrl_layout=4
# OS and distribution, so you may have to tweak this to
# work on your system.
#CMT_SCHEDULE_HOST_DOWNTIME=0
+
+# vim:ts=8:sw=8:ft=cfg
---- nagios.org/sample-config/nagios.cfg.in 2013-09-20 21:01:20.000000000 +0200
-+++ nagios/sample-config/nagios.cfg.in 2013-10-01 21:53:09.708504449 +0200
+diff -urNp -x '*.orig' nagios-4.4.6.org/sample-config/nagios.cfg.in nagios-4.4.6/sample-config/nagios.cfg.in
+--- nagios-4.4.6.org/sample-config/nagios.cfg.in 2020-04-28 22:48:29.000000000 +0200
++++ nagios-4.4.6/sample-config/nagios.cfg.in 2021-04-19 12:03:30.865816616 +0200
@@ -1,6 +1,6 @@
##############################################################################
#
# Read the documentation for more information on this configuration
# file. I've provided some comments here, but things may not be so
@@ -15,7 +15,7 @@
- # for historical purposes. This should be the first option specified
+ # for historical purposes. This should be the first option specified
# in the config file!!!
-log_file=@localstatedir@/nagios.log
-@@ -26,13 +26,14 @@
+@@ -26,13 +26,14 @@ log_file=@localstatedir@/nagios.log
# if you wish (as shown below), or keep them all in a single config file.
# You can specify individual object config files as shown below:
# Definitions for monitoring a Windows machine
#cfg_file=@sysconfdir@/objects/windows.cfg
-@@ -47,13 +48,8 @@
+@@ -47,13 +48,8 @@ cfg_file=@sysconfdir@/objects/localhost.
# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:
# OBJECT CACHE FILE
-@@ -242,7 +238,7 @@
- # This is the directory where archived (rotated) log files should be
+@@ -243,7 +239,7 @@ log_rotation_method=d
+ # This is the directory where archived (rotated) log files should be
# placed (assuming you've chosen to do log rotation).
-log_archive_path=@localstatedir@/archives
-@@ -250,7 +246,7 @@
+@@ -251,7 +247,7 @@ log_archive_path=@localstatedir@/archive
# If you want messages logged to the syslog facility, as well as the
# Nagios log file set this option to 1. If not, set it to 0.
-@@ -707,7 +703,7 @@
- # by Nagios Enterprises from the update check is processed in accordance
- # with our privacy policy - see http://api.nagios.org for details.
+@@ -709,7 +705,7 @@ interval_length=60
+ # by Nagios Enterprises from the update check is processed in accordance
+ # with our privacy policy - see https://api.nagios.org for details.
-check_for_updates=1
+check_for_updates=0
-@@ -719,7 +715,7 @@
- # this data to determine the number of users running specific version of
+@@ -721,7 +717,7 @@ check_for_updates=1
+ # this data to determine the number of users running specific version of
# Nagios. Enable this option if you do not want this information to be sent.
-bare_update_check=0
-@@ -854,8 +850,8 @@
+@@ -856,8 +852,8 @@ process_performance_data=0
# pipe ("p") mode which avoid blocking at startup, otherwise you will
- # likely want the defult append ("a") mode.
+ # likely want the default append ("a") mode.
-#host_perfdata_file_mode=a
-#service_perfdata_file_mode=a
-@@ -1091,7 +1087,7 @@
+@@ -1093,7 +1089,7 @@ high_host_flap_threshold=20.0
# strict-iso8601 (YYYY-MM-DDTHH:MM:SS)
#
-@@ -1285,7 +1281,7 @@
+@@ -1292,7 +1288,7 @@ debug_verbosity=1
# DEBUG FILE
# This option determines where Nagios should write debugging information.
---- nagios.org/sample-config/resource.cfg.in 2013-09-20 21:01:20.000000000 +0200
-+++ nagios/sample-config/resource.cfg.in 2013-10-01 21:52:53.371451113 +0200
+diff -urNp -x '*.orig' nagios-4.4.6.org/sample-config/resource.cfg.in nagios-4.4.6/sample-config/resource.cfg.in
+--- nagios-4.4.6.org/sample-config/resource.cfg.in 2021-04-19 12:03:30.622476046 +0200
++++ nagios-4.4.6/sample-config/resource.cfg.in 2021-04-19 12:03:30.865816616 +0200
@@ -1,6 +1,6 @@
###########################################################################
#
use update_checks_enabled option to tune the default (altho new option would be
more reasonable)
---- nagios/html/main.php~ 2012-05-29 00:04:23.000000000 +0300
-+++ nagios/html/main.php 2012-05-29 00:08:36.419474072 +0300
-@@ -25,6 +25,10 @@ $this_year = '2018';
+diff -urNp -x '*.orig' nagios-4.4.6.org/html/main.php nagios-4.4.6/html/main.php
+--- nagios-4.4.6.org/html/main.php 2021-04-19 12:04:15.360473328 +0200
++++ nagios-4.4.6/html/main.php 2021-04-19 12:04:15.620481061 +0200
+@@ -25,6 +25,10 @@ $this_year = '2020';
var vboxText = "<a href=https://www.nagios.com/tours target=_blank> " +
"Click here to watch the entire Nagios Core 4 Tour!</a>";
<?php } ?>
+ if ($updateinfo['update_checks_enabled']!==false):
+?>
$(document).ready(function() {
- var user = "<?php echo $_SERVER['REMOTE_USER']; ?>";
+ var user = "<?php echo htmlspecialchars($_SERVER['REMOTE_USER']); ?>";
-@@ -31,7 +34,9 @@ $this_year = '2014';
+@@ -47,7 +51,9 @@ $this_year = '2020';
'#splashbox5-contents', 'corepromo', 3,
'<ul>', processPromoItem, '</ul>'
);
getCoreStatus();
});
-@@ -141,7 +141,7 @@ $this_year = '2014';
+@@ -152,7 +158,7 @@ $this_year = '2020';
<div id="updateversioninfo">
<?php
---- nagios-4.2.1/cgi/statusmap.c~ 2016-09-07 19:23:29.000000000 +0300
-+++ nagios-4.2.1/cgi/statusmap.c 2016-09-07 19:24:13.969747452 +0300
-@@ -27,6 +27,10 @@
+diff -urNp -x '*.orig' nagios-4.4.6.org/cgi/statusmap.c nagios-4.4.6/cgi/statusmap.c
+--- nagios-4.4.6.org/cgi/statusmap.c 2021-04-19 12:03:46.639619108 +0200
++++ nagios-4.4.6/cgi/statusmap.c 2021-04-19 12:03:46.922960869 +0200
+@@ -25,6 +25,10 @@
*
*****************************************************************************/
#include "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
-@@ -92,6 +92,7 @@ extern int default_statusmap_layout_meth
+@@ -89,6 +93,7 @@ extern int default_statusmap_layout_meth
#define LAYOUT_CIRCULAR 4
#define LAYOUT_CIRCULAR_MARKUP 5
#define LAYOUT_CIRCULAR_BALLOON 6
struct layer {
-@@ -99,6 +100,20 @@ struct layer {
+@@ -96,6 +101,20 @@ struct layer {
struct layer *next;
};
void document_header(int);
void document_footer(void);
-@@ -117,6 +135,10 @@
+@@ -113,6 +132,10 @@ void load_background_image(void);
void draw_background_image(void);
void draw_background_extras(void);
void draw_host_links(void);
+void write_google_head_code(void);
+
void draw_hosts(void);
- void draw_host_text(char *,int,int);
- void draw_text(char *,int,int,int);
-@@ -288,12 +310,11 @@
+ void draw_host_text(char *, int, int);
+ void draw_text(char *, int, int, int);
+@@ -287,12 +310,11 @@ int main(int argc, char **argv) {
/* initialize macros */
init_macros();
/* display the network map... */
display_map();
-@@ -345,9 +366,14 @@
+@@ -344,9 +366,14 @@ void document_header(int use_stylesheet)
/* write JavaScript code for popup window */
write_popup_code();
printf("<body CLASS='statusmap' name='mappage' id='mappage'>\n");
/* include user SSI header */
-@@ -745,9 +745,9 @@
+@@ -718,9 +745,9 @@ void display_page_header(void) {
printf("<td align=right valign=top>\n");
#ifdef LEGACY_GRAPHICAL_CGIS
#endif
printf("<table border=0 CLASS='optBox'>\n");
printf("<tr><td valign=top>\n");
-@@ -725,6 +751,7 @@
+@@ -743,6 +770,7 @@ void display_page_header(void) {
printf("<option value=%d %s>Circular\n", LAYOUT_CIRCULAR, (layout_method == LAYOUT_CIRCULAR) ? "selected" : "");
printf("<option value=%d %s>Circular (Marked Up)\n", LAYOUT_CIRCULAR_MARKUP, (layout_method == LAYOUT_CIRCULAR_MARKUP) ? "selected" : "");
printf("<option value=%d %s>Circular (Balloon)\n", LAYOUT_CIRCULAR_BALLOON, (layout_method == LAYOUT_CIRCULAR_BALLOON) ? "selected" : "");
printf("</select>\n");
printf("</td>\n");
printf("<td CLASS='optBoxItem'>\n");
-@@ -821,6 +848,11 @@
+@@ -839,6 +867,11 @@ void display_map(void) {
/* display page header */
display_page_header();
initialize_graphics();
draw_background_image();
draw_background_extras();
-@@ -1563,10 +1602,19 @@
+@@ -1585,10 +1618,19 @@ void draw_host_links(void) {
return;
}
+
host *temp_host;
int x1, x2;
- int y1, y2;
-@@ -1586,6 +1634,8 @@
+ int y1;
+@@ -1608,6 +1650,8 @@ void draw_hosts(void) {
int translated_x;
int translated_y;
/* user didn't supply any coordinates for hosts, so display a warning */
if(coordinates_were_specified == FALSE) {
-@@ -2241,6 +2291,197 @@
+@@ -2265,6 +2309,197 @@ void cleanup_graphics(void) {
/************************* MISC FUNCTIONS *************************/
/******************************************************************/
+}
/* write JavaScript code an layer for popup window */
- void write_popup_code(void){
+ void write_popup_code(void) {
---- nagios-1.2/configure.ac.orig Tue Feb 3 05:45:08 2004
-+++ nagios-1.2/configure.ac Fri May 7 11:28:28 2004
-@@ -533,7 +533,7 @@
- if test x$TRYGD = xyep; then
+diff -urNp -x '*.orig' nagios-4.4.6.org/configure.ac nagios-4.4.6/configure.ac
+--- nagios-4.4.6.org/configure.ac 2020-04-28 22:48:29.000000000 +0200
++++ nagios-4.4.6/configure.ac 2021-04-19 12:03:10.815220244 +0200
+@@ -548,7 +548,7 @@ dnl Should we try and detect the GD libs
+ if test "x$TRYGD" = "xyes"; then
dnl libiconv is required on some systems - tack it on if found
- AC_CHECK_LIB(iconv,main,ICONV=-liconv,)