Merge remote-tracking branch 'origin/develop' into ent-11387-post-mantener-conteo-y-comentarios-de-in-process-extra-id

This commit is contained in:
daniel 2023-07-19 11:39:06 +02:00
commit 1f1b85561c
149 changed files with 39023 additions and 2671 deletions
extras/deploy-scripts
pandora_agents
pandora_console
DEBIAN
extras
general
godmode
images
include

@ -11,7 +11,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2023050901'
S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
@ -285,8 +285,7 @@ console_dependencies=" \
mod_ssl \
libzstd \
openldap-clients \
chromium \
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
chromium"
execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
@ -313,7 +312,6 @@ server_dependencies=" \
bind-utils \
whois \
cpanminus \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.pandorafms.com/centos7/pandorawmic-1.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -341,7 +339,6 @@ execute_cmd "yum install -y $oracle_dependencies || yum reinstall -y $oracle_dep
#ipam dependencies
ipam_dependencies=" \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
@ -719,6 +716,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
systemctl enable pandora_agent_daemon &>> $LOGFILE
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
# Enable postrix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2023050901'
S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
@ -344,8 +344,7 @@ console_dependencies=" \
http://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \
http://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \
http://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
http://firefly.pandorafms.com/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm"
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm"
execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies"
# Server dependencies
@ -371,7 +370,7 @@ server_dependencies=" \
java \
bind-utils \
whois \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
libnsl \
http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm"
execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -399,7 +398,6 @@ execute_cmd "dnf install -y $oracle_dependencies" "Installing Oracle Instant cli
#ipam dependencies
ipam_dependencies=" \
http://firefly.pandorafms.com/centos7/xprobe2-0.3-12.2.x86_64.rpm \
perl(NetAddr::IP) \
perl(Sys::Syslog) \
perl(DBI) \
@ -622,8 +620,9 @@ sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
#adding 900s to httpd timeout
#adding 900s to httpd timeout and 300 to ProxyTimeout
echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf
echo 'ProxyTimeout 300' >> /etc/httpd/conf.d/timeout.conf
cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
@ -787,6 +786,9 @@ echo "* * * * * root wget -q -O - --no-check-certificate --load-cookies /tmp/cro
systemctl enable pandora_agent_daemon &>> "$LOGFILE"
execute_cmd "systemctl start pandora_agent_daemon" "Starting Pandora FMS Agent"
# Enable postfix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

@ -17,7 +17,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy
S_VERSION='2023050901'
S_VERSION='2023062901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
@ -265,7 +265,6 @@ server_dependencies=" \
openssh-client \
postfix \
unzip \
xprobe \
coreutils \
libio-compress-perl \
libmoosex-role-timer-perl \
@ -287,6 +286,7 @@ server_dependencies=" \
libgeo-ip-perl \
arping \
snmp-mibs-downloader \
libnsl2 \
openjdk-8-jdk "
execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
@ -299,17 +299,7 @@ echo -en "${cyan}Installing wmic and pandorawmic...${reset}"
chmod +x pandorawmic wmic &>> "$LOGFILE" && \
cp -a wmic /usr/bin/ &>> "$LOGFILE" && \
cp -a pandorawmic /usr/bin/ &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs"
# phantomjs
echo -en "${cyan}Installing phantomjs...${reset}"
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
export OPENSSL_CONF=/etc/ssl
curl -LSs -O "https://firefly.pandorafms.com/pandorafms/utils/$PHANTOM_JS.tar.bz2" &>> "$LOGFILE" && \
tar xvjf "$PHANTOM_JS.tar.bz2" &>> "$LOGFILE" && \
mv $PHANTOM_JS/bin/phantomjs /usr/bin &>> "$LOGFILE" && \
/usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs"
check_cmd_status "Error Installing pandorawmic/wmic"
# create symlink for fping
rm -f /usr/sbin/fping &>> "$LOGFILE"
@ -370,7 +360,6 @@ source '/root/.profile' &>> "$LOGFILE"
#ipam dependencies
ipam_dependencies=" \
xprobe \
libnetaddr-ip-perl \
coreutils \
libdbd-mysql-perl \
@ -619,8 +608,9 @@ sed --follow-symlinks -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.i
sed --follow-symlinks -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
sed --follow-symlinks -i -e "s/^disable_functions/;disable_functions/" /etc/php.ini
#adding 900s to httpd timeout
#echo 'TimeOut 900' > /etc/httpd/conf.d/timeout.conf
#adding 900s to httpd timeout and 300 to ProxyTimeout
echo 'TimeOut 900' > /etc/apache2/conf-enabled/timeout.conf
echo 'ProxyTimeout 300' >> /etc/apache2/conf-enabled/timeout.conf
cat > /var/www/html/index.html << EOF_INDEX
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
@ -792,6 +782,9 @@ systemctl enable pandora_agent_daemon &>> "$LOGFILE"
#fix path phantomjs
sed --follow-symlinks -i -e "s/^openssl_conf = openssl_init/#openssl_conf = openssl_init/g" /etc/ssl/openssl.cnf &>> "$LOGFILE"
# Enable postfix
systemctl enable postfix --now &>> "$LOGFILE"
#SSH banner
[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me)

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.772-230710
Version: 7.0NG.772-230719
Architecture: all
Priority: optional
Section: admin

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.772-230710"
pandora_version="7.0NG.772-230719"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

@ -213,5 +213,5 @@ module_end
module_plugin grep_log /var/adm/syslog Syslog .
#Inventory plugin
#module_plugin /usr/share/pandora_agent/plugins/inventory_solaris.pl

@ -1031,7 +1031,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.772';
use constant AGENT_BUILD => '230710';
use constant AGENT_BUILD => '230719';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.772
%define release 230710
%define release 230719
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.772
%define release 230710
%define release 230719
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.772"
PI_BUILD="230710"
PI_BUILD="230719"
OS_NAME=`uname -s`
FORCE=0

@ -0,0 +1,121 @@
#!/usr/bin/perl -w
#
use strict;
use Data::Dumper;
#print header
print "<inventory>\n";
#get pakahes
my @pkg_list = `/usr/bin/pkginfo -l 2> /dev/null`;
print " <inventory_module>\n";
print " <name><![CDATA[Software]]></name>\n";
print " <datalist>\n";
my $pkg;
foreach my $line (@pkg_list) {
chomp $line;
my $match = ( $line =~ /PKGINST:/ .. $line =~ /^$/ );
if ( $match && $match !~ /E0/ ) {
if ( $line =~ /^\s+([A-Z]+):\s+(.*)$/ ) {
my ($key, $val) = ($1, $2);
if ( $key eq 'FILES' ) {
if ( $val =~ /^(\d+) (.*)$/ ) {
$pkg->{FILES}->{$2} = $1;
}
}
else {
$pkg->{$1} = $2;
}
}
elsif ( $line =~ /^\s+([0-9]+) (.*)$/ ) {
$pkg->{FILES}->{$2} = $1;
}
else {
print "Unrecognized output: [$line]\n";
}
}
else {
#
# Blank line between packages
#
print "<data><![CDATA[";
print $pkg->{PKGINST} . ';';
print $pkg->{VERSION} . ';';
print $pkg->{NAME} . ';';
print "]]></data>\n";
}
}
print " </datalist>\n";
print " </inventory_module>\n";
#close software module
#CPU module
print " <inventory_module>\n";
print " <name><![CDATA[CPU]]></name>\n";
print " <datalist>\n";
my $cpu_model =`kstat cpu_info 2> /dev/null | grep brand | uniq | sed 's/.*brand//g' | tr -d ' '`;
my $cpu_clock = `kstat cpu_info 2> /dev/null | grep clock_MHz | uniq | awk '{print \$NF " Mhz"}'`;
my $cpu_brand = `kstat cpu_info 2> /dev/null | grep vendor_id | uniq | awk '{print \$NF}'`;
chomp $cpu_brand;
chomp $cpu_clock;
chomp $cpu_model;
print "<data><![CDATA[" . $cpu_model . ';' . $cpu_brand . ';' . $cpu_clock . "]]></data>\n";
print " </datalist>\n";
print " </inventory_module>\n";
#close cpu module
#RAM module
print " <inventory_module>\n";
print " <name><![CDATA[RAM]]></name>\n";
print " <datalist>\n";
my $memory_size =`prtconf 2> /dev/null | grep Memory | cut -d ':' -f 2`;
chomp $memory_size;
print "<data><![CDATA[System Memory;" . $memory_size . "]]></data>\n";
print " </datalist>\n";
print " </inventory_module>\n";
#close RAM module
#NIC module
print " <inventory_module>\n";
print " <name><![CDATA[NIC]]></name>\n";
print " <datalist>\n";
my @nic =`dladm show-link 2> /dev/null| grep -v STATE | awk '{print \$1}'`;
foreach my $nic (@nic){
chomp $nic;
my $nic_mac = `dladm show-linkprop $nic -p mac-address 2> /dev/null |grep -v LINK| awk '{print \$4}'`;
my $nic_speed = `dladm show-linkprop $nic -p speed 2> /dev/null |grep -v LINK| awk '{print \$4}'`;
chomp $nic_mac;
chomp $nic_speed;
print "<data><![CDATA[" . $nic . ';' . $nic_mac . ';'. $nic_speed . "]]></data>\n";
}
print " </datalist>\n";
print " </inventory_module>\n";
#close NIC module
#close inventory
print "</inventory>\n";

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230710}
{230719}
ViewReadme
{Yes}

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.772 Build 230710")
#define PANDORA_VERSION ("7.0NG.772 Build 230719")
string pandora_path;
string pandora_dir;

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.772(Build 230710))"
VALUE "ProductVersion", "(7.0NG.772(Build 230719))"
VALUE "FileVersion", "1.0.0.0"
END
END

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.772-230710
Version: 7.0NG.772-230719
Architecture: all
Priority: optional
Section: admin

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.772-230710"
pandora_version="7.0NG.772-230719"
package_pear=0
package_pandora=1

@ -1692,3 +1692,14 @@ enterprise/godmode/modules/manage_inventory_modules_form.php
enterprise/operation/inventory/inventory.php
include/test.js
include/web2image.js
enterprise/meta/monitoring/wizard/wizard.agent.php
enterprise/meta/monitoring/wizard/wizard.create_agent.php
enterprise/meta/monitoring/wizard/wizard.create_module.php
enterprise/meta/monitoring/wizard/wizard.main.php
enterprise/meta/monitoring/wizard/wizard.manage_alert.php
enterprise/meta/monitoring/wizard/wizard.module.local.php
enterprise/meta/monitoring/wizard/wizard.module.network.php
enterprise/meta/monitoring/wizard/wizard.module.web.php
enterprise/meta/monitoring/wizard/wizard.php
enterprise/meta/monitoring/wizard/wizard.update_agent.php
enterprise/meta/monitoring/wizard/wizard.update_module.php

@ -1,5 +1,23 @@
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tnetwork_explorer_filter` (
`id` INT NOT NULL,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tnetwork_usage_filter` (
`id` INT NOT NULL auto_increment,
`filter_name` VARCHAR(45) NULL,
`top` VARCHAR(45) NULL,
`action` VARCHAR(45) NULL,
`advanced_filter` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tlayout`
ADD COLUMN `grid_color` VARCHAR(45) NOT NULL DEFAULT '#cccccc' AFTER `maintenance_mode`,
ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;
@ -10,7 +28,15 @@ ADD COLUMN `grid_size` VARCHAR(45) NOT NULL DEFAULT '10' AFTER `grid_color`;
DELETE FROM tconfig WHERE token = 'refr';
ALTER TABLE `tusuario` ADD COLUMN `session_max_time_expire` INT NOT NULL DEFAULT 0 AFTER `auth_token_secret`;
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (37,2,'CPU','CPU','','Brand;Clock;Model','',0,2);
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (38,2,'RAM','RAM','','Size','',0,2);
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (39,2,'NIC','NIC','','NIC;Mac;Speed','',0,2);
INSERT INTO `tmodule_inventory` (`id_module_inventory`, `id_os`, `name`, `description`, `interpreter`, `data_format`, `code`, `block_mode`,`script_mode`) VALUES (40,2,'Software','Software','','PKGINST;VERSION;NAME','',0,2);
ALTER TABLE `treport_content` ADD COLUMN `period_range` INT NULL DEFAULT 0 AFTER `period`;
CREATE TABLE IF NOT EXISTS `tevent_comment` (
`id` serial PRIMARY KEY,

@ -34,6 +34,22 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$notifications_numbers['notifications'],
$notifications_numbers['last_id']
).'</div>';
$header_welcome = '';
if (check_acl($config['id_user'], $group, 'AW')) {
$header_welcome .= '<div id="welcome-icon-header">';
$header_welcome .= html_print_image(
'images/wizard@svg.svg',
true,
[
'class' => 'main_menu_icon invert_filter',
'title' => __('Welcome dialog'),
'id' => 'Welcome-dialog',
'alt' => __('Welcome dialog'),
'style' => 'cursor: pointer;',
]
);
$header_welcome .= '</div>';
}
// ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
@ -461,7 +477,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
} else {
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
<div class="header_center">'.$header_searchbar.'</div>
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
}
?>
</div> <!-- Closes #table_header_inner -->
@ -904,6 +920,44 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
$("#agent_access").css("display","");
});
$("#welcome-icon-header").click(function () {
if (!$('#welcome_modal_window').length){
$(document.body).append('<div id="welcome_modal_window"></div>');
$(document.body).append( $('<link rel="stylesheet" type="text/css" />').attr('href', 'include/styles/new_installation_welcome_window.css') );
}
// Clean DOM.
load_modal({
target: $('#welcome_modal_window'),
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
},
oncancel: {
page: 'include/ajax/welcome_window',
title: "<?php echo __('Cancel Configuration Window'); ?>",
method: 'cancelWelcome',
confirm: function (fn) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onAccept: function() {
// Continue execution.
fn();
}
})
}
}
});
});
<?php if (enterprise_installed()) { ?>
// Feedback.
$("#feedback-header").click(function () {

@ -100,21 +100,23 @@ if ($initial && users_is_admin()) {
);
}
$welcome = !$initial;
try {
$welcome_window = new WelcomeWindow($welcome);
if ($welcome_window !== null) {
$welcome_window->run();
if (check_acl($config['id_user'], 0, 'AW')) {
$welcome = !$initial;
try {
$welcome_window = new WelcomeWindow($welcome);
if ($welcome_window !== null) {
$welcome_window->run();
}
} catch (Exception $e) {
$welcome = false;
}
} catch (Exception $e) {
$welcome = false;
}
try {
if (isset($_SESSION['showed_tips_window']) === false) {
$tips_window = new TipsWindow();
if ($tips_window !== null) {
$tips_window->run();
$tips_window->run();
}
}
} catch (Exception $e) {

@ -80,7 +80,7 @@ if (isset($_POST['template_id']) === true) {
$values = [
'id_agente' => $id_agente,
'id_tipo_modulo' => $row2['type'],
'descripcion' => __('Created by template ').$name_template.' . '.$row2['description'],
'descripcion' => $row2['description'],
'max' => $row2['max'],
'min' => $row2['min'],
'module_interval' => $row2['module_interval'],

@ -460,6 +460,18 @@ if ($id_agente) {
$templatetab['active'] = ($tab === 'template');
// Policy tab.
$policyTab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=policy&amp;id_agente='.$id_agente,
'image' => 'images/policy@svg.svg',
'title' => __('Manage policy'),
],
true
);
$policyTab['active'] = ($tab === 'policy');
// Inventory.
$inventorytab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=inventory&id_agente='.$id_agente.'">'.html_print_image(
'images/hardware-software-component@svg.svg',
@ -638,6 +650,7 @@ if ($id_agente) {
'template' => $templatetab,
'inventory' => $inventorytab,
'pluginstab' => $pluginstab,
'policy' => (enterprise_installed() === true) ? $policyTab : '',
'collection' => $collectiontab,
'group' => $grouptab,
'gis' => $gistab,
@ -654,11 +667,11 @@ if ($id_agente) {
'template' => $templatetab,
'inventory' => $inventorytab,
'pluginstab' => $pluginstab,
'policy' => (enterprise_installed() === true) ? $policyTab : '',
'collection' => $collectiontab,
'group' => $grouptab,
'gis' => $gistab,
'agent_wizard' => $agent_wizard,
];
}
@ -725,6 +738,11 @@ if ($id_agente) {
$tab_name = __('Inventory');
break;
case 'policy':
$help_header = 'policy_tab';
$tab_name = __('Policies');
break;
case 'plugins':
$help_header = 'plugins_tab';
$tab_name = __('Agent plugins');
@ -2428,6 +2446,10 @@ switch ($tab) {
include 'inventory_manager.php';
break;
case 'policy':
enterprise_include('operation/agentes/policy_manager.php');
break;
default:
if (enterprise_hook('switch_agent_tab', [$tab])) {
// This will make sure that blank pages will have at least some

@ -1072,16 +1072,20 @@ if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
function () {
$(".actions", this).css ("visibility", "hidden");
});
$("#ag_group").click (
function () {
$(this).css ("width", "auto");
$(this).css ("min-width", "100px");
});
$("#ag_group").blur (function () {
$(this).css ("width", "100px");
});
var show_deploy_agent = "<?php echo get_parameter('show_deploy_agent', 0); ?>";
if (show_deploy_agent !== '0'){
$('#button-modal_deploy_agent').click();
}
});
</script>

@ -40,6 +40,8 @@ $table->size = [];
$table->style[0] = 'width: 50%';
$table->style[1] = 'width: 50%';
$modules = [];
if (is_metaconsole() === true) {
$params = [];
$params['return'] = true;
@ -79,8 +81,6 @@ if (is_metaconsole() === true) {
}
}
$modules = [];
$table->data[0][1] = html_print_label_input_block(
__('Module'),
html_print_select(

@ -318,74 +318,59 @@ if (count($actions) == 1 && isset($actions[0])) {
} else {
foreach ($actions as $kaction => $action) {
$table->data[$kaction][0] = $action['name'];
if ((int) $kaction === 0) {
$table->data[$kaction][0] .= ui_print_help_tip(
__('The default actions will be executed every time that the alert is fired and no other action is executed'),
true
);
}
foreach ($action['escalation'] as $k => $v) {
if ($v > 0) {
$table->data[$kaction][$k] .= html_print_image(
'images/tick.png',
true,
['class' => 'invert_filter']
);
if (count($action['escalation']) > 1) {
foreach ($action['escalation'] as $k => $v) {
$table->head[$k] = '#'.$k;
if ($v > 0) {
$table->data[$kaction][$k] .= html_print_image(
'images/tick.png',
true,
['class' => 'invert_filter']
);
} else {
$table->data[$kaction][$k] = html_print_image(
'images/blade.png',
true
);
}
}
} else {
$table->head[1] = __('Every time that the alert is fired');
if (count($action['escalation']) > 0) {
if ($action['escalation'][0] > 0) {
$table->data[$kaction][1] .= html_print_image(
'images/tick.png',
true,
['class' => 'invert_filter']
);
} else {
$table->data[$kaction][1] = html_print_image(
'images/blade.png',
true
);
}
} else {
$table->data[$kaction][$k] = html_print_image(
$table->data[$kaction][1] = html_print_image(
'images/blade.png',
true
);
}
if (count($table->head) <= count($action['escalation'])) {
if ($k == count($action['escalation'])) {
if ($k == 1) {
$table->head[$kaction] = __('Every time that the alert is fired');
} else {
$table->head[$kaction] = '>#'.($kaction - 1);
}
} else {
$table->head[$kaction] = '#'.($kaction);
if ($v > 0) {
$table->data[$kaction][($kaction + 1)] = html_print_image(
'images/tick.png',
true,
['class' => 'invert_filter']
);
} else {
$table->data[$kkaction][($kaction + 1)] = html_print_image(
'images/blade.png',
true
);
}
}
}
}
$table->head[($kaction + 1)] = '#'.($kaction);
if (count($action['escalation']) === 0) {
$table->data[$kaction][($kaction + 2)] = html_print_image(
'images/blade.png',
true
);
}
$action_threshold = ($action['module_action_threshold'] > 0) ? $action['module_action_threshold'] : $action['action_threshold'];
if ($action_threshold == 0) {
$table->data[$kaction][($k + 1)] = __('No');
$table->data[$kaction][] = __('No');
} else {
$table->data[$kaction][($k + 1)] = human_time_description_raw(
$table->data[$kaction][] = human_time_description_raw(
$action_threshold,
true,
'tiny'
);
}
$table->head[($kaction + 1)] = __('Threshold');
}
$table->head[] = __('Threshold');
}
html_print_table($table);

@ -322,10 +322,18 @@ function update_template($step)
if ($step == 1) {
$name = (string) get_parameter('name');
$name = trim(io_safe_output($name));
if (strlen($name) === 0) {
ui_print_warning_message(__('You can\'t named a template with spaces'));
return false;
}
$name = io_safe_input($name);
$description = (string) get_parameter('description');
$wizard_level = (string) get_parameter('wizard_level');
$priority = (int) get_parameter('priority');
$id_group = get_parameter('id_group');
$name_check = db_get_value('name', 'talert_templates', 'name', $name);
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole() === true) {
$previous_name = db_get_value('name', 'talert_templates', 'id', $id);
@ -342,7 +350,12 @@ function update_template($step)
'previous_name' => $previous_name,
];
$result = alerts_update_alert_template($id, $values);
if ($name_check === false) {
$result = alerts_update_alert_template($id, $values);
} else {
ui_print_warning_message(__('Another template with the same name already exists'));
$result = false;
}
} else if ($step == 2) {
$schedule = io_safe_output(get_parameter('schedule', []));
json_decode($schedule, true);
@ -487,6 +500,13 @@ $wizard_level = 'nowizard';
if ($create_template) {
$name = (string) get_parameter('name');
$name = trim(io_safe_output($name));
if (strlen($name) === 0) {
ui_print_warning_message(__('You can\'t named a template with spaces'));
}
$name = io_safe_input($name);
$description = (string) get_parameter('description');
$type = (string) get_parameter('type', 'critical');
$value = (string) get_parameter('value');
@ -515,10 +535,11 @@ if ($create_template) {
$values['field3_recovery'] = ' ';
}
if (!$name_check) {
if ($name_check === false) {
$result = alerts_create_alert_template($name, $type, $values);
} else {
$result = '';
ui_print_warning_message(__('Another template with the same name already exists'));
$result = false;
}
if ($result) {

@ -86,31 +86,39 @@ if ($do_operation) {
$groups = users_get_groups();
$table = new stdClass();
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold';
$table->style[4] = 'font-weight: bold';
$table->style[6] = 'font-weight: bold';
// Source selection
$table->id = 'source_table';
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(
false,
'AW',
true,
'source_id_group',
$source_id_group,
false,
'',
'',
true
$table->class = 'databox filters filter-table-adv';
$table->width = '100%';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = [];
// Source selection.
$table->data[0][0] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'AW',
true,
'source_id_group',
$source_id_group,
false,
'',
'',
true,
false,
false,
'w100p',
false,
'width:100%'
)
);
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox('source_recursion', 1, $source_recursion, true, false);
$table->data[0][1] = html_print_label_input_block(
__('Group recursion'),
html_print_checkbox('source_recursion', 1, $source_recursion, true, false)
);
$status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning');
@ -118,37 +126,52 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[0][4] = __('Status');
$table->data[0][5] = html_print_select(
$status_list,
'status_agents_source',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true
$table->data[1][0] = html_print_label_input_block(
__('Status'),
html_print_select(
$status_list,
'status_agents_source',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true,
false,
true,
'w100p'
)
);
$table->data[0][6] = __('Agent');
$table->data[0][6] .= ' <span id="source_agent_loading" class="invisible">';
$table->data[0][6] .= html_print_image('images/spinner.png', true);
$table->data[0][6] .= '</span>';
// $table->data[0][7] = html_print_select (agents_get_group_agents ($source_id_group, false, "none"),
// 'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
$agents = ( $source_id_group ? agents_get_group_agents($source_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) );
$table->data[0][7] = html_print_select($agents, 'source_id_agent', $source_id_agent, false, __('Select'), 0, true);
echo '<form '.'action="index.php?'.'sec=gmassive&'.'sec2=godmode/massive/massive_operations&'.'option=copy_modules" '.'id="manage_config_form" '.'method="post">';
$table->data[1][1] = html_print_label_input_block(
__('Agent').' <span id="source_agent_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
html_print_select(
$agents,
'source_id_agent',
$source_id_agent,
false,
__('Select'),
0,
true
)
);
echo '<form action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=copy_modules" id="manage_config_form" method="post" class="max_floating_element_size">';
echo '<fieldset id="fieldset_source">';
echo '<legend>';
echo '<span>'.__('Source');
echo '</legend>';
echo '<legend><span>'.__('Source').'</span></legend>';
html_print_table($table);
echo '</fieldset>';
// Target selection
unset($table);
// Target selection.
$table = new stdClass();
$table->id = 'target_table';
$table->class = 'databox filters';
$table->class = 'databox filters filter-table-adv';
$table->width = '100%';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = [];
$modules = [];
@ -169,66 +192,64 @@ foreach ($agent_alerts as $alert) {
}
$tags = tags_get_user_tags();
$table->data['tags'][0] = __('Tags');
$table->data['tags'][1] = html_print_select(
$tags,
'tags[]',
$tags_name,
false,
__('Any'),
-1,
true,
true,
true
$table->colspan[0][0] = 2;
$table->data[0][0] = html_print_label_input_block(
__('Tags'),
html_print_select(
$tags,
'tags[]',
$tags_name,
false,
__('Any'),
-1,
true,
true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
);
$table->data['operations'][0] = __('Operations');
$table->data['operations'][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
$table->data['operations'][1] .= html_print_checkbox('copy_modules', 1, true, true);
$table->data['operations'][1] .= html_print_label(__('Copy modules'), 'checkbox-copy_modules', true);
$table->data['operations'][1] .= '</span><br />';
$table->data['operations'][1] .= '<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">';
$table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, true);
$table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
$table->data['operations'][1] .= '</span>';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->data[1][0] = __('Modules');
$table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= html_print_select(
$modules,
'target_modules[]',
0,
false,
'',
'',
true,
true
$table->data[1][0] = html_print_label_input_block(
__('Operations'),
'<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'.html_print_checkbox('copy_modules', 1, true, true).html_print_label(__('Copy modules'), 'checkbox-copy_modules', true).'</span><span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">'.html_print_checkbox('copy_alerts', 1, true, true).html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true).'</span>'
);
$table->data[1][1] .= '</span>';
$table->data[1][1] .= '<span class="without_modules'.(! empty($modules) ? ' invisible' : '').'">';
$table->data[1][1] .= '<em>'.__('No modules for this agent').'</em>';
$table->data[1][1] .= '</span>';
$table->data[2][0] = __('Alerts');
$table->data[2][1] = '<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">';
$table->data[2][1] .= html_print_select(
$alerts,
'target_alerts[]',
0,
false,
'',
'',
true,
true
$table->data[1][1] = html_print_label_input_block(
__('Filter Modules'),
html_print_input_text('filter_modules', '', '', 20, 255, true)
);
$table->colspan[2][0] = 2;
$table->data[2][0] = html_print_label_input_block(
__('Modules'),
'<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">'.html_print_select(
$modules,
'target_modules[]',
0,
false,
'',
'',
true,
true
).'</span><span class="without_modules'.(! empty($modules) ? ' invisible' : '').'"><em>'.__('No modules for this agent').'</em></span>'
);
$table->colspan[3][0] = 2;
$table->data[3][0] = html_print_label_input_block(
__('Alerts'),
'<span class="with_alerts'.(empty($alerts) ? ' invisible' : '').'">'.html_print_select(
$alerts,
'target_alerts[]',
0,
false,
'',
'',
true,
true
).'</span><span class="without_alerts'.(! empty($modules) ? ' invisible' : '').'"><em>'.__('No alerts for this agent').'</em></span>'
);
$table->data[2][1] .= '</span>';
$table->data[2][1] .= '<span class="without_alerts'.(! empty($modules) ? ' invisible' : '').'">';
$table->data[2][1] .= '<em>'.__('No alerts for this agent').'</em>';
$table->data[2][1] .= '</span>';
echo '<div id="modules_loading" class="loading invisible">';
html_print_image('images/spinner.png');
@ -240,35 +261,50 @@ echo '<legend><span>'.__('Targets').'</span></legend>';
html_print_table($table);
echo '</fieldset>';
// Destiny selection
unset($table);
// Destiny selection.
$table = new stdClass();
$table->id = 'destiny_table';
$table->class = 'databox filters';
$table->class = 'databox filters filter-table-adv';
$table->width = '100%';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = [];
$table->size[0] = '20%';
$table->size[1] = '30%';
$table->size[2] = '20%';
$table->size[3] = '30%';
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(
false,
'AW',
true,
'destiny_id_group',
$destiny_id_group,
false,
'',
'',
true
$table->data[0][0] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'AW',
true,
'destiny_id_group',
$destiny_id_group,
false,
'',
'',
true,
false,
false,
'w100p',
false,
'width:100%'
)
);
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox(
'destiny_recursion',
1,
$destiny_recursion,
true,
false
$table->data[0][1] = html_print_label_input_block(
__('Group recursion'),
html_print_checkbox(
'destiny_recursion',
1,
$destiny_recursion,
true,
false
)
);
$table->data[1][0] = html_print_label_input_block(
__('Filter Agents'),
html_print_input_text('filter_agents', '', '', 20, 255, true)
);
$status_list = [];
@ -278,32 +314,30 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[1][0] = __('Status');
$table->data[1][1] = html_print_select(
$status_list,
'status_agents_destiny',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true
$table->data[1][1] = html_print_label_input_block(
__('Status'),
html_print_select(
$status_list,
'status_agents_destiny',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true
)
);
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->data[2][0] = __('Agent');
$table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$agents = [];
if ($source_id_agent) {
$agents = ( $destiny_id_group ? agents_get_group_agents($destiny_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) );
unset($agents[$source_id_agent]);
}
$table->data[2][1] = html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true);
$table->colspan[2][0] = 2;
$table->data[2][0] = html_print_label_input_block(
__('Agent').'<span id="destiny_agent_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true)
);
echo '<fieldset id="fieldset_destiny"'.($source_id_agent ? '' : ' class="invisible"').'>';
echo '<legend><span>'.__('To agent(s)').'</span></legend>';

@ -310,45 +310,47 @@ foreach ($module_types as $type) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox filters filter-table-adv';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data = [];
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->data['selection_mode'][0] = __('Selection mode');
$table->data['selection_mode'][1] = '<span class="massive_span">'.__('Select modules first ').'</span>'.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'<br>';
$table->data['selection_mode'][1] .= '<span class="massive_span">'.__('Select agents first ').'</span>'.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true);
$table->rowclass['form_modules_1'] = 'select_modules_row';
$table->data['form_modules_1'][0] = __('Module type');
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
$table->data['form_modules_1'][0] .= '</span>';
$types[0] = __('All');
$table->colspan['form_modules_1'][1] = 2;
$table->data['form_modules_1'][1] = html_print_select(
$types,
'module_type',
'',
false,
__('Select'),
-1,
true,
false,
true,
'',
false,
'width:100%'
$table->data[0][0] = html_print_label_input_block(
__('Selection mode'),
'<div class="flex"><span class="massive_span">'.__('Select modules first ').'</span>'.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'<br><span class="massive_span">'.__('Select agents first ').'</span>'.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'class="mrgn_right_40px"', true).'</div>'
);
$table->data['form_modules_1'][3] = __('Select all modules of this type').' '.html_print_checkbox_extended(
'force_type',
'type',
'',
'',
false,
'class="mrgn_right_40px"',
true,
''
$table->rowclass[1] = 'select_modules_row';
$types[0] = __('All');
$table->data[1][0] = html_print_label_input_block(
__('Module type').'<span id="module_loading" class="invisible">'.html_print_image('images/spinner.png', true).'</span>',
html_print_select(
$types,
'module_type',
'',
false,
__('Select'),
-1,
true,
false,
true,
'',
false,
'width:100%'
)
);
$table->data[1][1] = html_print_label_input_block(
__('Select all modules of this type'),
html_print_checkbox_extended(
'force_type',
'type',
'',
'',
false,
'class="mrgn_right_40px"',
true,
''
)
);
$modules = [];
@ -368,52 +370,59 @@ foreach ($names as $name) {
$modules[$name['nombre']] = $name['nombre'];
}
$table->rowclass['form_agents_1'] = 'select_agents_row';
$table->data['form_agents_1'][0] = __('Agent group');
$table->rowclass[2] = 'select_agents_row';
$groups = users_get_groups($config['id_user'], 'AW', false);
$groups[0] = __('All');
$table->colspan['form_agents_1'][1] = 2;
$table->data['form_agents_1'][1] = html_print_select_groups(
false,
'AW',
true,
'groups_select',
'',
false,
'',
'',
true
).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false);
$table->data['form_agents_1'][3] = __('Select all modules of this group').' '.html_print_checkbox_extended(
'force_group',
'group',
'',
'',
false,
'',
'class="mrgn_right_40px"',
true
$table->data[2][0] = html_print_label_input_block(
__('Agent group'),
html_print_select_groups(
false,
'AW',
true,
'groups_select',
'',
false,
'',
'',
true
).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false)
);
$table->data[2][1] = html_print_label_input_block(
__('Select all modules of this group'),
html_print_checkbox_extended(
'force_group',
'group',
'',
'',
false,
'',
'class="mrgn_right_40px"',
true
)
);
$tags = tags_get_user_tags();
$table->rowstyle['form_modules_4'] = 'vertical-align: top;';
$table->rowclass['form_modules_4'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_4'][0] = __('Tags');
$table->data['form_modules_4'][1] = html_print_select(
$tags,
'tags[]',
$tags_name,
false,
__('Any'),
-1,
true,
true,
true
$table->rowclass[3] = 'select_modules_row select_modules_row_2';
$table->colspan[3][0] = 2;
$table->data[3][0] = html_print_label_input_block(
__('Tags'),
html_print_select(
$tags,
'tags[]',
$tags_name,
false,
__('Any'),
-1,
true,
true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
);
$table->rowclass['form_agents_2'] = 'select_agents_row';
$table->data['form_agents_2'][0] = __('Status');
$table->colspan['form_agents_2'][1] = 2;
$status_list = [];
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning');
@ -421,166 +430,194 @@ $status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data['form_agents_2'][1] = html_print_select(
$status_list,
'status_agents',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true
$table->data[4][0] = html_print_label_input_block(
__('Module Status'),
html_print_select(
$status_list,
'status_module',
'selected',
'',
__('All'),
AGENT_MODULE_STATUS_ALL,
true,
false,
true,
'w100p',
false,
'width: 100%'
)
);
$table->data['form_agents_2'][3] = '';
$table->rowclass['form_modules_3'] = '';
$table->data['form_modules_3'][0] = __('Module Status');
$table->colspan['form_modules_3'][1] = 2;
$status_list = [];
$status_list[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_MODULE_STATUS_WARNING] = __('Warning');
$status_list[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
$status_list[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
$table->data['form_modules_3'][1] = html_print_select(
$status_list,
'status_module',
'selected',
'',
__('All'),
AGENT_MODULE_STATUS_ALL,
true
$table->cellclass[4][1] = 'select_agents_row';
$table->data[4][1] = html_print_label_input_block(
__('Status'),
html_print_select(
$status_list,
'status_agents',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true,
false,
true,
'w100p',
false,
'width: 100%'
)
);
$table->data['form_modules_3'][3] = '';
$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_filter'][0] = __('Filter Modules');
$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
$table->rowstyle['form_modules_2'] = 'vertical-align: top;';
$table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
$table->data['form_modules_2'][0] = __('Modules');
$table->data['form_modules_2'][1] = html_print_select(
$modules,
'module_name[]',
$module_name,
false,
__('Select'),
-1,
true,
true,
true,
'',
false,
'width:100%'
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'");
$table->data['form_modules_2'][2] = __('When select modules');
$table->data['form_modules_2'][2] .= '<br>';
$table->data['form_modules_2'][2] .= html_print_select(
[
'common' => __('Show common agents'),
'all' => __('Show all agents'),
],
'agents_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'',
false
$table->rowclass[5] = 'select_modules_row select_modules_row_2';
$table->data[5][0] = html_print_label_input_block(
__('Filter Modules'),
html_print_input_text('filter_modules', '', '', 20, 255, true)
);
$table->data['form_modules_2'][3] = html_print_select(
[],
'agents[]',
$agents_select,
false,
__('None'),
0,
true,
true,
false,
'',
false,
'width:100%'
$table->data[5][1] = html_print_label_input_block(
__('When select modules'),
html_print_select(
[
'common' => __('Show common agents'),
'all' => __('Show all agents'),
],
'agents_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'w100p',
false,
'width:100%'
)
);
$table->rowclass[6] = 'select_modules_row select_modules_row_2';
$table->data[6][0] = html_print_label_input_block(
__('Modules'),
html_print_select(
$modules,
'module_name[]',
$module_name,
false,
__('Select'),
-1,
true,
true,
true,
'',
false,
'width:100%'
).' '.__('Select all modules').' '.html_print_checkbox('select_all_modules', 1, false, true, false, '', false, "class='static'")
);
$table->data[6][1] = html_print_label_input_block(
__('Agents'),
html_print_select(
[],
'agents[]',
$agents_select,
false,
__('None'),
0,
true,
true,
false,
'',
false,
'width:100%'
)
);
$tags = tags_get_user_tags();
$table->rowstyle['form_agents_4'] = 'vertical-align: top;';
$table->rowclass['form_agents_4'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_4'][0] = __('Tags');
$table->data['form_agents_4'][1] = html_print_select(
$tags,
'tags[]',
$tags_name,
false,
__('Any'),
-1,
true,
true,
true
$table->rowclass[7] = 'select_agents_row select_agents_row_2';
$table->colspan[7][0] = 2;
$table->data[7][0] = html_print_label_input_block(
__('Tags'),
html_print_select(
$tags,
'tags[]',
$tags_name,
false,
__('Any'),
-1,
true,
true,
true,
'',
false,
'overflow-x: hidden;white-space: nowrap;max-width: 1136px;'
)
);
$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_filter'][0] = __('Filter Agents');
$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
$table->rowstyle['form_agents_3'] = 'vertical-align: top;';
$table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
$table->data['form_agents_3'][0] = __('Agents');
$table->data['form_agents_3'][1] = html_print_select(
$agents,
'id_agents[]',
$agents_id,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%'
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'");
$table->data['form_agents_3'][2] = __('When select agents');
$table->data['form_agents_3'][2] .= '<br>';
$table->data['form_agents_3'][2] .= html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
'unknown' => __('Show unknown and not init modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true
);
$table->data['form_agents_3'][3] = html_print_select(
[],
'module[]',
$modules_select,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%'
$table->rowclass[8] = 'select_agents_row select_agents_row_2';
$table->data[8][0] = html_print_label_input_block(
__('Filter Agents'),
html_print_input_text('filter_agents', '', '', 20, 255, true)
);
$table->data[8][1] = html_print_label_input_block(
__('When select agents'),
html_print_select(
[
'common' => __('Show common modules'),
'all' => __('Show all modules'),
'unknown' => __('Show unknown and not init modules'),
],
'modules_selection_mode',
'common',
false,
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
)
);
$table->rowclass[9] = 'select_agents_row select_agents_row_2';
$table->data[9][0] = html_print_label_input_block(
__('Agents'),
html_print_select(
$agents,
'id_agents[]',
$agents_id,
false,
'',
'',
true,
true,
false,
'',
false,
'width:100%;white-space: nowrap;max-width: 1136px;'
).' '.__('Select all agents').' '.html_print_checkbox('select_all_agents', 1, false, true, false, '', false, "class='static'")
);
echo '<form method="post" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >';
$table->data[9][1] = html_print_label_input_block(
__('Modules'),
html_print_select(
[],
'module[]',
$modules_select,
false,
'',
'',
true,
true,
false,
'w100p',
false,
'width:100%'
)
);
echo '<form method="post" class="max_floating_element_size" id="form_modules" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_modules" >';
html_print_table($table);
attachActionButton('delete', 'delete', $table->width, false, $SelectAction);
@ -617,7 +654,9 @@ $(document).ready (function () {
$("#module_name").trigger('change');
} else {
$("#module_name option").prop('selected', false);
$("#module_name").trigger('change');
if ($('#agents_selection_mode :selected').val() === 'all'){
$("#module_name").trigger('change');
}
}
});
@ -760,14 +799,6 @@ $(document).ready (function () {
else if (this.id == "checkbox-recursion") {
$("#groups_select").trigger("change");
}
else {
if (this.checked) {
$(".select_agents_row_2").css('display', 'none');
}
else {
$(".select_agents_row_2").css('display', '');
}
}
}
);

File diff suppressed because it is too large Load Diff

@ -174,6 +174,13 @@ if ($access_console_node === true) {
}
$sub = [];
if ((bool) check_acl($config['id_user'], 0, 'AW') === true) {
$sub['wizard']['text'] = __('Configuration wizard');
$sub['wizard']['id'] = 'conf_wizard';
$sub['wizard']['type'] = 'direct';
$sub['wizard']['subtype'] = 'nolink_no_arrow';
}
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$sub['templates']['text'] = __('Templates');
$sub['templates']['id'] = 'Templates';
@ -620,3 +627,55 @@ if ((bool) $config['pure'] === false) {
}
echo '<div id="about-div"></div>';
// Need to be here because the translate string.
if (check_acl($config['id_user'], $group, 'AW')) {
?>
<script type="text/javascript">
$("#conf_wizard").click(function() {
$("#conf_wizard").addClass("selected");
if (!$("#welcome_modal_window").length) {
$(document.body).append('<div id="welcome_modal_window"></div>');
$(document.body).append(
$('<link rel="stylesheet" type="text/css" />').attr(
"href",
"include/styles/new_installation_welcome_window.css"
)
);
}
load_modal({
target: $('#welcome_modal_window'),
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
modal: {
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
},
onshow: {
page: 'include/ajax/welcome_window',
method: 'loadWelcomeWindow',
},
oncancel: {
page: 'include/ajax/welcome_window',
title: "<?php echo __('Cancel Configuration Window'); ?>",
method: 'cancelWelcome',
confirm: function (fn) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onAccept: function() {
// Continue execution.
fn();
}
})
}
}
});
});
</script>
<?php
}

@ -38,6 +38,9 @@ require_once $config['homedir'].'/include/db/oracle.php';
// Login check.
check_login();
// Validate enterprise.
$is_enterprise = enterprise_installed();
if (! check_acl($config['id_user'], 0, 'RW')
&& ! check_acl($config['id_user'], 0, 'RM')
) {
@ -321,6 +324,21 @@ switch ($action) {
$full_text = empty($es['full_text']) ? 0 : $es['full_text'];
break;
case 'event_report_log_table':
$period = $item['period'];
$period_range = $item['period_range'];
$description = $item['description'];
$es = json_decode($item['external_source'], true);
$id_agents = $es['id_agents'];
$source = $es['source'];
$search = $es['search'];
$log_number = empty($es['log_number']) ? $log_number : $es['log_number'];
$full_text = empty($es['full_text']) ? 0 : $es['full_text'];
$show_graph = $item['show_graph'];
$group_by_agent = $item['group_by_agent'];
break;
case 'simple_graph':
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0;
@ -1025,6 +1043,7 @@ switch ($action) {
case 'prediction_date':
case 'simple_baseline_graph':
case 'event_report_log':
case 'event_report_log_table':
case 'increment':
$label = (isset($style['label'])) ? $style['label'] : '';
break;
@ -1411,6 +1430,29 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_period_range" class="datos">
<td class="bolder">
<?php
echo __('Period range');
ui_print_help_tip(
__('This is the time range in which the files are grouped. For example, 1 day will group the files by day and will count them.')
);
?>
</td>
<td >
<?php
html_print_extended_select_for_time(
'period_range',
$period_range,
'',
'',
'0',
10
);
?>
</td>
</tr>
<tr id="row_last_value" class="datos">
<td class="bolder" class="datos">
<?php
@ -3643,25 +3685,28 @@ $class = 'databox filters';
?>
</td>
</tr>
<tr id="row_landscape" class="datos">
<td class="bolder">
<?php
echo __('Show item in landscape format (only PDF)');
<?php
if ($is_enterprise) {
?>
</td>
<td><?php html_print_checkbox_switch('landscape', 1, $landscape); ?></td>
</tr>
<tr id="row_pagebreak" class="datos">
<td class="bolder">
<tr id="row_landscape" class="datos">
<td class="bolder">
<?php
echo __('Show item in landscape format (only PDF)');
?>
</td>
<td><?php html_print_checkbox_switch('landscape', 1, $landscape); ?></td>
</tr>
<tr id="row_pagebreak" class="datos">
<td class="bolder">
<?php
echo __('Page break at the end of the item (only PDF)');
?>
</td>
<td><?php html_print_checkbox_switch('pagebreak', 1, $pagebreak); ?></td>
</tr>
<?php
echo __('Page break at the end of the item (only PDF)');
?>
</td>
<td><?php html_print_checkbox_switch('pagebreak', 1, $pagebreak); ?></td>
</tr>
}
?>
<tr id="row_agents_inventory_display_options" class="datos">
<td class="bolder">
<?php
@ -5295,6 +5340,12 @@ $(document).ready (function () {
return false;
}
break;
case 'event_report_log_table':
if ($("#id_agents3").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'permissions_report':
if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) {
dialog_message('#message_no_group');
@ -6385,6 +6436,7 @@ function chooseType() {
$("#row_description").hide();
$("#row_label").hide();
$("#row_period").hide();
$("#row_period_range").hide();
$("#row_agent").hide();
$("#row_module").hide();
$("#row_period").hide();
@ -6559,7 +6611,24 @@ function chooseType() {
loadLogAgents();
break;
break;
case 'event_report_log_table':
$("#log_help_tip").css("visibility", "visible");
$("#row_description").show();
$("#row_period").show();
$("#row_period_range").show();
$("#row_search").show();
$("#row_log_number").show();
$("#agents_row").show();
$("#row_source").show();
$("#row_historical_db_check").hide();
$("#row_show_graph").show();
$("#row_group_by_agent").show();
loadLogAgents();
break;
case 'increment':
$("#row_description").show();
@ -7522,9 +7591,68 @@ function dialog_message(message_id) {
}
});
}
function control_period_range() {
let value_period_range = $('#row_period_range #hidden-period_range').val();
let current_value = $('#row_period #hidden-period').val();
let min_range = (current_value/12);
if(min_range > value_period_range) {
$('#row_period_range div:nth-child(2) select option').removeAttr("selected");
$('#row_period_range div:nth-child(1)').hide();
$('#row_period_range div:nth-child(2)').show();
setTimeout(() => {
if(min_range >= 2592000) {
$('#row_period_range input').val(Math.round((min_range/2592000) * 100) / 100);
$('#row_period_range div:nth-child(2) select option[value="2592000"]').attr("selected", "selected");
$('#row_period_range div:nth-child(2) select').val(2592000);
$('#row_period_range #hidden-period_range').val(min_range);
return;
}
if(min_range >= 604800) {
$('#row_period_range input').val(Math.round((min_range/604800) * 100) / 100);
$('#row_period_range div:nth-child(2) select option[value="604800"]').attr("selected", "selected");
$('#row_period_range div:nth-child(2) select').val(604800);
$('#row_period_range #hidden-period_range').val(min_range);
return;
}
if(min_range >= 86400) {
$('#row_period_range input').val(Math.round((min_range/86400) * 100) / 100);
$('#row_period_range div:nth-child(2) select option[value="86400"]').attr("selected", "selected");
$('#row_period_range div:nth-child(2) select').val(86400);
$('#row_period_range #hidden-period_range').val(min_range);
return;
}
if(min_range >= 3600) {
$('#row_period_range input').val(Math.round((min_range/3600) * 100) / 100);
$('#row_period_range div:nth-child(2) select option[value="3600"]').attr("selected", "selected");
$('#row_period_range div:nth-child(2) select').val(3600);
$('#row_period_range #hidden-period_range').val(min_range);
return;
}
if(min_range >= 60) {
$('#row_period_range input').val(Math.round((min_range/60) * 100) / 100);
$('#row_period_range div:nth-child(2) select option[value="60"]').attr("selected", "selected");
$('#row_period_range div:nth-child(2) select option[value="60"]').val(60);
$('#row_period_range #hidden-period_range').val(min_range);
return;
}
}, 800);
}
}
$(document).ready(function () {
$('[id^=period], #combo_graph_options, #combo_sla_sort_options').next().css('z-index', 0);
$('#row_period input').change(function(e){
control_period_range();
});
$('#row_period select').change(function(e){
control_period_range();
});
$('#row_period_range input').change(function(e){
control_period_range();
});
$('#row_period_range select').change(function(e){
control_period_range();
});
});
</script>

@ -508,11 +508,11 @@ switch ($action) {
$buttons = [
'list_reports' => [
'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">'.html_print_image(
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'&action=list">'.html_print_image(
'images/logs@svg.svg',
true,
[
'title' => __('Reports list'),
'title' => __('Reports'),
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
@ -545,7 +545,7 @@ switch ($action) {
// Header.
ui_print_standard_header(
__('List of reports'),
__('Reports'),
'images/op_reporting.png',
false,
'',
@ -1621,6 +1621,27 @@ switch ($action) {
$good_format = true;
break;
case 'event_report_log_table':
$agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', '');
$search = get_parameter('search', '');
$full_text = (integer) get_parameter('full_text', 0);
$log_number = get_parameter('log_number', '');
$es['source'] = $source;
$es['id_agents'] = $agents_to_report;
$es['search'] = $search;
$es['full_text'] = $full_text;
$es['log_number'] = $log_number;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$values['period_range'] = get_parameter('period_range');
$values['show_graph'] = get_parameter('combo_graph_options');
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
$good_format = true;
break;
case 'prediction_date':
$values['period'] = get_parameter('period1');
$values['top_n'] = get_parameter(
@ -2605,6 +2626,27 @@ switch ($action) {
$good_format = true;
break;
case 'event_report_log_table':
$agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', '');
$search = get_parameter('search', '');
$full_text = (integer) get_parameter('full_text', 0);
$log_number = get_parameter('log_number', '');
$es['source'] = $source;
$es['id_agents'] = $agents_to_report;
$es['search'] = $search;
$es['full_text'] = $full_text;
$es['log_number'] = $log_number;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$values['period_range'] = get_parameter('period_range');
$values['show_graph'] = get_parameter('combo_graph_options');
$values['group_by_agent'] = get_parameter('checkbox_row_group_by_agent');
$good_format = true;
break;
case 'agent_module':
case 'agent_module_status':
$agents_to_report_text = get_parameter('id_agents2-multiple-text');
@ -3636,7 +3678,7 @@ switch ($action) {
$buttons = [
'list_reports' => [
'active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">'.html_print_image('images/logs@svg.svg', true, ['title' => __('Reports list'), 'class' => 'invert_filter main_menu_icon']).'</a>',
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'&action=list">'.html_print_image('images/logs@svg.svg', true, ['title' => __('Reports'), 'class' => 'invert_filter main_menu_icon']).'</a>',
],
];
@ -3703,7 +3745,7 @@ $buttons = [
'images/report_list.png',
true,
[
'title' => __('Reports list'),
'title' => __('Reports'),
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
@ -3751,12 +3793,13 @@ if ($idReport != 0) {
$buttons = [
'main' => [
'active' => true,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">'.html_print_image('images/report_list.png', true, ['title' => __('Reports list'), 'class' => 'main_menu_icon invert_filter']).'</a>',
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'&action=list">'.html_print_image('images/report_list.png', true, ['title' => __('Reports'), 'class' => 'main_menu_icon invert_filter']).'</a>',
],
];
$textReportName = __('Create Custom Report');
}
// here1
$tab_builder = ($activeTab === 'item_editor') ? 'reporting_item_editor_tab' : '';
if (is_metaconsole() === true || $action !== 'update') {

@ -212,7 +212,7 @@ if (isset($_GET['server']) === true) {
false,
'servers',
true,
[],
$buttons,
[
[
'link' => '',

@ -537,17 +537,16 @@ if (empty($create) === false || empty($view) === false) {
$data = [];
$data[0] = html_print_label_input_block(
__('Plug-in parameters'),
html_print_input_text(
html_print_textarea(
'form_parameters',
4,
50,
$parameters,
'',
100,
255,
true,
'command_component command_advanced_conf text_input',
false,
false,
'',
'command_component command_advanced_conf text_input'
false
)
);
@ -1167,7 +1166,7 @@ ui_require_javascript_file('pandora_modules');
function update_preview() {
var command = $('#text-form_execute').val();
var parameters = $('#text-form_parameters').val();
var parameters = $('#textarea_form_parameters').val();
var i = 1;
while (1) {

@ -255,17 +255,7 @@ foreach ($servers as $server) {
if (($names_servers[$safe_server_name] === true) && ($server['type'] === 'data' || $server['type'] === 'enterprise satellite')) {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
$data[8] .= html_print_image(
'images/agents@svg.svg',
true,
[
'title' => __('Manage server conf'),
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'&tab=standard_editor">';
$data[8] .= html_print_image(
'images/remote-configuration@svg.svg',
true,

@ -210,7 +210,7 @@ if (is_ajax() === true) {
// Ldapsearch timeout.
// Default Ldapsearch timeout.
set_when_empty($config['ldap_searh_timeout'], 5);
set_when_empty($config['ldap_search_timeout'], 5);
$row = [];
$row['name'] = __('Ldap search timeout (secs)');
$row['control'] = html_print_input_text(
@ -558,7 +558,13 @@ echo '</form>';
if ($('input[type=checkbox][name=secondary_ldap_enabled]:checked').val() == 1) {
$("tr[id*='ldap_'][id$='_secondary']").show();
} else {
$( "tr[id*='ldap_'][id$='_secondary']" ).hide();
$( "tr[id*='ldap_'][id$='_secondary']" ).hide();
}
if ($('input[type=checkbox][name=secondary_active_directory]:checked').val() == 1) {
$("tr[id*='ad_'][id$='_secondary']").show();
} else {
$( "tr[id*='ad_'][id$='_secondary']" ).hide();
}
}
$( document ).ready(function() {

@ -681,15 +681,19 @@ $table->data[$i++][] = html_print_label_input_block(
)
);
$help_tip = ui_print_help_tip(
__('This log is recommended to be DISABLED by default due to the large amount of debug data it generates.'),
true
);
$table->data[$i][] = html_print_label_input_block(
__('Enable console log'),
__('Enable console log').$help_tip,
html_print_checkbox_switch(
'console_log_enabled',
1,
$config['console_log_enabled'],
true
).ui_print_input_placeholder(
__('Log location').': pandora_console/log/console.log',
__('Log location').': /var/log/php-fpm/error.log',
true
)
);

@ -683,11 +683,12 @@ if ($update_user) {
$password_new = (string) get_parameter('password_new', '');
$password_confirm = (string) get_parameter('password_confirm', '');
$own_password_confirm = (string) get_parameter('own_password_confirm', '');
$id_user = (string) get_parameter('id_user', '');
if ($password_new != '') {
$correct_password = false;
$user_credentials_check = process_user_login($config['id_user'], $own_password_confirm, true);
$user_credentials_check = process_user_login($id_user, $own_password_confirm, true);
if ($user_credentials_check !== false) {
$correct_password = true;

@ -302,25 +302,45 @@ $passwordManageTable->data['fields_repeatpassword'][0] = html_print_input_text_e
true
);
if ($new_user === false) {
if ($new_user === false && users_is_admin() === false) {
$passwordManageTable->data['captions_currentpassword'][0] = __('Current password');
$passwordManageTable->rowclass['fields_currentpassword'] = 'w540px';
$passwordManageTable->data['fields_currentpassword'][0] = html_print_input_text_extended(
'own_password_confirm',
'',
'own_password_confirm',
'',
'20',
'150',
$view_mode,
'',
[
'class' => 'input w100p',
'placeholder' => __('Own password confirmation'),
],
true,
true
);
if ($user_info['id_user'] === $config['id_user']) {
$passwordManageTable->data['fields_currentpassword'][0] = html_print_input_text_extended(
'own_password_confirm',
'',
'own_password_confirm',
'',
'20',
'45',
$view_mode,
'',
[
'class' => 'input w100p',
'placeholder' => __('Own password confirmation'),
],
true,
true
);
} else {
$passwordManageTable->data['fields_currentpassword'][0] = html_print_input_text_extended(
'own_password_confirm',
'',
'own_password_confirm',
'',
'20',
'45',
$view_mode,
'',
[
'class' => 'input w100p',
'placeholder' => __('Third user password confirmation'),
],
true,
true
);
}
}
$userManagementTable->data['passwordManage_table'] = html_print_table($passwordManageTable, true);

@ -1137,6 +1137,9 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_CLOUD_AWS_S3:
return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=s3&page=0';
case DISCOVERY_CLOUD_GCP_COMPUTE_ENGINE:
return 'wiz=cloud&mode=gcp&ki='.$task['auth_strings'].'&sub=compute&page=0';
default:
return 'wiz=cloud';
}

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>EB094270-FB38-4A58-BE94-D40EA44EA568</title>
<g id="Agentes" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="1.a1-Agentes---Listado" transform="translate(-362.500000, -268.000000)" fill="#C1CCDC">
<g id="Contenido" transform="translate(310.000000, 188.000000)">
<g transform="translate(20.000000, 20.000000)" id="Agentes">
<g id="Content" transform="translate(29.308511, 20.000000)">
<g id="Top" transform="translate(0.191489, 0.000000)">
<g id="Icons/Light/24/example" transform="translate(3.000000, 40.000000)">
<circle id="Oval" cx="6" cy="6" r="6"></circle>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

(image error) Size: 1.1 KiB

Binary file not shown.

After

(image error) Size: 5.3 KiB

@ -17,6 +17,8 @@ $save_custom_graph = (bool) get_parameter('save_custom_graph');
$print_custom_graph = (bool) get_parameter('print_custom_graph', false);
$print_sparse_graph = (bool) get_parameter('print_sparse_graph');
$get_graphs = (bool) get_parameter('get_graphs_container');
$width = get_parameter('width', 0);
$height = get_parameter('height', 0);
if ($save_custom_graph) {
$return = [];
@ -25,8 +27,6 @@ if ($save_custom_graph) {
$name = get_parameter('name', '');
$description = get_parameter('description', '');
$stacked = get_parameter('stacked', CUSTOM_GRAPH_LINE);
$width = get_parameter('width', 0);
$height = get_parameter('height', 0);
$events = get_parameter('events', 0);
$period = get_parameter('period', 0);
$fullscale = get_parameter('fullscale', 0);
@ -126,6 +126,8 @@ if ($print_sparse_graph) {
'force_interval' => '',
'time_interval' => 300,
'array_data_create' => 0,
'height' => $height,
'width' => $width,
];
echo grafico_modulo_sparse($params);

@ -97,6 +97,21 @@ if (check_login()) {
return;
}
$id_plugin = get_parameter('id_plugin', 0);
if ($id_plugin !== 0) {
$id_module_plugin = db_get_value(
'id_plugin',
'tagente_modulo',
'id_agente_modulo',
$get_module_macros
);
if ($id_plugin !== $id_module_plugin) {
$get_plugin_macros = true;
$get_module_macros = 0;
}
}
if ($get_plugin_macros) {
if (https_is_running()) {
header('Content-type: application/json');

@ -182,6 +182,7 @@ try {
if ($method == 'snmp_browser_create_modules') {
// Get target ids from form.
$use_agent_ip = get_parameter('use_agent_ip', '');
$id_items = get_parameter('id_item2', null);
$id_target = null;
if (empty($id_items) === false) {
@ -209,7 +210,8 @@ try {
$module_target,
$snmp_conf_values,
$id_target,
$server_to_exec
$server_to_exec,
$use_agent_ip
);
// Return fail modules for error/success message.

@ -0,0 +1,190 @@
<?php
/**
* Extension to schedule tasks on Pandora FMS Console
*
* @category Wizard
* @package Pandora FMS
* @subpackage Host&Devices
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 PandoraFMS S.L.
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
require_once '../functions.php';
require_once '../functions_welcome_wizard.php';
global $config;
$check_web = get_parameter('check_web', 0);
$check_connectivity = get_parameter('check_connectivity', 0);
$create_net_scan = get_parameter('create_net_scan', 0);
$create_mail_alert = get_parameter('create_mail_alert', 0);
$create_unknown_template_alert = get_parameter('create_unknown_template_alert', 0);
// Begin.
global $config;
if ($check_web) {
include_once '../functions_api.php';
include_once '../functions_servers.php';
$status_webserver = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_WEB], 'status')['status'];
if ($status_webserver === '1') {
$name = array_keys(servers_get_names())[0];
$id_group = get_parameter('id_group', 4);
$array_other['data'] = [
'Web monitoring',
'',
2,
$id_group,
0,
30,
30,
9,
$name,
0,
0,
0,
__('Agent Web monitoring created on welcome'),
];
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
if ($id_agent > 0) {
$module_name = get_parameter('module_name', 'Web_monitoring_module');
$text_to_search = get_parameter('text_to_search', '');
$url_goliat = get_parameter('url_goliat', 'https://pandorafms.com/en/');
$module_latency = create_module_latency_goliat($id_agent, $module_name, $id_group, $url_goliat, $text_to_search);
$module_status = create_module_status_goliat($id_agent, $module_name, $id_group, $url_goliat, $text_to_search);
if ($module_latency > 0 && $module_status > 0) {
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
}
} else {
ui_print_error_message(__('The Name is not valid for the modules.'));
}
} else {
ui_print_error_message(__('Web server is not enabled.'));
}
}
if ($check_connectivity) {
include_once '../functions_api.php';
include_once '../functions_servers.php';
$status_newtwork = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_NETWORK], 'status')['status'];
$status_pluggin = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_PLUGIN], 'status')['status'];
if ($status_newtwork === '1' && $status_pluggin === '1') {
$name = array_keys(servers_get_names())[0];
$id_group = get_parameter('id_group', 4);
$agent_name = get_parameter('agent_name', __('Agent check connectivity'));
$array_other['data'] = [
$agent_name,
'',
2,
$id_group,
0,
30,
30,
9,
$name,
0,
0,
0,
__('Basic connectivity'),
];
$id_agent = api_set_new_agent(0, '', $array_other, '', true);
if ($id_agent > 0) {
$ip_target = get_parameter('ip_target', '127.0.0.1');
$basic_network = create_module_basic_network($id_agent, $id_group, $ip_target);
$latency_network = create_module_latency_network($id_agent, $id_group, $ip_target);
$packet_lost = create_module_packet_lost($id_agent, $id_group, $ip_target);
if ($basic_network > 0 && $latency_network > 0 && $packet_lost > 0) {
ui_print_success_message(__('Your check has been created, <a href='.ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agent).'>click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
}
} else {
ui_print_error_message(__('The Name is not valid for the modules.'));
}
} else {
ui_print_error_message(__('Web server is not enabled.'));
}
}
if ($create_net_scan) {
$ip_target = get_parameter('ip_target', '192.168.10.0/24');
$id_net_scan = create_net_scan($ip_target);
if ($id_net_scan > 0) {
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
ui_print_success_message(__('Basic net created and scan in progress. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_recon_server.'&force='.$id_net_scan).'>Click here to view the data</a>. Please note that it may take a few seconds to see data if your server is busy'));
} else {
ui_print_error_message(__('Basic net already exists. <a href='.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'>Click here to view the data</a>'));
}
}
if ($create_mail_alert) {
include_once '../functions_alerts.php';
$id_action = db_get_row_filter('talert_actions', ['name' => 'Email to '.$config['id_user']], 'id')['id'];
if (!$id_action) {
$al_action = alerts_get_alert_action($id);
$id_action = alerts_clone_alert_action(1, $al_action['id_group'], 'Email to '.$config['id_user']);
}
$id_alert_template = get_parameter('id_condition', 0);
$id_agent_module = get_parameter('id_agent_module', 0);
$exist = db_get_value_sql(
sprintf(
'SELECT COUNT(id)
FROM talert_template_modules
WHERE id_agent_module = %d
AND id_alert_template = %d
AND id_policy_alerts = 0
',
$id_agent_module,
$id_alert_template
)
);
if ($exist > 0) {
ui_print_error_message(__('Alert already exists. <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure=0').'>Click here to view the data</a>'));
} else {
$id = alerts_create_alert_agent_module($id_agent_module, $id_alert_template);
if ($id !== false) {
$values = [];
$values['fires_min'] = (int) get_parameter('fires_min');
$values['fires_max'] = (int) get_parameter('fires_max');
$values['module_action_threshold'] = (int) 300;
$alert_created = alerts_add_alert_agent_module_action($id, $id_action, $values);
}
}
if ($alert_created === true) {
ui_print_success_message(__('Congratulations, you have already created a simple alert. <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure=0').'>You can see it.</a> Pandora FMS alerts are very flexible, you can do many more things with them, we recommend you to read the <a href="https://pandorafms.com/manual/start?id=en/documentation/04_using/01_alerts">documentation</a> for more information. You can create advanced alerts from <a href='.ui_get_full_url('index.php?sec=galertas&sec2=godmode/alerts/alert_actions').'>here</a>.'));
}
}
if ($create_unknown_template_alert) {
if (is_array(alerts_get_alert_templates(['name' => io_safe_input('Unknown condition')]))) {
echo 1;
} else {
echo create_template_alert_unknown();
}
}

@ -35,6 +35,13 @@ if (is_ajax() === false) {
}
$ajaxPage = 'include/ajax/welcome_window';
// Ajax controller.
$method = get_parameter('method', '');
if ($method === 'loadWelcomeWindow') {
unset($config['welcome_state']);
}
// Control call flow.
try {
@ -44,9 +51,6 @@ try {
exit;
}
// Ajax controller.
$method = get_parameter('method', '');
if (method_exists($welcome_actions, $method) === true) {
if ($welcome_actions->ajaxMethod($method) === true) {
$welcome_actions->{$method}();

@ -129,6 +129,14 @@ if (empty($apiPassword) === true
// Compat.
$config['id_user'] = 'admin';
$correctLogin = true;
// Bypass credentials if server-auth and api-pass are correct.
} else if (($config['server_unique_identifier'] === get_parameter('server_auth'))
&& ($api_password === $apiPassword)
&& ((bool) isInACL($ipOrigin) === true)
) {
$config['id_usuario'] = 'admin';
$config['id_user'] = 'admin';
$correctLogin = true;
} else if ((bool) isInACL($ipOrigin) === true) {
// External access.
// Token is valid. Bypass the credentials.
@ -203,9 +211,9 @@ if ($correctLogin === true) {
}
break;
case 'create_network_module':
// case 'create_network_module':
case 'create_plugin_module':
case 'create_data_module':
// case 'create_data_module':
case 'create_synthetic_module':
case 'create_snmp_module':
case 'delete_module':
@ -320,6 +328,7 @@ if ($correctLogin === true) {
break;
default:
return false;
// Ignore.
break;
}

@ -237,8 +237,13 @@ function process_user_login_remote($login, $pass, $api=false)
// Active Directory.
case 'ad':
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
$sr = enterprise_hook('ad_process_user_login', [$login, $pass]);
// Try with secondary server.
if ($sr === false && (bool) $config['secondary_active_directory'] === true) {
$sr = enterprise_hook('ad_process_user_login', [$login, $pass, true]);
}
if ($sr === false) {
return false;
}
break;

@ -165,6 +165,9 @@ $hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script type="text/javascript">
var phpTimezone = "<?php echo date_default_timezone_get(); ?>";
</script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url($hack_metaconsole.'include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>

@ -679,20 +679,24 @@ class ConsoleSupervisor
*/
public function checkAccessStatisticsPerformance()
{
global $config;
$total_agents = db_get_value('count(*)', 'tagente');
if ($total_agents >= 200) {
db_process_sql_update('tconfig', ['value' => 0], ['token' => 'agentaccess']);
$this->notify(
[
'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE',
'title' => __('Access statistics performance'),
'message' => __(
'Usage of agent access statistics IS NOT RECOMMENDED on systems with more than 200 agents due performance penalty'
),
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
]
);
if ($config['agentaccess'] !== 0) {
db_process_sql_update('tconfig', ['value' => 0], ['token' => 'agentaccess']);
$this->notify(
[
'type' => 'NOTIF.ACCESSSTASTICS.PERFORMANCE',
'title' => __('Access statistics performance'),
'message' => __(
'Usage of agent access statistics IS NOT RECOMMENDED on systems with more than 200 agents due performance penalty'
),
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup&section=perf',
]
);
}
} else {
$this->cleanNotifications('NOTIF.ACCESSSTASTICS.PERFORMANCE');
}
@ -1803,7 +1807,8 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION');
}
if (version_compare('8.1', PHP_VERSION) >= 0) {
// If PHP_VERSION is lower than 8.0.27 version_compare() returns 1.
if (version_compare('8.0.27', PHP_VERSION) === 1) {
$url = 'https://www.php.net/supported-versions.php';
$this->notify(
[
@ -2375,7 +2380,8 @@ class ConsoleSupervisor
'SELECT count(*) FROM tusuario
WHERE
id_user="admin"
AND password="1da7ee7d45b96d0e1f45ee4ee23da560"
AND (password="1da7ee7d45b96d0e1f45ee4ee23da560" OR
password="$2y$10$Wv/xoxjI2VAkthJhk/PzeeGIhBKYU/K.TMgUdmW7fEP2NQkdWlB9K")
AND is_admin=1
and disabled!=1'
);

File diff suppressed because it is too large Load Diff

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC230710';
$build_version = 'PC230719';
$pandora_version = 'v7.0NG.772';
// Do not overwrite default timezone set if defined.

@ -4348,6 +4348,11 @@ function generator_chart_to_pdf(
curl_close($curl);
$page->setHtml($response);
/*
//For debug url with parameters.
$navigation = $page->navigate($url.'?data='.urlencode(json_encode($data)));
$navigation->waitForNavigation(Page::DOM_CONTENT_LOADED);
*/
// Dynamic.
$dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue();

@ -2770,6 +2770,69 @@ function agents_delete_agent($id_agents, $disableACL=false)
enterprise_include_once('include/functions_agents.php');
enterprise_hook('agent_delete_from_cache', [$id_agent]);
// Delete agent from visual console.
db_process_sql_delete(
'tlayout_data',
['id_agent' => $id_agent]
);
// Delete agent from visual dashboards.
db_process_sql(
'UPDATE twidget_dashboard
SET options = NULL
WHERE options LIKE ("%\"agentid\":\"'.$id_agent.'\"%")'
);
// Delete agent from treport.
db_process_sql_delete(
'treport_content',
['id_agent' => $id_agent]
);
// Delete rules from tevent alerts (correlative alerts)
db_process_sql_delete(
'tevent_rule',
[
'agent' => $id_agent,
'operator_agent' => '==',
]
);
db_process_sql_delete(
'tevent_rule',
[
'log_agent' => $id_agent,
'operator_log_agent' => '==',
]
);
// Delete from gis maps history
db_process_sql_delete(
'tgis_data_history',
['tagente_id_agente' => $id_agent]
);
// Delete from policies.
db_process_sql_delete(
'tpolicy_agents',
['id_agent' => $id_agent]
);
// Delete from tnetwork maps
db_process_sql_delete(
'titem',
['source_data' => $id_agent]
);
db_process_sql_delete(
'trel_item',
[
'id_parent_source_data' => $id_agent,
'id_child_source_data' => $id_agent,
],
'OR'
);
// Delete agent from fav menu.
db_process_sql_delete(
'tfavmenu_user',

@ -455,7 +455,7 @@ function alerts_delete_alert_action($id_alert_action)
*
* @return mixed Id of the cloned action or false in case of fail.
*/
function alerts_clone_alert_action($id_alert_action, $id_group)
function alerts_clone_alert_action($id_alert_action, $id_group, $copy_name='')
{
$id_alert_action = safe_int($id_alert_action, 1);
if (empty($id_alert_action)) {
@ -474,7 +474,13 @@ function alerts_clone_alert_action($id_alert_action, $id_group)
unset($action['id']);
return alerts_create_alert_action($action['name'].' '.__('copy'), $action['id_alert_command'], $action);
if ($copy_name !== '') {
$copy_name = $copy_name;
} else {
$copy_name = $action['name'].' '.__('copy');
}
return alerts_create_alert_action($copy_name, $action['id_alert_command'], $action);
}

@ -1916,7 +1916,7 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
*
* @param $thrash3 Don't use.
*/
function api_set_new_agent($id_node, $thrash2, $other, $trhash3)
function api_set_new_agent($id_node, $thrash2, $other, $trhash3, $return=false)
{
global $config;
@ -2038,13 +2038,17 @@ function api_set_new_agent($id_node, $thrash2, $other, $trhash3)
}
}
returnData(
'string',
[
'type' => 'string',
'data' => $id_agente,
]
);
if ($return === false) {
returnData(
'string',
[
'type' => 'string',
'data' => $id_agente,
]
);
} else {
return $id_agente;
}
} catch (\Exception $e) {
returnError($e->getMessage());
return;
@ -7833,24 +7837,26 @@ function api_set_planned_downtimes_add_agents($id, $thrash1, $other, $thrash3)
}
if (!empty($other['data'][0])) {
$agents = $other['data'];
$agents = explode(';', $other['data'][0]);
$results = false;
foreach ($agents as $agent) {
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
$res = db_process_sql_insert(
'tplanned_downtime_agents',
[
'id_agent' => $agent,
'id_downtime' => $id,
'all_modules' => 0,
'manually_disabled' => 0,
]
);
if ($res) {
$results = true;
if (!empty($agent)) {
if (db_get_value_sql(sprintf('SELECT id from tplanned_downtime_agents tpd WHERE tpd.id_agent = %d AND id_downtime = %d', $agent, $id)) === false) {
$res = db_process_sql_insert(
'tplanned_downtime_agents',
[
'id_agent' => $agent,
'id_downtime' => $id,
'all_modules' => 0,
'manually_disabled' => 0,
]
);
if ($res) {
$results = true;
}
} else {
returnError(" Agent $agent is already at the planned downtime.");
}
} else {
returnError(" Agent $agent is already at the planned downtime.");
}
}
@ -11544,6 +11550,11 @@ function api_get_events($node_id, $trash2, $other, $returnType)
}
}
// Add agent name to nodo.
if (is_metaconsole() === false && empty($row['id_agente']) === false) {
$row['agent_name'] = agents_get_name($row['id_agente']);
}
// FOR THE TEST THE API IN THE ANDROID.
$row['description_event'] = events_print_type_description($row['event_type'], true);
$row['img_description'] = events_print_type_img($row['event_type'], true, true);
@ -11643,7 +11654,7 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2)
return;
}
if (!check_acl($config['id_user'], 0, 'PM')) {
if (!check_acl($config['id_user'], 0, 'UM')) {
returnError('forbidden', 'string');
return;
}
@ -11667,7 +11678,7 @@ function api_set_add_user_profile($id, $thrash1, $other, $thrash2)
return;
}
if (!check_acl($config['id_user'], $group, 'PM')) {
if (!check_acl($config['id_user'], $group, 'UM')) {
returnError('forbidden', 'string');
return;
}
@ -11702,7 +11713,7 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2)
return;
}
if (!check_acl($config['id_user'], 0, 'PM')) {
if (!check_acl($config['id_user'], 0, 'UM')) {
returnError('forbidden', 'string');
return;
}
@ -11726,7 +11737,7 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2)
return;
}
if (!check_acl($config['id_user'], $group, 'PM')) {
if (!check_acl($config['id_user'], $group, 'UM')) {
returnError('forbidden', 'string');
return;
}
@ -11759,7 +11770,7 @@ function api_get_user_profiles_info($thrash1, $thrash2, $thrash3, $returnType)
{
global $config;
if (!check_acl($config['id_user'], 0, 'PM')) {
if (!check_acl($config['id_user'], 0, 'UM')) {
returnError('forbidden', 'string');
return;
}
@ -16974,7 +16985,7 @@ function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType)
{
global $config;
if (!check_acl($config['id_user'], 0, 'AW')) {
if (!check_acl($config['id_user'], 0, 'UM')) {
returnError('forbidden', 'string');
return;
}

@ -631,6 +631,30 @@ function config_update_config()
$error_update[] = __('Domain');
}
if (config_update_value('secondary_active_directory', get_parameter('secondary_active_directory'), true) === false) {
$error_update[] = __('Secondary active directory');
}
if (config_update_value('ad_server_secondary', get_parameter('ad_server_secondary'), true) === false) {
$error_update[] = __('Secondary active directory server');
}
if (config_update_value('ad_port_secondary', get_parameter('ad_port_secondary'), true) === false) {
$error_update[] = __('Secondary active directory port');
}
if (config_update_value('ad_start_tls_secondary', get_parameter('ad_start_tls_secondary'), true) === false) {
$error_update[] = __('Secondary start TLS');
}
if (config_update_value('ad_search_timeout', get_parameter('ad_search_timeout'), true) === false) {
$error_update[] = __('AD search timeout');
}
if (config_update_value('ad_domain_secondary', get_parameter('ad_domain_secondary'), true) === false) {
$error_update[] = __('Secondary domain');
}
if (config_update_value('ad_adv_perms', get_parameter('ad_adv_perms'), true) === false) {
$error_update[] = __('Advanced Permisions AD');
}
@ -3108,6 +3132,14 @@ function config_process_config()
config_update_value('ad_port', 389);
}
if (!isset($config['ad_server_secondary'])) {
config_update_value('ad_server_secondary', 'localhost');
}
if (!isset($config['ad_port_secondary'])) {
config_update_value('ad_port_secondary', 389);
}
if (!isset($config['ad_start_tls'])) {
config_update_value('ad_start_tls', 0);
}

@ -4983,19 +4983,18 @@ function graph_monitor_wheel($width=550, $height=600, $filter=false)
$filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false;
if ($filter['group'] != 0) {
$filter_subgroups = '';
if (!$filter['dont_show_subgroups']) {
$filter_subgroups = ' || parent IN ('.$filter['group'].')';
if ($filter['dont_show_subgroups'] === false) {
$groups = groups_get_children($filter['group']);
$groups_ax = [];
foreach ($groups as $g) {
$groups_ax[$g['id_grupo']] = $g;
}
$groups = $groups_ax;
} else {
$groups = groups_get_group_by_id($filter['group']);
$groups[$group['id_grupo']] = $group;
}
$groups = db_get_all_rows_sql('SELECT * FROM tgrupo where id_grupo IN ('.$filter['group'].') '.$filter_subgroups);
$groups_ax = [];
foreach ($groups as $g) {
$groups_ax[$g['id_grupo']] = $g;
}
$groups = $groups_ax;
} else {
$groups = users_get_groups(false, 'AR', false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null));
}

@ -1921,7 +1921,8 @@ function html_print_extended_select_for_unit(
$select_style=false,
$unique_name=true,
$disabled=false,
$no_change=0
$no_change=0,
$class='w100p'
) {
global $config;
@ -1953,7 +1954,7 @@ function html_print_extended_select_for_unit(
ob_start();
echo '<div id="'.$uniq_name.'_default" class="w100p inline_line">';
echo '<div id="'.$uniq_name.'_default" class="'.$class.' inline_line">';
html_print_select(
$fields,
$uniq_name.'_select',
@ -3927,6 +3928,14 @@ function html_print_table(&$table, $return=false)
}
}
if (isset($table->tdid)) {
foreach ($table->tdid as $keyrow => $tid) {
foreach ($tid as $key => $id) {
$tdid[$keyrow][$key] = $id;
}
}
}
if (isset($table->cellstyle)) {
foreach ($table->cellstyle as $keyrow => $cstyle) {
foreach ($cstyle as $key => $cst) {
@ -4110,6 +4119,10 @@ function html_print_table(&$table, $return=false)
$colspan[$keyrow][$key] = '';
}
if (!isset($tdid[$keyrow][$key])) {
$tdid[$keyrow][$key] = '';
}
if (!isset($rowspan[$keyrow][$key])) {
$rowspan[$keyrow][$key] = '';
}
@ -4130,10 +4143,16 @@ function html_print_table(&$table, $return=false)
$style[$key] = '';
}
if ($class === 'datos5' && $key === 1) {
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'.$cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key].$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.' '.$cellclass[$keyrow][$key].'">'.$item.'</td>'."\n";
if ($tdid[$keyrow][$key] !== '') {
$tid = $tdid[$keyrow][$key];
} else {
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'.$cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key].'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.' '.$cellclass[$keyrow][$key].'">'.$item.'</td>'."\n";
$tid = $tableid.'-'.$keyrow.'-'.$key;
}
if ($class === 'datos5' && $key === 1) {
$output .= '<td id="'.$tid.'" style="'.$cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key].$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.' '.$cellclass[$keyrow][$key].'">'.$item.'</td>'."\n";
} else {
$output .= '<td id="'.$tid.'" style="'.$cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key].'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.' '.$cellclass[$keyrow][$key].'">'.$item.'</td>'."\n";
}
}
@ -7128,3 +7147,44 @@ function html_print_code_picker(
echo $output;
}
}
function html_print_wizard_diagnosis(
$title,
$id_button,
$description='',
$status=true,
$return=false,
) {
$button = '';
if ($status === true) {
$status = 'Connected';
$img = '/images/configuration@svg.svg';
} else {
$status = 'Disconnected';
$img = '/images/change-active.svg';
}
$button = html_print_image(
$img,
true,
[
'class' => 'main_menu_icon invert_filter float-right mrgn_right_10px',
'id' => $id_button,
]
);
$output = '<div class="rectangle rectangle_'.$status.'">
<span class="status '.$status.'">'.__($status).$button.'</span>
<div class="title">'.html_print_image('/images/circle_title.svg', true, ['class' => 'invert_filter']).'<span>'.$title.'</span></div>
<div class="description">
<span>'.$description.'</span>
</div>
</div>';
if ($return === true) {
return $output;
} else {
echo $output;
}
}

@ -324,6 +324,8 @@ function menu_print_menu(&$menu)
if (isset($sub['subtype']) && $sub['subtype'] == 'nolink') {
$submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p arrow_menu_down"></div></div>';
} else if (isset($sub['subtype']) && $sub['subtype'] == 'nolink_no_arrow') {
$submenu_output .= '<div class=" SubNoLink '.$sub_tree_class.'"><span class="w70p span_has_menu_text">'.$sub['text'].'</span><div class="w21p"></div></div>';
} else if (isset($sub['subtype']) && $sub['subtype'] == 'new_blank') {
$submenu_output .= '<a href="'.$subsec2.'" target="_blank"><div class="'.$sub_tree_class.'">'.$sub['text'].'</div></a>';
} else {

@ -743,7 +743,8 @@ function modules_create_agent_module(
string $name,
array $values=[],
bool $disableACL=false,
$tags=false
$tags=false,
$use_agent_ip=false,
) {
global $config;
@ -785,6 +786,10 @@ function modules_create_agent_module(
return ERR_EXIST;
}
if ($use_agent_ip === true) {
$values['ip_target'] = agents_get_address($id_agent);
}
// Encrypt passwords.
if (isset($values['plugin_pass']) === true) {
// Avoid two times encryption.

@ -1734,7 +1734,12 @@ function netflow_get_top_summary(
switch ($top_action) {
case 'listeners':
if (empty(!$filter)) {
$netflow_filter['ip_src'] = $filter;
if (!is_array($filter)) {
$netflow_filter['ip_src'] = $filter;
} else {
$netflow_filter['ip_src'] = $filter['ip'];
$netflow_filter['advanced_filter'] = $filter['advanced_filter'];
}
}
$sort = 'dstip';
@ -1742,7 +1747,12 @@ function netflow_get_top_summary(
case 'talkers':
if (empty(!$filter)) {
$netflow_filter['ip_dst'] = $filter;
if (!is_array($filter)) {
$netflow_filter['ip_dst'] = $filter;
} else {
$netflow_filter['ip_dst'] = $filter['ip'];
$netflow_filter['advanced_filter'] = $filter['advanced_filter'];
}
}
$sort = 'srcip';
@ -2069,7 +2079,7 @@ function netflow_aggregate_is_ip($aggregate)
*
* @return array With map structure.
*/
function netflow_build_map_data($start_date, $end_date, $top, $aggregate)
function netflow_build_map_data($start_date, $end_date, $top, $aggregate, $advanced_filter='')
{
// Pass an empty filter data structure.
$data = netflow_get_relationships_raw_data(
@ -2083,7 +2093,7 @@ function netflow_build_map_data($start_date, $end_date, $top, $aggregate)
'ip_src' => '',
'dst_port' => '',
'src_port' => '',
'advanced_filter' => '',
'advanced_filter' => $advanced_filter,
'router_ip' => '',
],
$top,

@ -412,6 +412,13 @@ function reporting_make_reporting_data(
);
break;
case 'event_report_log_table':
$report['contents'][] = reporting_log_table(
$report,
$content
);
break;
case 'increment':
$report['contents'][] = reporting_increment(
$report,

@ -259,6 +259,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_html_log($table, $item);
break;
case 'event_report_log_table':
reporting_html_log_table($table, $item);
break;
case 'permissions_report':
reporting_html_permissions($table, $item);
break;

@ -944,6 +944,11 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Log'),
'name' => __('Log report'),
];
$types['event_report_log_table'] = [
'optgroup' => __('Log'),
'name' => __('Log report by period'),
];
}
if ($template === false) {

@ -1411,3 +1411,24 @@ function servers_get_master()
return $result;
}
/**
* Return true if all servers are up.
*
* @return boolean
*/
function check_all_servers_up()
{
$status = true;
$servers = servers_get_info();
foreach ($servers as $server) {
if ($server['status'] !== '1') {
return false;
}
}
return $status;
}

@ -1291,7 +1291,8 @@ function snmp_browser_create_modules_snmp(
string $module_target,
array $snmp_values,
?array $id_target,
?string $server_to_exec=null
?string $server_to_exec=null,
?string $use_agent_ip=''
) {
$target_ip = null;
$target_port = null;
@ -1350,6 +1351,12 @@ function snmp_browser_create_modules_snmp(
}
}
if (empty($use_agent_ip) === false) {
$use_agent_ip = true;
} else {
$use_agent_ip = false;
}
$fail_modules = [];
foreach ($targets_oids as $key => $target_oid) {
@ -1514,7 +1521,7 @@ function snmp_browser_create_modules_snmp(
'history_data' => 1,
];
foreach ($id_target as $agent) {
$ids[] = modules_create_agent_module($agent, $oid['oid'], $values);
$ids[] = modules_create_agent_module($agent, $oid['oid'], $values, false, false, $use_agent_ip);
}
} else if ($module_target == 'policy') {
// Policies only in enterprise version.
@ -1803,6 +1810,16 @@ function snmp_browser_print_create_module_massive(
true
);
$table->data[4][0] = html_print_label_input_block(
__('Use agent IP'),
html_print_checkbox(
'use_agent_ip',
1,
false,
true
)
);
$output .= html_print_table($table, true);
// SNMP extradata.

@ -795,8 +795,14 @@ function tags_get_acl_tags(
$acltags = [];
foreach ($raw_acltags as $group => $taglist) {
if (empty($id_group) === false && array_key_exists($group, $id_group) === false) {
continue;
if ($return_mode === 'module_condition') {
if (!empty($id_group) && !in_array($group, $id_group)) {
continue;
}
} else {
if (empty($id_group) === false && array_key_exists($group, $id_group) === false) {
continue;
}
}
if (!empty($taglist)) {

@ -650,16 +650,28 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
// Agent name.
$row = [];
$row['title'] = __('Agent name');
$row['data'] = html_print_anchor(
[
'href' => 'javascript:void(0)',
'title' => __('Click here for view this agent'),
'class' => 'font_11',
'content' => $cellName,
'onClick' => "sendHash('".$urlAgent."')",
],
true
);
if (is_metaconsole() === true) {
$row['data'] = html_print_anchor(
[
'href' => 'javascript:void(0)',
'title' => __('Click here for view this agent'),
'class' => 'font_11',
'content' => $cellName,
'onClick' => "sendHash('".$urlAgent."')",
],
true
);
} else {
$row['data'] = html_print_anchor(
[
'href' => $urlAgent,
'title' => __('Click here for view this agent'),
'class' => 'font_11',
'content' => $cellName,
],
true
);
}
$table->data['name'] = $row;

@ -3324,6 +3324,32 @@ function ui_print_module_status(
}
/**
* Returns html code to print a shape for a module.
*
* @param integer $color Hex color.
* @param boolean $return True or false.
* @param string $class Custom class or use defined.
* @param string $div_content Content.
*
* @return string HTML code for shape.
*/
function ui_print_diagnosis_status(
$color,
$return=false,
$class='status_rounded_rectangles',
$div_content=''
) {
$output = '<div style="background: '.$color.'" class="'.$class.'">'.$div_content.'</div>';
if ($return === false) {
echo $output;
}
return $output;
}
/**
* Get the shape of an image by assigning it a CSS class. Prints an image with CSS representing a status.
*
@ -4343,7 +4369,8 @@ function ui_print_datatable(array $parameters)
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers"));
let original_styles = $("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").attr("style");
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers").attr("style", original_styles + " margin-right: 10px;"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_length"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dt-buttons"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_filter"));

@ -0,0 +1,568 @@
<?php
/**
* Agents Functions.
*
* @category Agents functions.
* @package Pandora FMS
* @subpackage User interface.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 PandoraFMS Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
/**
* Create_module_latency_goliat and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $module_name Module name.
* @param mixed $id_group Id group.
* @param mixed $url_search Url to search.
* @param mixed $string_search Text to search.
*
* @return interger Module id.
*/
function create_module_latency_goliat($id_agent, $module_name, $id_group, $url_search, $string_search='')
{
if ($string_search !== '') {
$str_search = 'check_string '.$string_search.'';
}
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '30',
'descripcion' => '',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => '',
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => 'task_begin
get '.$url_search.'
resource 1
'.$str_search.'
task_end',
'id_plugin' => '0',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '7',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '0',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, $module_name.'_latency', $array_values);
}
/**
* Create_module_status_goliat and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $module_name Module name.
* @param mixed $id_group Id group.
* @param mixed $url_search Url to search.
* @param mixed $string_search Text to search.
*
* @return interger Module id.
*/
function create_module_status_goliat($id_agent, $module_name, $id_group, $url_search, $string_search='')
{
if ($string_search !== '') {
$str_search = 'check_string '.$string_search.' ';
}
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '31',
'descripcion' => '',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => '',
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => 'task_begin
get '.$url_search.'
resource 1
'.$str_search.'
task_end',
'id_plugin' => '0',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '7',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '0',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, $module_name.'_status', $array_values);
}
/**
* Create module basic network and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $id_group Id group.
* @param mixed $ip_target Ip target.
*
* @return interger Module id.
*/
function create_module_basic_network($id_agent, $id_group, $ip_target)
{
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '6',
'descripcion' => 'Basic network check (ping)',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => $ip_target,
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => '',
'id_plugin' => '0',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '2',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '0',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, 'Basic_Network_Check', $array_values);
}
/**
* Create module latency network and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $id_group Id group.
* @param mixed $ip_target Ip target.
*
* @return interger Module id.
*/
function create_module_latency_network($id_agent, $id_group, $ip_target)
{
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '7',
'descripcion' => 'Basic network connectivity check to measure network latency in miliseconds',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => $ip_target,
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => '',
'id_plugin' => '0',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '2',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '1',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, 'Basic_Network_Latency', $array_values);
}
/**
* Create module packet lost and return module id.
*
* @param mixed $id_agent Id agent.
* @param mixed $id_group Id group.
* @param mixed $ip_target Ip target.
*
* @return interger Module id.
*/
function create_module_packet_lost($id_agent, $id_group, $ip_target)
{
include_once 'include/functions_modules.php';
$array_values = [
'id_tipo_modulo' => '1',
'descripcion' => 'Basic network connectivity check to measure packet loss in %',
'max' => '0',
'min' => '0',
'snmp_oid' => '',
'snmp_community' => 'public',
'id_module_group' => $id_group,
'module_interval' => '300',
'module_ff_interval' => '0',
'ip_target' => '',
'tcp_port' => '0',
'tcp_rcv' => '',
'tcp_send' => '',
'id_export' => '0',
'plugin_user' => '',
'plugin_pass' => '0',
'plugin_parameter' => '',
'id_plugin' => '9',
'post_process' => '0',
'prediction_module' => '0',
'max_timeout' => '0',
'max_retries' => '0',
'disabled' => '',
'id_modulo' => '4',
'custom_id' => '',
'history_data' => '1',
'dynamic_interval' => '0',
'dynamic_max' => '0',
'dynamic_min' => '0',
'dynamic_two_tailed' => '1',
'parent_module_id' => '0',
'min_warning' => '0',
'max_warning' => '0',
'str_warning' => '',
'min_critical' => '0',
'max_critical' => '0',
'str_critical' => '',
'custom_string_1' => '',
'custom_string_2' => '',
'custom_string_3' => '',
'custom_integer_1' => '0',
'custom_integer_2' => '0',
'min_ff_event' => '0',
'min_ff_event_normal' => '0',
'min_ff_event_warning' => '0',
'min_ff_event_critical' => '0',
'ff_type' => '0',
'each_ff' => '0',
'ff_timeout' => '0',
'unit' => '',
'macros' => '{"1":{"macro":"_field1_","desc":"Test time","help":"","value":"8","hide":""},"2":{"macro":"_field2_","desc":"Target IP","help":"","value":"'.$ip_target.'","hide":""}}',
'quiet' => '0',
'cps' => '0',
'critical_instructions' => '',
'warning_instructions' => '',
'unknown_instructions' => '',
'critical_inverse' => '0',
'warning_inverse' => '0',
'percentage_critical' => '0',
'percentage_warning' => '0',
'cron_interval' => '* * * * *',
'id_category' => '0',
'disabled_types_event' => '{\"going_unknown\":0}',
'module_macros' => 'W10=',
'warning_time' => '0',
];
return modules_create_agent_module($id_agent, 'Basic_Network_Packetloss', $array_values);
}
/**
* Create module packet lost and return module id.
*
* @param string $ip_target Ip and red mask.
*
* @return interger Module id.
*/
function create_net_scan($ip_target)
{
global $config;
include_once $config['homedir'].'/godmode/wizards/HostDevices.class.php';
$HostDevices = new HostDevices(1);
$id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server'];
$_POST = [
'page' => '1',
'interval_manual_defined' => '1',
'interval_select' => '-1',
'interval_text' => '0',
'interval' => '0',
'interval_units' => '1',
'taskname' => __('Basic network'),
'id_recon_server' => $id_recon_server,
'network' => $ip_target,
'id_group' => '8',
'comment' => __('Created on welcome'),
];
$task_created = $HostDevices->parseNetScan();
if ($task_created === true) {
$HostDevicesFinal = new HostDevices(2);
$_POST = [
'task' => $HostDevices->task['id_rt'],
'page' => '2',
'recon_ports' => '',
'auto_monitor' => 'on',
'id_network_profile' => ['0' => '2'],
'review_results' => 'on',
'review_limited' => '0',
'snmp_enabled' => 'on',
'snmp_version' => '1',
'snmp_skip_non_enabled_ifs' => 'on',
'community' => '',
'snmp_context' => '',
'snmp_auth_user' => '',
'snmp_security_level' => 'authNoPriv',
'snmp_auth_method' => 'MD5',
'snmp_auth_pass' => '',
'snmp_privacy_method' => 'AES',
'snmp_privacy_pass' => '',
'os_detect' => 'on',
'resolve_names' => 'on',
'parent_detection' => 'on',
'parent_recursion' => 'on',
'vlan_enabled' => 'on',
];
$task_final_created = $HostDevicesFinal->parseNetScan();
if ($task_final_created === true) {
$net_scan_id = $HostDevices->task['id_rt'];
unset($HostDevices, $HostDevicesFinal);
return $net_scan_id;
}
} else {
return 0;
}
}
/**
* Create new template unknown.
*
* @return boolean 1 correct create 0 bad create.
*/
function create_template_alert_unknown()
{
$name = io_safe_input(__('Unknown condition'));
$type = 'critical';
$values = [
'description' => __('This is a generic alert template to fire on UNKNOWN condition'),
'max_value' => 0,
'min_value' => 0,
'id_group' => 0,
'priority' => 4,
'wizard_level' => 'nowizard',
'time_threshold' => '300',
'min_alerts_reset_counter' => 1,
'schedule' => '{"monday":[{"start":"00:00:00","end":"00:00:00"}],"tuesday":[{"start":"00:00:00","end":"00:00:00"}],"wednesday":[{"start":"00:00:00","end":"00:00:00"}],"thursday":[{"start":"00:00:00","end":"00:00:00"}],"friday":[{"start":"00:00:00","end":"00:00:00"}],"saturday":[{"start":"00:00:00","end":"00:00:00"}],"sunday":[{"start":"00:00:00","end":"00:00:00"}]}',
'recovery_notify' => true,
'field2' => '[PANDORA] Alert for UNKNOWN status on _agent_ / _module_',
'field2_recovery' => '[PANDORA] Alert RECOVERED for UNKNOWN status on _agent_ / _module_',
'field3' => '<div style="background-color: #eaf0f6; font-family: Arial, Helvetica, sans-serif; padding: 30px; margin: 0;"><table style="max-width: 560px; background-color: white; border-radius: 10px; padding: 10px 20px 40px;" cellspacing="0" cellpadding="0" align="center"><thead><tr><td style="padding: 0px 0px 5px;"><a href="https://pandorafms.com/en/" target="_blank" rel="noopener"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Pandora-FMS.png" width="206px"></a></td><td style="padding: 0px 0px 5px;"><p style="text-align: right; color: #223549; font-weight: bold; line-height: 36px; padding: 0px; font-size: 12px;">Automatic alert system</p></td></tr><tr><td style="padding: 0px 0px 5px;" colspan="2"><hr style="border: 1px solid #f5f5f5; width: 100%; margin: 0px;"></td></tr></thead><tbody><tr><td colspan="2"><img style="display: block; margin-left: auto; margin-right: auto; width: 105px; margin-top: 20px; padding: 0px;" src="https://pandorafms.com/wp-content/uploads/2022/03/Warning-news.png" width="105px"></td></tr><tr><td colspan="2"><p style="font-size: 24px; text-align: center; color: #223549; padding: 0px 10%; line-height: 34px; margin: 20px 0px;">We have bad news for you, something is on <span style="text-transform: uppercase; font-weight: 800;">UNKNOWN</span>&nbsp;status!</p><div><!-- [if mso]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="#" style="height:33px;v-text-anchor:middle;width:100px;" stroke="f" fillcolor="#D84A38"><w:anchorlock/><center><![endif]--><a style="background-color: #223549; border: none; color: white; padding: 15px 30px; text-align: center; text-decoration: none; display: block; font-size: 16px; margin-left: auto; margin-right: auto; border-radius: 100px; max-width: 50%; margin-top: 0px; font-weight: bold;" href="_homeurl_">Go to Pandora FMS Console</a><!-- [if mso]></center></v:rect><![endif]--></div></td></tr><tr><td colspan="2"><div style="background-color: #f6f6f6; border-radius: 10px; padding: 10px 20px; margin-top: 40px;"><p style="font-size: 18px; line-height: 30px; color: #223549;">Monitoring details</p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Data: <span style="font-weight: 400!important;">_data_ <em>(warning)</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Agent: <span style="font-weight: 400!important;">_agent_ <em>_address_</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Module: <span style="font-weight: 400!important;">_module_ <em>_moduledescription_</em></span></p><p style="font-size: 15px; color: #333333; font-weight: 800; line-height: 15px;">Timestamp: <span style="font-weight: 400!important;">_timestamp_</span></p></div></td></tr><tr><td style="padding: 20px 0px;" colspan="2"><p style="font-size: 18px; line-height: 30px; color: #223549;">This is a graph of latest 24hr data for this module</p><p style="font-weight: 400!important;">_modulegraph_24h_</p></td></tr></tbody></table><div style="text-align: center; margin-top: 10px;"><p style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;"><a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/en/contact/">Contact Us</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/community/forums/forum/english/">Support</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a style="font-size: 12px; text-decoration: none; font-weight: 400; color: #777;" href="https://pandorafms.com/manual/en/start">Docs</a></p></div></div>',
'field3_recovery' => '<div style="background-color:#EAF0F6; font-family: Arial, Helvetica, sans-serif; padding:30px; margin:0;"><table style="max-width:560px; background-color:white; border-radius:10px; padding:10px 20px 40px;" cellspacing="0" cellpadding="0" align="center"><thead><tr><td style="padding:0px 0px 5px;"><a href="https://pandorafms.com/en/" target="_blank"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Pandora-FMS.png" width="206px"></a></td><td style="padding:0px 0px 5px;"><p style="text-align:right; color:#223549; font-weight:700; line-height:36px; padding:0px; font-size:12px;">Automatic alert system</p></td></tr><tr><td colspan="2" style="padding:0px 0px 5px;"><hr style="border: 1px solid #f5f5f5; width:100%; margin:0px;"></td></tr></thead><tbody><tr><td colspan="2"><img src="https://pandorafms.com/wp-content/uploads/2022/03/System-email-Good-news.png" style="display: block; margin-left: auto; margin-right: auto; width:105px; margin-top:20px; padding:0px;" width="105px"></td></tr><tr><td colspan="2"><p style="font-size:24px; text-align:center; color:#223549; padding:0px 10%; line-height:34px; margin:20px 0px;">We have good news for you, alert has been <span style="text-transform:uppercase; font-weight:800;">recovered</span></p><div><!--[if mso]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="#" style="height:33px;v-text-anchor:middle;width:100px;" stroke="f" fillcolor="#D84A38"><w:anchorlock/><center><![endif]--><a style="background-color: #223549; border: none; color: white; padding: 15px 30px; text-align: center; text-decoration: none; display: block; font-size: 16px; margin-left: auto; margin-right: auto; border-radius:100px; max-width:50%; margin-top:0px; font-weight:700;" href="_homeurl_">Go to Pandora FMS Console</a><!--[if mso]></center></v:rect><![endif]--></div></td></tr><tr><td colspan="2"><div style="background-color:#F6F6F6; border-radius:10px; padding:10px 20px; margin-top:40px;"><p style="font-size:18px; line-height:30px; color:#223549;">Monitoring details</p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Data: <span style="font-weight:400!important;">_data_ <em>(normal)</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Agent: <span style="font-weight:400!important;">_agent_ <em>_address_</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Module: <span style="font-weight:400!important;">_module_ <em>_moduledescription_</em></span></p><p style="font-size:15px; color:#333333; font-weight:800; line-height:15px;">Timestamp: <span style="font-weight:400!important;">_timestamp_</span></p></div></td></tr><tr><td style="padding:20px 0px;" colspan="2"><p style="font-size:18px; line-height:30px; color:#223549;">This is a graph of latest 24hr data for this module</p><p style="font-weight:400!important;">_modulegraph_24h_</p></td></tr></tbody></table><div style="text-align:center; margin-top:10px;"><p style="font-size:12px; text-decoration: none; font-weight:400; color:#777;"><a href="https://pandorafms.com/en/contact/" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Contact Us</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="https://pandorafms.com/community/forums/forum/english/" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Support</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="https://pandorafms.com/manual/en/start" style="font-size:12px; text-decoration: none; font-weight:400; color:#777;">Docs</a></p></div></div>',
];
$result = alerts_create_alert_template($name, $type, $values);
return $result;
}

@ -943,12 +943,18 @@ function pandoraFlotSlicebar(
// Format functions
function xFormatter(v) {
var ct = new Date();
// var ct = new Date();
var ct = new timezoneJS.Date();
ct.setTimezone(phpTimezone);
var currentTime = ct.getTime();
var diffDates = (currentTime - 1000 * datelimit) / 1000;
var d = new Date(1000 * (v + datelimit));
// var d = new Date(1000 * (v + datelimit));
var d = new timezoneJS.Date(1000 * (v + datelimit));
d.setTimezone(phpTimezone);
var monthNames = [
"Jan",
"Feb",
@ -2048,7 +2054,7 @@ function pandoraFlotArea(
xaxes: [
{
mode: "time",
timezone: "browser",
timezone: phpTimezone,
localTimezone: true
//tickSize: [maxticks, 'hour']
}
@ -2148,7 +2154,7 @@ function pandoraFlotArea(
xaxes: [
{
mode: "time",
timezone: "browser",
timezone: phpTimezone,
localTimezone: true
//tickSize: [maxticks, 'hour']
}
@ -2247,7 +2253,7 @@ function pandoraFlotArea(
xaxes: [
{
mode: "time",
timezone: "browser",
timezone: phpTimezone,
localTimezone: true,
tickSize: [maxticks_zoom, "hour"]
}
@ -2294,7 +2300,7 @@ function pandoraFlotArea(
xaxes: [
{
mode: "time",
timezone: "browser",
timezone: phpTimezone,
localTimezone: true,
tickSize: [maxticks_zoom, "hour"]
}
@ -2356,7 +2362,11 @@ function pandoraFlotArea(
$("#timestamp_" + graph_id).show();
var d = new Date(pos.x);
// var d = new Date(pos.x);
var d = new timezoneJS.Date();
d.setTimezone(phpTimezone);
d.setTime(pos.x);
var monthNames = [
"Jan",
"Feb",

@ -150,7 +150,7 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
}
function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $tooltip=true)
function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $tooltip=true, $id_container=false)
{
global $config;
@ -158,6 +158,8 @@ function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $toolt
$data = json_encode($data);
}
$id_container = ($id_container === false) ? '#sunburst' : $id_container;
$output = "<div id=\"sunburst\" style='overflow: hidden;'></div>";
$output .= include_javascript_d3(true);
$output .= '<style type="text/css">
@ -167,7 +169,7 @@ function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $toolt
}
</style>';
$output .= "<script language=\"javascript\" type=\"text/javascript\">
sunburst('#sunburst', $data, '$width', '$height', '$tooltip');
sunburst('$id_container', $data, '$width', '$height', '$tooltip');
</script>";
if (!$return) {

@ -36,9 +36,16 @@ function include_javascript_dependencies_flot_graph($return=false, $mobile=false
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/mobile/include/javascript/jquery.mobile-1.5.0-rc1.js').'"></script>';
}
$output .= '
<script type="text/javascript">
var phpTimezone = "'.date_default_timezone_get().'";
var configHomeurl = "'.$config['homeurl'].'";
</script>';
// NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area
$output .= '
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/excanvas.js').'"></script><![endif]-->
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/javascript/timezone/src/date.js').'"></script>
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/jquery.flot.min.js').'"></script>
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/jquery.flot.time.js').'"></script>
<script language="javascript" type="text/javascript" src="'.ui_get_full_url($metaconsole_hack.'/include/graphs/flot/jquery.flot.pie.js').'"></script>

@ -784,8 +784,8 @@ function loadVisualConsoleData(
page: "include/rest-api/index",
getVisualConsole: 1,
visualConsoleId: vcId,
id_user: typeof id_user == undefined ? id_user : null,
auth_hash: typeof hash == undefined ? hash : null
id_user: typeof id_user !== undefined ? id_user : null,
auth_hash: typeof hash !== undefined ? hash : null
},
"json"
)

File diff suppressed because it is too large Load Diff

@ -0,0 +1,97 @@
# Contributing to the tz code and data
Please do not create issues or pull requests on GitHub, as the
proper procedure for proposing and distributing patches is via
email as described below.
The time zone database is by no means authoritative: governments
change timekeeping rules erratically and sometimes with little
warning, the data entries do not cover all of civil time before
1970, and undoubtedly errors remain in the code and data. Feel
free to fill gaps or fix mistakes, and please email improvements
to <tz@iana.org> for use in the future. In your email, please give
reliable sources that reviewers can check.
## Contributing technical changes
To email small changes, please run a POSIX shell command like
'diff -u old/europe new/europe >myfix.patch', and attach
'myfix.patch' to the email.
For more-elaborate or possibly controversial changes,
such as renaming, adding or removing zones, please read
"Theory and pragmatics of the tz code and data"
<https://www.iana.org/time-zones/repository/theory.html>.
It is also good to browse the mailing list archives
<https://mm.icann.org/pipermail/tz/> for examples of patches that tend
to work well. Additions to data should contain commentary citing
reliable sources as justification. Citations should use "https:" URLs
if available.
For changes that fix sensitive security-related bugs, please see the
distribution's 'SECURITY' file.
Please submit changes against either the latest release
<https://www.iana.org/time-zones> or the main branch of the development
repository. The latter is preferred.
## Sample Git workflow for developing contributions
If you use Git the following workflow may be helpful:
* Copy the development repository.
git clone https://github.com/eggert/tz.git
cd tz
* Get current with the main branch.
git checkout main
git pull
* Switch to a new branch for the changes. Choose a different
branch name for each change set.
git checkout -b mybranch
* Sleuth by using 'git blame'. For example, when fixing data for
Africa/Sao_Tome, if the command 'git blame africa' outputs a line
'2951fa3b (Paul Eggert 2018-01-08 09:03:13 -0800 1068) Zone
Africa/Sao_Tome 0:26:56 - LMT 1884', commit 2951fa3b should
provide some justification for the 'Zone Africa/Sao_Tome' line.
* Edit source files. Include commentary that justifies the
changes by citing reliable sources.
* Debug the changes, e.g.:
make check
make install
./zdump -v America/Los_Angeles
* For each separable change, commit it in the new branch, e.g.:
git add northamerica
git commit
See recent 'git log' output for the commit-message style.
* Create patch files 0001-..., 0002-..., ...
git format-patch main
* After reviewing the patch files, send the patches to <tz@iana.org>
for others to review.
git send-email main
For an archived example of such an email, see
"[PROPOSED] Fix off-by-1 error for Jamaica and T&C before 1913"
<https://mm.icann.org/pipermail/tz/2018-February/026122.html>.
* Start anew by getting current with the main branch again
(the second step above).
-----
This file is in the public domain.

@ -0,0 +1,5 @@
Unless specified below, all files in the tz code and data (including
this LICENSE file) are in the public domain.
If the files date.c, newstrftime.3, and strftime.c are present, they
contain material derived from BSD and use the BSD 3-clause license.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,52 @@
README for the tz distribution
"Where do I set the hands of the clock?" -- Les Tremayne as The King
"Oh that--you can set them any place you want." -- Frank Baxter as The Scientist
(from the Bell System film "About Time")
The Time Zone Database (called tz, tzdb or zoneinfo) contains code and
data that represent the history of local time for many representative
locations around the globe. It is updated periodically to reflect
changes made by political bodies to time zone boundaries, UTC offsets,
and daylight-saving rules.
See <https://www.iana.org/time-zones/repository/tz-link.html> or the
file tz-link.html for how to acquire the code and data. Once acquired,
read the comments in the file 'Makefile' and make any changes needed
to make things right for your system, especially if you are using some
platform other than GNU/Linux. Then run the following commands,
substituting your desired installation directory for "$HOME/tzdir":
make TOPDIR=$HOME/tzdir install
$HOME/tzdir/usr/bin/zdump -v America/Los_Angeles
See the file tz-how-to.html for examples of how to read the data files.
This database of historical local time information has several goals:
* Provide a compendium of data about the history of civil time that
is useful even if not 100% accurate.
* Give an idea of the variety of local time rules that have existed
in the past and thus may be expected in the future.
* Test the generality of the local time rule description system.
The information in the time zone data files is by no means authoritative;
fixes and enhancements are welcome. Please see the file CONTRIBUTING
for details.
Thanks to these Time Zone Caballeros who've made major contributions to the
time conversion package: Keith Bostic; Bob Devine; Paul Eggert; Robert Elz;
Guy Harris; Mark Horton; John Mackin; and Bradley White. Thanks also to
Michael Bloom, Art Neilson, Stephen Prince, John Sovereign, and Frank Wales
for testing work, and to Gwillim Law for checking local mean time data.
Thanks in particular to Arthur David Olson, the project's founder and first
maintainer, to whom the time zone community owes the greatest debt of all.
None of them are responsible for remaining errors.
-----
This file is in the public domain, so clarified as of 2009-05-17 by
Arthur David Olson. The other files in this distribution are either
public domain or BSD licensed; see the file LICENSE for details.

@ -0,0 +1,15 @@
Please report any sensitive security-related bugs via email to the
tzdb designated coordinators, currently Paul Eggert
<eggert@cs.ucla.edu> and Tim Parenti <tim@timtimeonline.com>.
Put "tzdb security" at the start of your email's subject line.
We prefer communications to be in English.
You should receive a response within a week. If not, please follow up
via email to make sure we received your original message.
If we confirm the bug, we plan to notify affected third-party services
or software that we know about, prepare an advisory, commit fixes to
the main development branch as quickly as is practical, and finally
publish the advisory on tz@iana.org. As with all tzdb contributions,
we give credit to security contributors unless they wish to remain
anonymous.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,309 @@
# tzdb data for Antarctica and environs
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# From Paul Eggert (1999-11-15):
# To keep things manageable, we list only locations occupied year-round; see
# COMNAP - Stations and Bases
# http://www.comnap.aq/comnap/comnap.nsf/P/Stations/
# and
# Summary of the Peri-Antarctic Islands (1998-07-23)
# http://www.spri.cam.ac.uk/bob/periant.htm
# for information.
# Unless otherwise specified, we have no time zone information.
# FORMAT is '-00' and STDOFF is 0 for locations while uninhabited.
# Argentina - year-round bases
# Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
# Carlini, Potter Cove, King George Island, -6414-0602320, since 1982-01
# Esperanza, Hope Bay, -6323-05659, since 1952-12-17
# Marambio, -6414-05637, since 1969-10-29
# Orcadas, Laurie I, -6016-04444, since 1904-02-22
# San Martín, Barry I, -6808-06706, since 1951-03-21
# (except 1960-03 / 1976-03-21)
# Australia - territories
# Heard Island, McDonald Islands (uninhabited)
# previously sealers and scientific personnel wintered
# Margaret Turner reports
# https://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
# (1999-09-30) that they're UT +05, with no DST;
# presumably this is when they have visitors.
#
# year-round bases
# Casey, Bailey Peninsula, -6617+11032, since 1969
# Davis, Vestfold Hills, -6835+07759, since 1957-01-13
# (except 1964-11 - 1969-02)
# Mawson, Holme Bay, -6736+06253, since 1954-02-13
# From Steffen Thorsen (2009-03-11):
# Three Australian stations in Antarctica have changed their time zone:
# Casey moved from UTC+8 to UTC+11
# Davis moved from UTC+7 to UTC+5
# Mawson moved from UTC+6 to UTC+5
# The changes occurred on 2009-10-18 at 02:00 (local times).
#
# Government source: (Australian Antarctic Division)
# http://www.aad.gov.au/default.asp?casid=37079
#
# We have more background information here:
# https://www.timeanddate.com/news/time/antarctica-new-times.html
# From Steffen Thorsen (2010-03-10):
# We got these changes from the Australian Antarctic Division: ...
#
# - Casey station reverted to its normal time of UTC+8 on 5 March 2010.
# The change to UTC+11 is being considered as a regular summer thing but
# has not been decided yet.
#
# - Davis station will revert to its normal time of UTC+7 at 10 March 2010
# 20:00 UTC.
#
# - Mawson station stays on UTC+5.
#
# Background:
# https://www.timeanddate.com/news/time/antartica-time-changes-2010.html
# From Steffen Thorsen (2016-10-28):
# Australian Antarctica Division informed us that Casey changed time
# zone to UTC+11 in "the morning of 22nd October 2016".
# From Steffen Thorsen (2020-10-02, as corrected):
# Based on information we have received from the Australian Antarctic
# Division, Casey station and Macquarie Island station will move to Tasmanian
# daylight savings time on Sunday 4 October. This will take effect from 0001
# hrs on Sunday 4 October 2020 and will mean Casey and Macquarie Island will
# be on the same time zone as Hobart. Some past dates too for this 3 hour
# time change back and forth between UTC+8 and UTC+11 for Casey:
# - 2018 Oct 7 4:00 - 2019 Mar 17 3:00 - 2019 Oct 4 3:00 - 2020 Mar 8 3:00
# and now - 2020 Oct 4 0:01
# Zone NAME STDOFF RULES FORMAT [UNTIL]
Zone Antarctica/Casey 0 - -00 1969
8:00 - +08 2009 Oct 18 2:00
11:00 - +11 2010 Mar 5 2:00
8:00 - +08 2011 Oct 28 2:00
11:00 - +11 2012 Feb 21 17:00u
8:00 - +08 2016 Oct 22
11:00 - +11 2018 Mar 11 4:00
8:00 - +08 2018 Oct 7 4:00
11:00 - +11 2019 Mar 17 3:00
8:00 - +08 2019 Oct 4 3:00
11:00 - +11 2020 Mar 8 3:00
8:00 - +08 2020 Oct 4 0:01
11:00 - +11
Zone Antarctica/Davis 0 - -00 1957 Jan 13
7:00 - +07 1964 Nov
0 - -00 1969 Feb
7:00 - +07 2009 Oct 18 2:00
5:00 - +05 2010 Mar 10 20:00u
7:00 - +07 2011 Oct 28 2:00
5:00 - +05 2012 Feb 21 20:00u
7:00 - +07
Zone Antarctica/Mawson 0 - -00 1954 Feb 13
6:00 - +06 2009 Oct 18 2:00
5:00 - +05
# References:
# Casey Weather (1998-02-26)
# http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html
# Davis Station, Antarctica (1998-02-26)
# http://www.antdiv.gov.au/aad/exop/sfo/davis/video.html
# Mawson Station, Antarctica (1998-02-25)
# http://www.antdiv.gov.au/aad/exop/sfo/mawson/video.html
# Belgium - year-round base
# Princess Elisabeth, Queen Maud Land, -713412+0231200, since 2007
# Brazil - year-round base
# Ferraz, King George Island, -6205+05824, since 1983/4
# Bulgaria - year-round base
# St. Kliment Ohridski, Livingston Island, -623829-0602153, since 1988
# Chile - year-round bases and towns
# Escudero, South Shetland Is, -621157-0585735, since 1994
# Frei Montalva, King George Island, -6214-05848, since 1969-03-07
# O'Higgins, Antarctic Peninsula, -6319-05704, since 1948-02
# Prat, -6230-05941
# Villa Las Estrellas (a town), around the Frei base, since 1984-04-09
# These locations employ Region of Magallanes time; use
# TZ='America/Punta_Arenas'.
# China - year-round bases
# Great Wall, King George Island, -6213-05858, since 1985-02-20
# Zhongshan, Larsemann Hills, Prydz Bay, -6922+07623, since 1989-02-26
# France - year-round bases (also see "France & Italy")
#
# From Antoine Leca (1997-01-20):
# Time data entries are from Nicole Pailleau at the IFRTP
# (French Institute for Polar Research and Technology).
# She confirms that French Southern Territories and Terre Adélie bases
# don't observe daylight saving time, even if Terre Adélie supplies came
# from Tasmania.
#
# French Southern Territories with year-round inhabitants
#
# Alfred Faure, Possession Island, Crozet Islands, -462551+0515152, since 1964;
# sealing & whaling stations operated variously 1802/1911+;
# see Asia/Dubai.
#
# Martin-de-Viviès, Amsterdam Island, -374105+0773155, since 1950
# Port-aux-Français, Kerguelen Islands, -492110+0701303, since 1951;
# whaling & sealing station operated 1908/1914, 1920/1929, and 1951/1956
#
# St Paul Island - near Amsterdam, uninhabited
# fishing stations operated variously 1819/1931
#
# Kerguelen - see Indian/Maldives.
#
# year-round base in the main continent
# Dumont d'Urville - see Pacific/Port_Moresby.
# France & Italy - year-round base
# Concordia, -750600+1232000, since 2005
# Germany - year-round base
# Neumayer III, -704080-0081602, since 2009
# India - year-round bases
# Bharati, -692428+0761114, since 2012
# Maitri, -704558+0114356, since 1989
# Italy - year-round base (also see "France & Italy")
# Zuchelli, Terra Nova Bay, -744140+1640647, since 1986
# Japan - year-round bases
# See Asia/Riyadh.
# S Korea - year-round base
# Jang Bogo, Terra Nova Bay, -743700+1641205 since 2014
# King Sejong, King George Island, -6213-05847, since 1988
# New Zealand - claims
# Balleny Islands (never inhabited)
# Scott Island (never inhabited)
#
# year-round base
# Scott Base, Ross Island, since 1957-01.
# See Pacific/Auckland.
# Norway - territories
# Bouvet (never inhabited)
#
# claims
# Peter I Island (never inhabited)
#
# year-round base
# Troll, Queen Maud Land, -720041+0023206, since 2005-02-12
#
# From Paul-Inge Flakstad (2014-03-10):
# I recently had a long dialog about this with the developer of timegenie.com.
# In the absence of specific dates, he decided to choose some likely ones:
# GMT +1 - From March 1 to the last Sunday in March
# GMT +2 - From the last Sunday in March until the last Sunday in October
# GMT +1 - From the last Sunday in October until November 7
# GMT +0 - From November 7 until March 1
# The dates for switching to and from UTC+0 will probably not be absolutely
# correct, but they should be quite close to the actual dates.
#
# From Paul Eggert (2014-03-21):
# The CET-switching Troll rules require zic from tz 2014b or later, so as
# suggested by Bengt-Inge Larsson comment them out for now, and approximate
# with only UTC and CEST. Uncomment them when 2014b is more prevalent.
#
# Rule NAME FROM TO - IN ON AT SAVE LETTER/S
#Rule Troll 2005 max - Mar 1 1:00u 1:00 +01
Rule Troll 2005 max - Mar lastSun 1:00u 2:00 +02
#Rule Troll 2005 max - Oct lastSun 1:00u 1:00 +01
#Rule Troll 2004 max - Nov 7 1:00u 0:00 +00
# Remove the following line when uncommenting the above '#Rule' lines.
Rule Troll 2004 max - Oct lastSun 1:00u 0:00 +00
# Zone NAME STDOFF RULES FORMAT [UNTIL]
Zone Antarctica/Troll 0 - -00 2005 Feb 12
0:00 Troll %s
# Poland - year-round base
# Arctowski, King George Island, -620945-0582745, since 1977
# Romania - year-bound base
# Law-Racoviță, Larsemann Hills, -692319+0762251, since 1986
# Russia - year-round bases
# Bellingshausen, King George Island, -621159-0585337, since 1968-02-22
# Mirny, Davis coast, -6633+09301, since 1956-02
# Molodezhnaya, Alasheyev Bay, -6740+04551,
# year-round from 1962-02 to 1999-07-01
# Novolazarevskaya, Queen Maud Land, -7046+01150,
# year-round from 1960/61 to 1992
# Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11
# See Asia/Urumqi.
# S Africa - year-round bases
# Marion Island, -4653+03752
# SANAE IV, Vesleskarvet, Queen Maud Land, -714022-0025026, since 1997
# Ukraine - year-round base
# Vernadsky (formerly Faraday), Galindez Island, -651445-0641526, since 1954
# United Kingdom
#
# British Antarctic Territories (BAT) claims
# South Orkney Islands
# scientific station from 1903
# whaling station at Signy I 1920/1926
# South Shetland Islands
#
# year-round bases
# Bird Island, South Georgia, -5400-03803, since 1983
# Deception Island, -6259-06034, whaling station 1912/1931,
# scientific station 1943/1967,
# previously sealers and a scientific expedition wintered by accident,
# and a garrison was deployed briefly
# Halley, Coates Land, -7535-02604, since 1956-01-06
# Halley is on a moving ice shelf and is periodically relocated
# so that it is never more than 10km from its nominal location.
# Rothera, Adelaide Island, -6734-6808, since 1976-12-01
#
# From Paul Eggert (2002-10-22)
# <http://webexhibits.org/daylightsaving/g.html> says Rothera is -03 all year.
#
# Zone NAME STDOFF RULES FORMAT [UNTIL]
Zone Antarctica/Rothera 0 - -00 1976 Dec 1
-3:00 - -03
# Uruguay - year round base
# Artigas, King George Island, -621104-0585107
# USA - year-round bases
#
# Palmer, Anvers Island, since 1965 (moved 2 miles in 1968)
# See 'southamerica' for Antarctica/Palmer, since it uses South American DST.
#
# McMurdo Station, Ross Island, since 1955-12
# Amundsen-Scott South Pole Station, continuously occupied since 1956-11-20
#
# From Chris Carrier (1996-06-27):
# Siple, the first commander of the South Pole station,
# stated that he would have liked to have kept GMT at the station,
# but that he found it more convenient to keep GMT+12
# as supplies for the station were coming from McMurdo Sound,
# which was on GMT+12 because New Zealand was on GMT+12 all year
# at that time (1957). (Source: Siple's book 90° South.)
#
# From Susan Smith
# http://www.cybertours.com/whs/pole10.html
# (1995-11-13 16:24:56 +1300, no longer available):
# We use the same time as McMurdo does.
# And they use the same time as Christchurch, NZ does....
# One last quirk about South Pole time.
# All the electric clocks are usually wrong.
# Something about the generators running at 60.1hertz or something
# makes all of the clocks run fast. So every couple of days,
# we have to go around and set them back 5 minutes or so.
# Maybe if we let them run fast all of the time, we'd get to leave here sooner!!
#
# See Pacific/Auckland.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,319 @@
# tzdb links for backward compatibility
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This file provides links from old or merged timezone names to current ones.
# Many names changed in 1993 and in 1995, and many merged names moved here
# in the period from 2013 through 2022. Several of these names are
# also present in the file 'backzone', which has data important only
# for pre-1970 timestamps and so is out of scope for tzdb proper.
# Although this file is optional and tzdb will work if you omit it by
# building with 'make BACKWARD=', in practice downstream users
# typically use this file for backward compatibility.
# This file is divided into sections, one for each major reason for a
# backward compatibility link. Each section is sorted by link name.
# A "#= TARGET1" comment labels each link inserted only because some
# .zi parsers (including tzcode through 2022e) mishandle links to links.
# The comment says what the target would be if these parsers were fixed
# so that data could contain links to links. For example, the line
# "Link Australia/Sydney Australia/ACT #= Australia/Canberra" would be
# "Link Australia/Canberra Australia/ACT" were it not that data lines
# refrain from linking to links like Australia/Canberra, which means
# the Australia/ACT line links instead to Australia/Sydney,
# Australia/Canberra's target.
# Pre-1993 naming conventions
# Link TARGET LINK-NAME #= TARGET1
Link Australia/Sydney Australia/ACT #= Australia/Canberra
Link Australia/Lord_Howe Australia/LHI
Link Australia/Sydney Australia/NSW
Link Australia/Darwin Australia/North
Link Australia/Brisbane Australia/Queensland
Link Australia/Adelaide Australia/South
Link Australia/Hobart Australia/Tasmania
Link Australia/Melbourne Australia/Victoria
Link Australia/Perth Australia/West
Link Australia/Broken_Hill Australia/Yancowinna
Link America/Rio_Branco Brazil/Acre #= America/Porto_Acre
Link America/Noronha Brazil/DeNoronha
Link America/Sao_Paulo Brazil/East
Link America/Manaus Brazil/West
Link America/Halifax Canada/Atlantic
Link America/Winnipeg Canada/Central
# This line is commented out, as the name exceeded the 14-character limit
# and was an unused misnomer.
#Link America/Regina Canada/East-Saskatchewan
Link America/Toronto Canada/Eastern
Link America/Edmonton Canada/Mountain
Link America/St_Johns Canada/Newfoundland
Link America/Vancouver Canada/Pacific
Link America/Regina Canada/Saskatchewan
Link America/Whitehorse Canada/Yukon
Link America/Santiago Chile/Continental
Link Pacific/Easter Chile/EasterIsland
Link America/Havana Cuba
Link Africa/Cairo Egypt
Link Europe/Dublin Eire
# Vanguard section, for most .zi parsers.
#Link GMT Etc/GMT
#Link GMT Etc/GMT+0
#Link GMT Etc/GMT-0
#Link GMT Etc/GMT0
#Link GMT Etc/Greenwich
# Rearguard section, for TZUpdater 2.3.2 and earlier.
Link Etc/GMT Etc/GMT+0
Link Etc/GMT Etc/GMT-0
Link Etc/GMT Etc/GMT0
Link Etc/GMT Etc/Greenwich
# End of rearguard section.
Link Etc/UTC Etc/UCT
Link Etc/UTC Etc/Universal
Link Etc/UTC Etc/Zulu
Link Europe/London GB
Link Europe/London GB-Eire
# Vanguard section, for most .zi parsers.
#Link GMT GMT+0
#Link GMT GMT-0
#Link GMT GMT0
#Link GMT Greenwich
# Rearguard section, for TZUpdater 2.3.2 and earlier.
Link Etc/GMT GMT+0
Link Etc/GMT GMT-0
Link Etc/GMT GMT0
Link Etc/GMT Greenwich
# End of rearguard section.
Link Asia/Hong_Kong Hongkong
Link Africa/Abidjan Iceland #= Atlantic/Reykjavik
Link Asia/Tehran Iran
Link Asia/Jerusalem Israel
Link America/Jamaica Jamaica
Link Asia/Tokyo Japan
Link Pacific/Kwajalein Kwajalein
Link Africa/Tripoli Libya
Link America/Tijuana Mexico/BajaNorte
Link America/Mazatlan Mexico/BajaSur
Link America/Mexico_City Mexico/General
Link Pacific/Auckland NZ
Link Pacific/Chatham NZ-CHAT
Link America/Denver Navajo #= America/Shiprock
Link Asia/Shanghai PRC
Link Europe/Warsaw Poland
Link Europe/Lisbon Portugal
Link Asia/Taipei ROC
Link Asia/Seoul ROK
Link Asia/Singapore Singapore
Link Europe/Istanbul Turkey
Link Etc/UTC UCT
Link America/Anchorage US/Alaska
Link America/Adak US/Aleutian
Link America/Phoenix US/Arizona
Link America/Chicago US/Central
Link America/Indiana/Indianapolis US/East-Indiana
Link America/New_York US/Eastern
Link Pacific/Honolulu US/Hawaii
Link America/Indiana/Knox US/Indiana-Starke
Link America/Detroit US/Michigan
Link America/Denver US/Mountain
Link America/Los_Angeles US/Pacific
Link Pacific/Pago_Pago US/Samoa
Link Etc/UTC UTC
Link Etc/UTC Universal
Link Europe/Moscow W-SU
Link Etc/UTC Zulu
# Two-part names that were renamed mostly to three-part names in 1995
# Link TARGET LINK-NAME #= TARGET1
Link America/Argentina/Buenos_Aires America/Buenos_Aires
Link America/Argentina/Catamarca America/Catamarca
Link America/Argentina/Cordoba America/Cordoba
Link America/Indiana/Indianapolis America/Indianapolis
Link America/Argentina/Jujuy America/Jujuy
Link America/Indiana/Knox America/Knox_IN
Link America/Kentucky/Louisville America/Louisville
Link America/Argentina/Mendoza America/Mendoza
Link America/Puerto_Rico America/Virgin #= America/St_Thomas
Link Pacific/Pago_Pago Pacific/Samoa
# Pre-2013 practice, which typically had a Zone per zone.tab line
# Link TARGET LINK-NAME
Link Africa/Abidjan Africa/Accra
Link Africa/Nairobi Africa/Addis_Ababa
Link Africa/Nairobi Africa/Asmara
Link Africa/Abidjan Africa/Bamako
Link Africa/Lagos Africa/Bangui
Link Africa/Abidjan Africa/Banjul
Link Africa/Maputo Africa/Blantyre
Link Africa/Lagos Africa/Brazzaville
Link Africa/Maputo Africa/Bujumbura
Link Africa/Abidjan Africa/Conakry
Link Africa/Abidjan Africa/Dakar
Link Africa/Nairobi Africa/Dar_es_Salaam
Link Africa/Nairobi Africa/Djibouti
Link Africa/Lagos Africa/Douala
Link Africa/Abidjan Africa/Freetown
Link Africa/Maputo Africa/Gaborone
Link Africa/Maputo Africa/Harare
Link Africa/Nairobi Africa/Kampala
Link Africa/Maputo Africa/Kigali
Link Africa/Lagos Africa/Kinshasa
Link Africa/Lagos Africa/Libreville
Link Africa/Abidjan Africa/Lome
Link Africa/Lagos Africa/Luanda
Link Africa/Maputo Africa/Lubumbashi
Link Africa/Maputo Africa/Lusaka
Link Africa/Lagos Africa/Malabo
Link Africa/Johannesburg Africa/Maseru
Link Africa/Johannesburg Africa/Mbabane
Link Africa/Nairobi Africa/Mogadishu
Link Africa/Lagos Africa/Niamey
Link Africa/Abidjan Africa/Nouakchott
Link Africa/Abidjan Africa/Ouagadougou
Link Africa/Lagos Africa/Porto-Novo
Link America/Puerto_Rico America/Anguilla
Link America/Puerto_Rico America/Antigua
Link America/Puerto_Rico America/Aruba
Link America/Panama America/Atikokan
Link America/Puerto_Rico America/Blanc-Sablon
Link America/Panama America/Cayman
Link America/Phoenix America/Creston
Link America/Puerto_Rico America/Curacao
Link America/Puerto_Rico America/Dominica
Link America/Puerto_Rico America/Grenada
Link America/Puerto_Rico America/Guadeloupe
Link America/Puerto_Rico America/Kralendijk
Link America/Puerto_Rico America/Lower_Princes
Link America/Puerto_Rico America/Marigot
Link America/Puerto_Rico America/Montserrat
Link America/Toronto America/Nassau
Link America/Puerto_Rico America/Port_of_Spain
Link America/Puerto_Rico America/St_Barthelemy
Link America/Puerto_Rico America/St_Kitts
Link America/Puerto_Rico America/St_Lucia
Link America/Puerto_Rico America/St_Thomas
Link America/Puerto_Rico America/St_Vincent
Link America/Puerto_Rico America/Tortola
Link Pacific/Port_Moresby Antarctica/DumontDUrville
Link Pacific/Auckland Antarctica/McMurdo
Link Asia/Riyadh Antarctica/Syowa
Link Asia/Urumqi Antarctica/Vostok
Link Europe/Berlin Arctic/Longyearbyen
Link Asia/Riyadh Asia/Aden
Link Asia/Qatar Asia/Bahrain
Link Asia/Kuching Asia/Brunei
Link Asia/Singapore Asia/Kuala_Lumpur
Link Asia/Riyadh Asia/Kuwait
Link Asia/Dubai Asia/Muscat
Link Asia/Bangkok Asia/Phnom_Penh
Link Asia/Bangkok Asia/Vientiane
Link Africa/Abidjan Atlantic/Reykjavik
Link Africa/Abidjan Atlantic/St_Helena
Link Europe/Brussels Europe/Amsterdam
Link Europe/Prague Europe/Bratislava
Link Europe/Zurich Europe/Busingen
Link Europe/Berlin Europe/Copenhagen
Link Europe/London Europe/Guernsey
Link Europe/London Europe/Isle_of_Man
Link Europe/London Europe/Jersey
Link Europe/Belgrade Europe/Ljubljana
Link Europe/Brussels Europe/Luxembourg
Link Europe/Helsinki Europe/Mariehamn
Link Europe/Paris Europe/Monaco
Link Europe/Berlin Europe/Oslo
Link Europe/Belgrade Europe/Podgorica
Link Europe/Rome Europe/San_Marino
Link Europe/Belgrade Europe/Sarajevo
Link Europe/Belgrade Europe/Skopje
Link Europe/Berlin Europe/Stockholm
Link Europe/Zurich Europe/Vaduz
Link Europe/Rome Europe/Vatican
Link Europe/Belgrade Europe/Zagreb
Link Africa/Nairobi Indian/Antananarivo
Link Asia/Bangkok Indian/Christmas
Link Asia/Yangon Indian/Cocos
Link Africa/Nairobi Indian/Comoro
Link Indian/Maldives Indian/Kerguelen
Link Asia/Dubai Indian/Mahe
Link Africa/Nairobi Indian/Mayotte
Link Asia/Dubai Indian/Reunion
Link Pacific/Port_Moresby Pacific/Chuuk
Link Pacific/Tarawa Pacific/Funafuti
Link Pacific/Tarawa Pacific/Majuro
Link Pacific/Pago_Pago Pacific/Midway
Link Pacific/Guadalcanal Pacific/Pohnpei
Link Pacific/Guam Pacific/Saipan
Link Pacific/Tarawa Pacific/Wake
Link Pacific/Tarawa Pacific/Wallis
# Non-zone.tab locations with timestamps since 1970 that duplicate
# those of an existing location
# Link TARGET LINK-NAME
Link Africa/Abidjan Africa/Timbuktu
Link America/Argentina/Catamarca America/Argentina/ComodRivadavia
Link America/Adak America/Atka
Link America/Panama America/Coral_Harbour
Link America/Tijuana America/Ensenada
Link America/Indiana/Indianapolis America/Fort_Wayne
Link America/Toronto America/Montreal
Link America/Toronto America/Nipigon
Link America/Iqaluit America/Pangnirtung
Link America/Rio_Branco America/Porto_Acre
Link America/Winnipeg America/Rainy_River
Link America/Argentina/Cordoba America/Rosario
Link America/Tijuana America/Santa_Isabel
Link America/Denver America/Shiprock
Link America/Toronto America/Thunder_Bay
Link America/Edmonton America/Yellowknife
Link Pacific/Auckland Antarctica/South_Pole
Link Asia/Shanghai Asia/Chongqing
Link Asia/Shanghai Asia/Harbin
Link Asia/Urumqi Asia/Kashgar
Link Asia/Jerusalem Asia/Tel_Aviv
Link Europe/Berlin Atlantic/Jan_Mayen
Link Australia/Sydney Australia/Canberra
Link Australia/Hobart Australia/Currie
Link Europe/London Europe/Belfast
Link Europe/Chisinau Europe/Tiraspol
Link Europe/Kyiv Europe/Uzhgorod
Link Europe/Kyiv Europe/Zaporozhye
Link Pacific/Kanton Pacific/Enderbury
Link Pacific/Honolulu Pacific/Johnston
Link Pacific/Port_Moresby Pacific/Yap
# Alternate names for the same location
# Link TARGET LINK-NAME #= TARGET1
Link Africa/Nairobi Africa/Asmera #= Africa/Asmara
Link America/Nuuk America/Godthab
Link Asia/Ashgabat Asia/Ashkhabad
Link Asia/Kolkata Asia/Calcutta
Link Asia/Shanghai Asia/Chungking #= Asia/Chongqing
Link Asia/Dhaka Asia/Dacca
# Istanbul is in both continents.
Link Europe/Istanbul Asia/Istanbul
Link Asia/Kathmandu Asia/Katmandu
Link Asia/Macau Asia/Macao
Link Asia/Yangon Asia/Rangoon
Link Asia/Ho_Chi_Minh Asia/Saigon
Link Asia/Thimphu Asia/Thimbu
Link Asia/Makassar Asia/Ujung_Pandang
Link Asia/Ulaanbaatar Asia/Ulan_Bator
Link Atlantic/Faroe Atlantic/Faeroe
Link Europe/Kyiv Europe/Kiev
# Classically, Cyprus is in Asia; e.g. see Herodotus, Histories, I.72.
# However, for various reasons many users expect to find it under Europe.
Link Asia/Nicosia Europe/Nicosia
Link Pacific/Guadalcanal Pacific/Ponape #= Pacific/Pohnpei
Link Pacific/Port_Moresby Pacific/Truk #= Pacific/Chuuk

File diff suppressed because it is too large Load Diff

@ -0,0 +1,173 @@
----- Calendrical issues -----
As mentioned in Theory.html, although calendrical issues are out of
scope for tzdb, they indicate the sort of problems that we would run
into if we extended tzdb further into the past. The following
information and sources go beyond Theory.html's brief discussion.
They sometimes disagree.
France
Gregorian calendar adopted 1582-12-20.
French Revolutionary calendar used 1793-11-24 through 1805-12-31,
and (in Paris only) 1871-05-06 through 1871-05-23.
Russia
From Chris Carrier (1996-12-02):
On 1929-10-01 the Soviet Union instituted an "Eternal Calendar"
with 30-day months plus 5 holidays, with a 5-day week.
On 1931-12-01 it changed to a 6-day week; in 1934 it reverted to the
Gregorian calendar while retaining the 6-day week; on 1940-06-27 it
reverted to the 7-day week. With the 6-day week the usual days
off were the 6th, 12th, 18th, 24th and 30th of the month.
(Source: Evitiar Zerubavel, _The Seven Day Circle_)
Mark Brader reported a similar story in "The Book of Calendars", edited
by Frank Parise (1982, Facts on File, ISBN 0-8719-6467-8), page 377. But:
From: Petteri Sulonen (via Usenet)
Date: 14 Jan 1999 00:00:00 GMT
...
If your source is correct, how come documents between 1929 and 1940 were
still dated using the conventional, Gregorian calendar?
I can post a scan of a document dated December 1, 1934, signed by
Yenukidze, the secretary, on behalf of Kalinin, the President of the
Executive Committee of the Supreme Soviet, if you like.
Sweden (and Finland)
From: Mark Brader
Subject: Re: Gregorian reform - a part of locale?
<news:1996Jul6.012937.29190@sq.com>
Date: 1996-07-06
In 1700, Denmark made the transition from Julian to Gregorian. Sweden
decided to *start* a transition in 1700 as well, but rather than have one of
those unsightly calendar gaps :-), they simply decreed that the next leap
year after 1696 would be in 1744 - putting the whole country on a calendar
different from both Julian and Gregorian for a period of 40 years.
However, in 1704 something went wrong and the plan was not carried through;
they did, after all, have a leap year that year. And one in 1708. In 1712
they gave it up and went back to Julian, putting 30 days in February that
year!...
Then in 1753, Sweden made the transition to Gregorian in the usual manner,
getting there only 13 years behind the original schedule.
(A previous posting of this story was challenged, and Swedish readers
produced the following references to support it: "Tideräkning och historia"
by Natanael Beckman (1924) and "Tid, en bok om tideräkning och
kalenderväsen" by Lars-Olof Lodén (1968).
Grotefend's data
From: "Michael Palmer" [with two obvious typos fixed]
Subject: Re: Gregorian Calendar (was Re: Another FHC related question
Newsgroups: soc.genealogy.german
Date: Tue, 9 Feb 1999 02:32:48 -800
...
The following is a(n incomplete) listing, arranged chronologically, of
European states, with the date they converted from the Julian to the
Gregorian calendar:
04/15 Oct 1582 - Italy (with exceptions), Spain, Portugal, Poland (Roman
Catholics and Danzig only)
09/20 Dec 1582 - France, Lorraine
21 Dec 1582/
01 Jan 1583 - Holland, Brabant, Flanders, Hennegau
10/21 Feb 1583 - bishopric of Liege (Lüttich)
13/24 Feb 1583 - bishopric of Augsburg
04/15 Oct 1583 - electorate of Trier
05/16 Oct 1583 - Bavaria, bishoprics of Freising, Eichstedt, Regensburg,
Salzburg, Brixen
13/24 Oct 1583 - Austrian Oberelsaß and Breisgau
20/31 Oct 1583 - bishopric of Basel
02/13 Nov 1583 - duchy of Jülich-Berg
02/13 Nov 1583 - electorate and city of Köln
04/15 Nov 1583 - bishopric of Würzburg
11/22 Nov 1583 - electorate of Mainz
16/27 Nov 1583 - bishopric of Strassburg and the margraviate of Baden
17/28 Nov 1583 - bishopric of Münster and duchy of Cleve
14/25 Dec 1583 - Steiermark
06/17 Jan 1584 - Austria and Bohemia
11/22 Jan 1584 - Lucerne, Uri, Schwyz, Zug, Freiburg, Solothurn
12/23 Jan 1584 - Silesia and the Lausitz
22 Jan/
02 Feb 1584 - Hungary (legally on 21 Oct 1587)
Jun 1584 - Unterwalden
01/12 Jul 1584 - duchy of Westfalen
16/27 Jun 1585 - bishopric of Paderborn
14/25 Dec 1590 - Transylvania
22 Aug/
02 Sep 1612 - duchy of Prussia
13/24 Dec 1614 - Pfalz-Neuburg
1617 - duchy of Kurland (reverted to the Julian calendar in
1796)
1624 - bishopric of Osnabrück
1630 - bishopric of Minden
15/26 Mar 1631 - bishopric of Hildesheim
1655 - Kanton Wallis
05/16 Feb 1682 - city of Strassburg
18 Feb/
01 Mar 1700 - Protestant Germany (including Swedish possessions in
Germany), Denmark, Norway
30 Jun/
12 Jul 1700 - Gelderland, Zutphen
10 Nov/
12 Dec 1700 - Utrecht, Overijssel
31 Dec 1700/
12 Jan 1701 - Friesland, Groningen, Zürich, Bern, Basel, Geneva,
Thurgau, and Schaffhausen
1724 - Glarus, Appenzell, and the city of St. Gallen
01 Jan 1750 - Pisa and Florence
02/14 Sep 1752 - Great Britain
17 Feb/
01 Mar 1753 - Sweden
1760-1812 - Graubünden
The Russian empire (including Finland and the Baltic states) did not
convert to the Gregorian calendar until the Soviet revolution of 1917.
Source: H. Grotefend, _Taschenbuch der Zeitrechnung des deutschen
Mittelalters und der Neuzeit_, herausgegeben von Dr. O. Grotefend
(Hannover: Hahnsche Buchhandlung, 1941), pp. 26-28.
-----
This file is in the public domain, so clarified as of 2009-05-17 by
Arthur David Olson.
-----
Local Variables:
coding: utf-8
End:

@ -0,0 +1,70 @@
# Check links in tz tables.
# Contributed by Paul Eggert. This file is in the public domain.
BEGIN {
# Special marker indicating that the name is defined as a Zone.
# It is a newline so that it cannot match a valid name.
# It is not null so that its slot does not appear unset.
Zone = "\n"
}
/^Z/ {
if (defined[$2]) {
if (defined[$2] == Zone) {
printf "%s: Zone has duplicate definition\n", $2
} else {
printf "%s: Link with same name as Zone\n", $2
}
status = 1
}
defined[$2] = Zone
}
/^L/ {
if (defined[$3]) {
if (defined[$3] == Zone) {
printf "%s: Link with same name as Zone\n", $3
} else if (defined[$3] == $2) {
printf "%s: Link has duplicate definition\n", $3
} else {
printf "%s: Link to both %s and %s\n", $3, defined[$3], $2
}
status = 1
}
if (backcheck && FILENAME != backcheck && $3 != "GMT") {
printf "%s: Link should be in '%s'\n", $3, backcheck
status = 1
}
if ($4 == "#=") {
shortcut[$5] = $3
}
used[$2] = 1
defined[$3] = $2
}
END {
for (tz in used) {
if (defined[tz] != Zone) {
if (!defined[tz]) {
printf "%s: Link to nowhere\n", tz
status = 1
} else if (DATAFORM != "vanguard") {
printf "%s: Link to link\n", tz
status = 1
}
}
}
for (tz in shortcut) {
if (defined[shortcut[tz]] != defined[tz]) {
target = (!defined[tz] ? "absence" \
: defined[tz] == "\n" ? "zone" \
: defined[tz])
printf "%s: target %s disagrees with %s's target %s\n", \
tz, target, shortcut[tz], defined[shortcut[tz]]
status = 1
}
}
exit status
}

@ -0,0 +1,192 @@
# Check tz tables for consistency.
# Contributed by Paul Eggert. This file is in the public domain.
BEGIN {
FS = "\t"
if (!iso_table) iso_table = "iso3166.tab"
if (!zone_table) zone_table = "zone1970.tab"
if (!want_warnings) want_warnings = -1
while (getline <iso_table) {
iso_NR++
if ($0 ~ /^#/) continue
if (NF != 2) {
printf "%s:%d: wrong number of columns\n", \
iso_table, iso_NR >>"/dev/stderr"
status = 1
}
cc = $1
name = $2
if (cc !~ /^[A-Z][A-Z]$/) {
printf "%s:%d: invalid country code '%s'\n", \
iso_table, iso_NR, cc >>"/dev/stderr"
status = 1
}
if (cc <= cc0) {
if (cc == cc0) {
s = "duplicate";
} else {
s = "out of order";
}
printf "%s:%d: country code '%s' is %s\n", \
iso_table, iso_NR, cc, s \
>>"/dev/stderr"
status = 1
}
cc0 = cc
if (name2cc[name]) {
printf "%s:%d: '%s' and '%s' have the same name\n", \
iso_table, iso_NR, name2cc[name], cc \
>>"/dev/stderr"
status = 1
}
name2cc[name] = cc
cc2name[cc] = name
cc2NR[cc] = iso_NR
}
cc0 = ""
while (getline <zone_table) {
zone_NR++
if ($0 ~ /^#/) continue
if (NF != 3 && NF != 4) {
printf "%s:%d: wrong number of columns\n", \
zone_table, zone_NR >>"/dev/stderr"
status = 1
}
ccs = input_ccs[zone_NR] = $1
coordinates = $2
tz = $3
comments = input_comments[zone_NR] = $4
split(ccs, cca, /,/)
cc = cca[1]
# Don't complain about a special case for Crimea in zone.tab.
# FIXME: zone.tab should be removed, since it is obsolete.
# Or at least put just "XX" in its country-code column.
if (cc < cc0 \
&& !(zone_table == "zone.tab" \
&& tz0 == "Europe/Simferopol")) {
printf "%s:%d: country code '%s' is out of order\n", \
zone_table, zone_NR, cc >>"/dev/stderr"
status = 1
}
cc0 = cc
tz0 = tz
tztab[tz] = 1
tz2NR[tz] = zone_NR
for (i in cca) {
cc = cca[i]
if (cc2name[cc]) {
cc_used[cc]++
} else {
printf "%s:%d: %s: unknown country code\n", \
zone_table, zone_NR, cc >>"/dev/stderr"
status = 1
}
}
if (coordinates !~ /^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$/ \
&& coordinates !~ /^[-+][0-9][0-9][0-5][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9][0-5][0-9]$/) {
printf "%s:%d: %s: invalid coordinates\n", \
zone_table, zone_NR, coordinates >>"/dev/stderr"
status = 1
}
}
for (i = 1; i <= zone_NR; i++) {
ccs = input_ccs[i]
if (!ccs) continue
comments = input_comments[i]
split(ccs, cca, /,/)
used_max = 0
for (j in cca) {
cc = cca[j]
if (used_max < cc_used[cc]) {
used_max = cc_used[cc]
used_max_cc = cc
}
}
if (used_max <= 1 && comments) {
printf "%s:%d: unnecessary comment '%s'\n", \
zone_table, i, comments \
>>"/dev/stderr"
status = 1
} else if (1 < used_max && !comments) {
printf "%s:%d: missing comment for %s\n", \
zone_table, i, used_max_cc \
>>"/dev/stderr"
status = 1
}
}
FS = " "
}
$1 ~ /^#/ { next }
{
tz = rules = ""
if ($1 == "Zone") {
tz = $2
ruleUsed[$4] = 1
if ($5 ~ /%/) rulePercentUsed[$4] = 1
} else if ($1 == "Link" && zone_table == "zone.tab") {
# Ignore Link commands if source and destination basenames
# are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
src = $2
dst = $3
while ((i = index(src, "/"))) src = substr(src, i+1)
while ((i = index(dst, "/"))) dst = substr(dst, i+1)
if (src != dst) tz = $3
} else if ($1 == "Rule") {
ruleDefined[$2] = 1
if ($10 != "-") ruleLetters[$2] = 1
} else {
ruleUsed[$2] = 1
if ($3 ~ /%/) rulePercentUsed[$2] = 1
}
if (tz && tz ~ /\// && tz !~ /^Etc\//) {
if (!tztab[tz] && FILENAME != "backward") {
printf "%s: no data for '%s'\n", zone_table, tz \
>>"/dev/stderr"
status = 1
}
zoneSeen[tz] = 1
}
}
END {
for (tz in ruleDefined) {
if (!ruleUsed[tz]) {
printf "%s: Rule never used\n", tz
status = 1
}
}
for (tz in ruleLetters) {
if (!rulePercentUsed[tz]) {
printf "%s: Rule contains letters never used\n", tz
status = 1
}
}
for (tz in tztab) {
if (!zoneSeen[tz] && tz !~ /^Etc\//) {
printf "%s:%d: no Zone table for '%s'\n", \
zone_table, tz2NR[tz], tz >>"/dev/stderr"
status = 1
}
}
if (0 < want_warnings) {
for (cc in cc2name) {
if (!cc_used[cc]) {
printf "%s:%d: warning: " \
"no Zone entries for %s (%s)\n", \
iso_table, cc2NR[cc], cc, cc2name[cc]
}
}
}
exit status
}

@ -0,0 +1,79 @@
# tzdb data for ships at sea and other miscellany
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# These entries are for uses not otherwise covered by the tz database.
# Their main practical use is for platforms like Android that lack
# support for POSIX-style TZ strings. On such platforms these entries
# can be useful if the timezone database is wrong or if a ship or
# aircraft at sea is not in a timezone.
# Starting with POSIX 1003.1-2001, the entries below are all
# unnecessary as settings for the TZ environment variable. E.g.,
# instead of TZ='Etc/GMT+4' one can use the POSIX setting TZ='<-04>+4'.
#
# Do not use a POSIX TZ setting like TZ='GMT+4', which is four hours
# behind GMT but uses the completely misleading abbreviation "GMT".
# The following zone is used by tzcode functions like gmtime,
# which load the "UTC" file to handle seconds properly.
Zone Etc/UTC 0 - UTC
# Functions like gmtime load the "GMT" file to handle leap seconds properly.
# Vanguard section, which works with most .zi parsers.
#Zone GMT 0 - GMT
# Rearguard section, for TZUpdater 2.3.2 and earlier.
Zone Etc/GMT 0 - GMT
# The following link uses older naming conventions,
# but it belongs here, not in the file 'backward',
# as it is needed for tzcode releases through 2022a,
# where functions like gmtime load "GMT" instead of the "Etc/UTC".
# We want this to work even on installations that omit 'backward'.
Link Etc/GMT GMT
# End of rearguard section.
# Be consistent with POSIX TZ settings in the Zone names,
# even though this is the opposite of what many people expect.
# POSIX has positive signs west of Greenwich, but many people expect
# positive signs east of Greenwich. For example, TZ='Etc/GMT+4' uses
# the abbreviation "-04" and corresponds to 4 hours behind UT
# (i.e. west of Greenwich) even though many people would expect it to
# mean 4 hours ahead of UT (i.e. east of Greenwich).
# Earlier incarnations of this package were not POSIX-compliant,
# and had lines such as
# Zone GMT-12 -12 - GMT-1200
# We did not want things to change quietly if someone accustomed to the old
# way does a
# zic -l GMT-12
# so we moved the names into the Etc subdirectory.
# Also, the time zone abbreviations are now compatible with %z.
Zone Etc/GMT-14 14 - +14
Zone Etc/GMT-13 13 - +13
Zone Etc/GMT-12 12 - +12
Zone Etc/GMT-11 11 - +11
Zone Etc/GMT-10 10 - +10
Zone Etc/GMT-9 9 - +09
Zone Etc/GMT-8 8 - +08
Zone Etc/GMT-7 7 - +07
Zone Etc/GMT-6 6 - +06
Zone Etc/GMT-5 5 - +05
Zone Etc/GMT-4 4 - +04
Zone Etc/GMT-3 3 - +03
Zone Etc/GMT-2 2 - +02
Zone Etc/GMT-1 1 - +01
Zone Etc/GMT+1 -1 - -01
Zone Etc/GMT+2 -2 - -02
Zone Etc/GMT+3 -3 - -03
Zone Etc/GMT+4 -4 - -04
Zone Etc/GMT+5 -5 - -05
Zone Etc/GMT+6 -6 - -06
Zone Etc/GMT+7 -7 - -07
Zone Etc/GMT+8 -8 - -08
Zone Etc/GMT+9 -9 - -09
Zone Etc/GMT+10 -10 - -10
Zone Etc/GMT+11 -11 - -11
Zone Etc/GMT+12 -12 - -12

File diff suppressed because it is too large Load Diff

@ -0,0 +1,12 @@
# tzdb data for noncommittal factory settings
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# For distributors who don't want to specify a timezone in their
# installation procedures. Users who run 'date' will get the
# time zone abbreviation "-00", indicating that the actual time zone
# is unknown.
# Zone NAME STDOFF RULES FORMAT
Zone Factory 0 - -00

@ -0,0 +1,274 @@
# ISO 3166 alpha-2 country codes
#
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
# From Paul Eggert (2022-11-18):
# This file contains a table of two-letter country codes. Columns are
# separated by a single tab. Lines beginning with '#' are comments.
# All text uses UTF-8 encoding. The columns of the table are as follows:
#
# 1. ISO 3166-1 alpha-2 country code, current as of
# ISO 3166-1 N1087 (2022-09-02). See: Updates on ISO 3166-1
# https://isotc.iso.org/livelink/livelink/Open/16944257
# 2. The usual English name for the coded region,
# chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables.
#
# The table is sorted by country code.
#
# This table is intended as an aid for users, to help them select time
# zone data appropriate for their practical needs. It is not intended
# to take or endorse any position on legal or territorial claims.
#
#country-
#code name of country, territory, area, or subdivision
AD Andorra
AE United Arab Emirates
AF Afghanistan
AG Antigua & Barbuda
AI Anguilla
AL Albania
AM Armenia
AO Angola
AQ Antarctica
AR Argentina
AS Samoa (American)
AT Austria
AU Australia
AW Aruba
AX Åland Islands
AZ Azerbaijan
BA Bosnia & Herzegovina
BB Barbados
BD Bangladesh
BE Belgium
BF Burkina Faso
BG Bulgaria
BH Bahrain
BI Burundi
BJ Benin
BL St Barthelemy
BM Bermuda
BN Brunei
BO Bolivia
BQ Caribbean NL
BR Brazil
BS Bahamas
BT Bhutan
BV Bouvet Island
BW Botswana
BY Belarus
BZ Belize
CA Canada
CC Cocos (Keeling) Islands
CD Congo (Dem. Rep.)
CF Central African Rep.
CG Congo (Rep.)
CH Switzerland
CI Côte d'Ivoire
CK Cook Islands
CL Chile
CM Cameroon
CN China
CO Colombia
CR Costa Rica
CU Cuba
CV Cape Verde
CW Curaçao
CX Christmas Island
CY Cyprus
CZ Czech Republic
DE Germany
DJ Djibouti
DK Denmark
DM Dominica
DO Dominican Republic
DZ Algeria
EC Ecuador
EE Estonia
EG Egypt
EH Western Sahara
ER Eritrea
ES Spain
ET Ethiopia
FI Finland
FJ Fiji
FK Falkland Islands
FM Micronesia
FO Faroe Islands
FR France
GA Gabon
GB Britain (UK)
GD Grenada
GE Georgia
GF French Guiana
GG Guernsey
GH Ghana
GI Gibraltar
GL Greenland
GM Gambia
GN Guinea
GP Guadeloupe
GQ Equatorial Guinea
GR Greece
GS South Georgia & the South Sandwich Islands
GT Guatemala
GU Guam
GW Guinea-Bissau
GY Guyana
HK Hong Kong
HM Heard Island & McDonald Islands
HN Honduras
HR Croatia
HT Haiti
HU Hungary
ID Indonesia
IE Ireland
IL Israel
IM Isle of Man
IN India
IO British Indian Ocean Territory
IQ Iraq
IR Iran
IS Iceland
IT Italy
JE Jersey
JM Jamaica
JO Jordan
JP Japan
KE Kenya
KG Kyrgyzstan
KH Cambodia
KI Kiribati
KM Comoros
KN St Kitts & Nevis
KP Korea (North)
KR Korea (South)
KW Kuwait
KY Cayman Islands
KZ Kazakhstan
LA Laos
LB Lebanon
LC St Lucia
LI Liechtenstein
LK Sri Lanka
LR Liberia
LS Lesotho
LT Lithuania
LU Luxembourg
LV Latvia
LY Libya
MA Morocco
MC Monaco
MD Moldova
ME Montenegro
MF St Martin (French)
MG Madagascar
MH Marshall Islands
MK North Macedonia
ML Mali
MM Myanmar (Burma)
MN Mongolia
MO Macau
MP Northern Mariana Islands
MQ Martinique
MR Mauritania
MS Montserrat
MT Malta
MU Mauritius
MV Maldives
MW Malawi
MX Mexico
MY Malaysia
MZ Mozambique
NA Namibia
NC New Caledonia
NE Niger
NF Norfolk Island
NG Nigeria
NI Nicaragua
NL Netherlands
NO Norway
NP Nepal
NR Nauru
NU Niue
NZ New Zealand
OM Oman
PA Panama
PE Peru
PF French Polynesia
PG Papua New Guinea
PH Philippines
PK Pakistan
PL Poland
PM St Pierre & Miquelon
PN Pitcairn
PR Puerto Rico
PS Palestine
PT Portugal
PW Palau
PY Paraguay
QA Qatar
RE Réunion
RO Romania
RS Serbia
RU Russia
RW Rwanda
SA Saudi Arabia
SB Solomon Islands
SC Seychelles
SD Sudan
SE Sweden
SG Singapore
SH St Helena
SI Slovenia
SJ Svalbard & Jan Mayen
SK Slovakia
SL Sierra Leone
SM San Marino
SN Senegal
SO Somalia
SR Suriname
SS South Sudan
ST Sao Tome & Principe
SV El Salvador
SX St Maarten (Dutch)
SY Syria
SZ Eswatini (Swaziland)
TC Turks & Caicos Is
TD Chad
TF French S. Terr.
TG Togo
TH Thailand
TJ Tajikistan
TK Tokelau
TL East Timor
TM Turkmenistan
TN Tunisia
TO Tonga
TR Turkey
TT Trinidad & Tobago
TV Tuvalu
TW Taiwan
TZ Tanzania
UA Ukraine
UG Uganda
UM US minor outlying islands
US United States
UY Uruguay
UZ Uzbekistan
VA Vatican City
VC St Vincent
VE Venezuela
VG Virgin Islands (UK)
VI Virgin Islands (US)
VN Vietnam
VU Vanuatu
WF Wallis & Futuna
WS Samoa (western)
YE Yemen
YT Mayotte
ZA South Africa
ZM Zambia
ZW Zimbabwe

@ -0,0 +1,255 @@
#
# In the following text, the symbol '#' introduces
# a comment, which continues from that symbol until
# the end of the line. A plain comment line has a
# whitespace character following the comment indicator.
# There are also special comment lines defined below.
# A special comment will always have a non-whitespace
# character in column 2.
#
# A blank line should be ignored.
#
# The following table shows the corrections that must
# be applied to compute International Atomic Time (TAI)
# from the Coordinated Universal Time (UTC) values that
# are transmitted by almost all time services.
#
# The first column shows an epoch as a number of seconds
# since 1 January 1900, 00:00:00 (1900.0 is also used to
# indicate the same epoch.) Both of these time stamp formats
# ignore the complexities of the time scales that were
# used before the current definition of UTC at the start
# of 1972. (See note 3 below.)
# The second column shows the number of seconds that
# must be added to UTC to compute TAI for any timestamp
# at or after that epoch. The value on each line is
# valid from the indicated initial instant until the
# epoch given on the next one or indefinitely into the
# future if there is no next line.
# (The comment on each line shows the representation of
# the corresponding initial epoch in the usual
# day-month-year format. The epoch always begins at
# 00:00:00 UTC on the indicated day. See Note 5 below.)
#
# Important notes:
#
# 1. Coordinated Universal Time (UTC) is often referred to
# as Greenwich Mean Time (GMT). The GMT time scale is no
# longer used, and the use of GMT to designate UTC is
# discouraged.
#
# 2. The UTC time scale is realized by many national
# laboratories and timing centers. Each laboratory
# identifies its realization with its name: Thus
# UTC(NIST), UTC(USNO), etc. The differences among
# these different realizations are typically on the
# order of a few nanoseconds (i.e., 0.000 000 00x s)
# and can be ignored for many purposes. These differences
# are tabulated in Circular T, which is published monthly
# by the International Bureau of Weights and Measures
# (BIPM). See www.bipm.org for more information.
#
# 3. The current definition of the relationship between UTC
# and TAI dates from 1 January 1972. A number of different
# time scales were in use before that epoch, and it can be
# quite difficult to compute precise timestamps and time
# intervals in those "prehistoric" days. For more information,
# consult:
#
# The Explanatory Supplement to the Astronomical
# Ephemeris.
# or
# Terry Quinn, "The BIPM and the Accurate Measurement
# of Time," Proc. of the IEEE, Vol. 79, pp. 894-905,
# July, 1991. <http://dx.doi.org/10.1109/5.84965>
# reprinted in:
# Christine Hackman and Donald B Sullivan (eds.)
# Time and Frequency Measurement
# American Association of Physics Teachers (1996)
# <http://tf.nist.gov/general/pdf/1168.pdf>, pp. 75-86
#
# 4. The decision to insert a leap second into UTC is currently
# the responsibility of the International Earth Rotation and
# Reference Systems Service. (The name was changed from the
# International Earth Rotation Service, but the acronym IERS
# is still used.)
#
# Leap seconds are announced by the IERS in its Bulletin C.
#
# See www.iers.org for more details.
#
# Every national laboratory and timing center uses the
# data from the BIPM and the IERS to construct UTC(lab),
# their local realization of UTC.
#
# Although the definition also includes the possibility
# of dropping seconds ("negative" leap seconds), this has
# never been done and is unlikely to be necessary in the
# foreseeable future.
#
# 5. If your system keeps time as the number of seconds since
# some epoch (e.g., NTP timestamps), then the algorithm for
# assigning a UTC time stamp to an event that happens during a positive
# leap second is not well defined. The official name of that leap
# second is 23:59:60, but there is no way of representing that time
# in these systems.
# Many systems of this type effectively stop the system clock for
# one second during the leap second and use a time that is equivalent
# to 23:59:59 UTC twice. For these systems, the corresponding TAI
# timestamp would be obtained by advancing to the next entry in the
# following table when the time equivalent to 23:59:59 UTC
# is used for the second time. Thus the leap second which
# occurred on 30 June 1972 at 23:59:59 UTC would have TAI
# timestamps computed as follows:
#
# ...
# 30 June 1972 23:59:59 (2287785599, first time): TAI= UTC + 10 seconds
# 30 June 1972 23:59:60 (2287785599,second time): TAI= UTC + 11 seconds
# 1 July 1972 00:00:00 (2287785600) TAI= UTC + 11 seconds
# ...
#
# If your system realizes the leap second by repeating 00:00:00 UTC twice
# (this is possible but not usual), then the advance to the next entry
# in the table must occur the second time that a time equivalent to
# 00:00:00 UTC is used. Thus, using the same example as above:
#
# ...
# 30 June 1972 23:59:59 (2287785599): TAI= UTC + 10 seconds
# 30 June 1972 23:59:60 (2287785600, first time): TAI= UTC + 10 seconds
# 1 July 1972 00:00:00 (2287785600,second time): TAI= UTC + 11 seconds
# ...
#
# in both cases the use of timestamps based on TAI produces a smooth
# time scale with no discontinuity in the time interval. However,
# although the long-term behavior of the time scale is correct in both
# methods, the second method is technically not correct because it adds
# the extra second to the wrong day.
#
# This complexity would not be needed for negative leap seconds (if they
# are ever used). The UTC time would skip 23:59:59 and advance from
# 23:59:58 to 00:00:00 in that case. The TAI offset would decrease by
# 1 second at the same instant. This is a much easier situation to deal
# with, since the difficulty of unambiguously representing the epoch
# during the leap second does not arise.
#
# Some systems implement leap seconds by amortizing the leap second
# over the last few minutes of the day. The frequency of the local
# clock is decreased (or increased) to realize the positive (or
# negative) leap second. This method removes the time step described
# above. Although the long-term behavior of the time scale is correct
# in this case, this method introduces an error during the adjustment
# period both in time and in frequency with respect to the official
# definition of UTC.
#
# Questions or comments to:
# Judah Levine
# Time and Frequency Division
# NIST
# Boulder, Colorado
# Judah.Levine@nist.gov
#
# Last Update of leap second values: 8 July 2016
#
# The following line shows this last update date in NTP timestamp
# format. This is the date on which the most recent change to
# the leap second data was added to the file. This line can
# be identified by the unique pair of characters in the first two
# columns as shown below.
#
#$ 3676924800
#
# The NTP timestamps are in units of seconds since the NTP epoch,
# which is 1 January 1900, 00:00:00. The Modified Julian Day number
# corresponding to the NTP time stamp, X, can be computed as
#
# X/86400 + 15020
#
# where the first term converts seconds to days and the second
# term adds the MJD corresponding to the time origin defined above.
# The integer portion of the result is the integer MJD for that
# day, and any remainder is the time of day, expressed as the
# fraction of the day since 0 hours UTC. The conversion from day
# fraction to seconds or to hours, minutes, and seconds may involve
# rounding or truncation, depending on the method used in the
# computation.
#
# The data in this file will be updated periodically as new leap
# seconds are announced. In addition to being entered on the line
# above, the update time (in NTP format) will be added to the basic
# file name leap-seconds to form the name leap-seconds.<NTP TIME>.
# In addition, the generic name leap-seconds.list will always point to
# the most recent version of the file.
#
# This update procedure will be performed only when a new leap second
# is announced.
#
# The following entry specifies the expiration date of the data
# in this file in units of seconds since the origin at the instant
# 1 January 1900, 00:00:00. This expiration date will be changed
# at least twice per year whether or not a new leap second is
# announced. These semi-annual changes will be made no later
# than 1 June and 1 December of each year to indicate what
# action (if any) is to be taken on 30 June and 31 December,
# respectively. (These are the customary effective dates for new
# leap seconds.) This expiration date will be identified by a
# unique pair of characters in columns 1 and 2 as shown below.
# In the unlikely event that a leap second is announced with an
# effective date other than 30 June or 31 December, then this
# file will be edited to include that leap second as soon as it is
# announced or at least one month before the effective date
# (whichever is later).
# If an announcement by the IERS specifies that no leap second is
# scheduled, then only the expiration date of the file will
# be advanced to show that the information in the file is still
# current -- the update time stamp, the data and the name of the file
# will not change.
#
# Updated through IERS Bulletin C65
# File expires on: 28 December 2023
#
#@ 3912710400
#
2272060800 10 # 1 Jan 1972
2287785600 11 # 1 Jul 1972
2303683200 12 # 1 Jan 1973
2335219200 13 # 1 Jan 1974
2366755200 14 # 1 Jan 1975
2398291200 15 # 1 Jan 1976
2429913600 16 # 1 Jan 1977
2461449600 17 # 1 Jan 1978
2492985600 18 # 1 Jan 1979
2524521600 19 # 1 Jan 1980
2571782400 20 # 1 Jul 1981
2603318400 21 # 1 Jul 1982
2634854400 22 # 1 Jul 1983
2698012800 23 # 1 Jul 1985
2776982400 24 # 1 Jan 1988
2840140800 25 # 1 Jan 1990
2871676800 26 # 1 Jan 1991
2918937600 27 # 1 Jul 1992
2950473600 28 # 1 Jul 1993
2982009600 29 # 1 Jul 1994
3029443200 30 # 1 Jan 1996
3076704000 31 # 1 Jul 1997
3124137600 32 # 1 Jan 1999
3345062400 33 # 1 Jan 2006
3439756800 34 # 1 Jan 2009
3550089600 35 # 1 Jul 2012
3644697600 36 # 1 Jul 2015
3692217600 37 # 1 Jan 2017
#
# the following special comment contains the
# hash value of the data in this file computed
# use the secure hash algorithm as specified
# by FIPS 180-1. See the files in ~/pub/sha for
# the details of how this hash value is
# computed. Note that the hash computation
# ignores comments and whitespace characters
# in data lines. It includes the NTP values
# of both the last modification time and the
# expiration time of the file, but not the
# white space on those lines.
# the hash line is also ignored in the
# computation.
#
#h e76a99dc 65f15cc7 e613e040 f5078b5e b23834fe

@ -0,0 +1,82 @@
# Allowance for leap seconds added to each time zone file.
# This file is in the public domain.
# This file is generated automatically from the data in the public-domain
# NIST format leap-seconds.list file, which can be copied from
# <ftp://ftp.nist.gov/pub/time/leap-seconds.list>
# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>.
# The NIST file is used instead of its IERS upstream counterpart
# <https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list>
# because under US law the NIST file is public domain
# whereas the IERS file's copyright and license status is unclear.
# For more about leap-seconds.list, please see
# The NTP Timescale and Leap Seconds
# <https://www.eecis.udel.edu/~mills/leap.html>.
# The rules for leap seconds are specified in Annex 1 (Time scales) of:
# Standard-frequency and time-signal emissions.
# International Telecommunication Union - Radiocommunication Sector
# (ITU-R) Recommendation TF.460-6 (02/2002)
# <https://www.itu.int/rec/R-REC-TF.460-6-200202-I/>.
# The International Earth Rotation and Reference Systems Service (IERS)
# periodically uses leap seconds to keep UTC to within 0.9 s of UT1
# (a proxy for Earth's angle in space as measured by astronomers)
# and publishes leap second data in a copyrighted file
# <https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat>.
# See: Levine J. Coordinated Universal Time and the leap second.
# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995
# <https://ieeexplore.ieee.org/document/7909995>.
# There were no leap seconds before 1972, as no official mechanism
# accounted for the discrepancy between atomic time (TAI) and the earth's
# rotation. The first ("1 Jan 1972") data line in leap-seconds.list
# does not denote a leap second; it denotes the start of the current definition
# of UTC.
# All leap-seconds are Stationary (S) at the given UTC time.
# The correction (+ or -) is made at the given time, so in the unlikely
# event of a negative leap second, a line would look like this:
# Leap YEAR MON DAY 23:59:59 - S
# Typical lines look like this:
# Leap YEAR MON DAY 23:59:60 + S
Leap 1972 Jun 30 23:59:60 + S
Leap 1972 Dec 31 23:59:60 + S
Leap 1973 Dec 31 23:59:60 + S
Leap 1974 Dec 31 23:59:60 + S
Leap 1975 Dec 31 23:59:60 + S
Leap 1976 Dec 31 23:59:60 + S
Leap 1977 Dec 31 23:59:60 + S
Leap 1978 Dec 31 23:59:60 + S
Leap 1979 Dec 31 23:59:60 + S
Leap 1981 Jun 30 23:59:60 + S
Leap 1982 Jun 30 23:59:60 + S
Leap 1983 Jun 30 23:59:60 + S
Leap 1985 Jun 30 23:59:60 + S
Leap 1987 Dec 31 23:59:60 + S
Leap 1989 Dec 31 23:59:60 + S
Leap 1990 Dec 31 23:59:60 + S
Leap 1992 Jun 30 23:59:60 + S
Leap 1993 Jun 30 23:59:60 + S
Leap 1994 Jun 30 23:59:60 + S
Leap 1995 Dec 31 23:59:60 + S
Leap 1997 Jun 30 23:59:60 + S
Leap 1998 Dec 31 23:59:60 + S
Leap 2005 Dec 31 23:59:60 + S
Leap 2008 Dec 31 23:59:60 + S
Leap 2012 Jun 30 23:59:60 + S
Leap 2015 Jun 30 23:59:60 + S
Leap 2016 Dec 31 23:59:60 + S
# UTC timestamp when this leap second list expires.
# Any additional leap seconds will come after this.
# This Expires line is commented out for now,
# so that pre-2020a zic implementations do not reject this file.
#Expires 2023 Dec 28 00:00:00
# POSIX timestamps for the data in this file:
#updated 1467936000 (2016-07-08 00:00:00 UTC)
#expires 1703721600 (2023-12-28 00:00:00 UTC)
# Updated through IERS Bulletin C65
# File expires on: 28 December 2023

@ -0,0 +1,252 @@
# Generate zic format 'leapseconds' from NIST format 'leap-seconds.list'.
# This file is in the public domain.
# This program uses awk arithmetic. POSIX requires awk to support
# exact integer arithmetic only through 10**10, which means for NTP
# timestamps this program works only to the year 2216, which is the
# year 1900 plus 10**10 seconds. However, in practice
# POSIX-conforming awk implementations invariably use IEEE-754 double
# and so support exact integers through 2**53. By the year 2216,
# POSIX will almost surely require at least 2**53 for awk, so for NTP
# timestamps this program should be good until the year 285,428,681
# (the year 1900 plus 2**53 seconds). By then leap seconds will be
# long obsolete, as the Earth will likely slow down so much that
# there will be more than 25 hours per day and so some other scheme
# will be needed.
BEGIN {
print "# Allowance for leap seconds added to each time zone file."
print ""
print "# This file is in the public domain."
print ""
print "# This file is generated automatically from the data in the public-domain"
print "# NIST format leap-seconds.list file, which can be copied from"
print "# <ftp://ftp.nist.gov/pub/time/leap-seconds.list>"
print "# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>."
print "# The NIST file is used instead of its IERS upstream counterpart"
print "# <https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list>"
print "# because under US law the NIST file is public domain"
print "# whereas the IERS file's copyright and license status is unclear."
print "# For more about leap-seconds.list, please see"
print "# The NTP Timescale and Leap Seconds"
print "# <https://www.eecis.udel.edu/~mills/leap.html>."
print ""
print "# The rules for leap seconds are specified in Annex 1 (Time scales) of:"
print "# Standard-frequency and time-signal emissions."
print "# International Telecommunication Union - Radiocommunication Sector"
print "# (ITU-R) Recommendation TF.460-6 (02/2002)"
print "# <https://www.itu.int/rec/R-REC-TF.460-6-200202-I/>."
print "# The International Earth Rotation and Reference Systems Service (IERS)"
print "# periodically uses leap seconds to keep UTC to within 0.9 s of UT1"
print "# (a proxy for Earth's angle in space as measured by astronomers)"
print "# and publishes leap second data in a copyrighted file"
print "# <https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat>."
print "# See: Levine J. Coordinated Universal Time and the leap second."
print "# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995"
print "# <https://ieeexplore.ieee.org/document/7909995>."
print ""
print "# There were no leap seconds before 1972, as no official mechanism"
print "# accounted for the discrepancy between atomic time (TAI) and the earth's"
print "# rotation. The first (\"1 Jan 1972\") data line in leap-seconds.list"
print "# does not denote a leap second; it denotes the start of the current definition"
print "# of UTC."
print ""
print "# All leap-seconds are Stationary (S) at the given UTC time."
print "# The correction (+ or -) is made at the given time, so in the unlikely"
print "# event of a negative leap second, a line would look like this:"
print "# Leap YEAR MON DAY 23:59:59 - S"
print "# Typical lines look like this:"
print "# Leap YEAR MON DAY 23:59:60 + S"
monthabbr[ 1] = "Jan"
monthabbr[ 2] = "Feb"
monthabbr[ 3] = "Mar"
monthabbr[ 4] = "Apr"
monthabbr[ 5] = "May"
monthabbr[ 6] = "Jun"
monthabbr[ 7] = "Jul"
monthabbr[ 8] = "Aug"
monthabbr[ 9] = "Sep"
monthabbr[10] = "Oct"
monthabbr[11] = "Nov"
monthabbr[12] = "Dec"
sstamp_init()
}
# In case the input has CRLF form a la NIST.
{ sub(/\r$/, "") }
/^#[ \t]*[Uu]pdated through/ || /^#[ \t]*[Ff]ile expires on/ {
last_lines = last_lines $0 "\n"
}
/^#[$][ \t]/ { updated = $2 }
/^#[@][ \t]/ { expires = $2 }
/^[ \t]*#/ { next }
{
NTP_timestamp = $1
TAI_minus_UTC = $2
if (old_TAI_minus_UTC) {
if (old_TAI_minus_UTC < TAI_minus_UTC) {
sign = "23:59:60\t+"
} else {
sign = "23:59:59\t-"
}
sstamp_to_ymdhMs(NTP_timestamp - 1, ss_NTP)
printf "Leap\t%d\t%s\t%d\t%s\tS\n", \
ss_year, monthabbr[ss_month], ss_mday, sign
}
old_TAI_minus_UTC = TAI_minus_UTC
}
END {
print ""
if (expires) {
sstamp_to_ymdhMs(expires, ss_NTP)
print "# UTC timestamp when this leap second list expires."
print "# Any additional leap seconds will come after this."
if (! EXPIRES_LINE) {
print "# This Expires line is commented out for now,"
print "# so that pre-2020a zic implementations do not reject this file."
}
printf "%sExpires %.4d\t%s\t%.2d\t%.2d:%.2d:%.2d\n", \
EXPIRES_LINE ? "" : "#", \
ss_year, monthabbr[ss_month], ss_mday, ss_hour, ss_min, ss_sec
} else {
print "# (No Expires line, since the expires time is unknown.)"
}
# The difference between the NTP and POSIX epochs is 70 years
# (including 17 leap days), each 24 hours of 60 minutes of 60
# seconds each.
epoch_minus_NTP = ((1970 - 1900) * 365 + 17) * 24 * 60 * 60
print ""
print "# POSIX timestamps for the data in this file:"
if (updated) {
sstamp_to_ymdhMs(updated, ss_NTP)
printf "#updated %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \
updated - epoch_minus_NTP, \
ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec
} else {
print "#(updated time unknown)"
}
if (expires) {
sstamp_to_ymdhMs(expires, ss_NTP)
printf "#expires %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \
expires - epoch_minus_NTP, \
ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec
} else {
print "#(expires time unknown)"
}
printf "\n%s", last_lines
}
# sstamp_to_ymdhMs - convert seconds timestamp to date and time
#
# Call as:
#
# sstamp_to_ymdhMs(sstamp, epoch_days)
#
# where:
#
# sstamp - is the seconds timestamp.
# epoch_days - is the timestamp epoch in Gregorian days since 1600-03-01.
# ss_NTP is appropriate for an NTP sstamp.
#
# Both arguments should be nonnegative integers.
# On return, the following variables are set based on sstamp:
#
# ss_year - Gregorian calendar year
# ss_month - month of the year (1-January to 12-December)
# ss_mday - day of the month (1-31)
# ss_hour - hour (0-23)
# ss_min - minute (0-59)
# ss_sec - second (0-59)
# ss_wday - day of week (0-Sunday to 6-Saturday)
#
# The function sstamp_init should be called prior to using sstamp_to_ymdhMs.
function sstamp_init()
{
# Days in month N, where March is month 0 and January month 10.
ss_mon_days[ 0] = 31
ss_mon_days[ 1] = 30
ss_mon_days[ 2] = 31
ss_mon_days[ 3] = 30
ss_mon_days[ 4] = 31
ss_mon_days[ 5] = 31
ss_mon_days[ 6] = 30
ss_mon_days[ 7] = 31
ss_mon_days[ 8] = 30
ss_mon_days[ 9] = 31
ss_mon_days[10] = 31
# Counts of days in a Gregorian year, quad-year, century, and quad-century.
ss_year_days = 365
ss_quadyear_days = ss_year_days * 4 + 1
ss_century_days = ss_quadyear_days * 25 - 1
ss_quadcentury_days = ss_century_days * 4 + 1
# Standard day epochs, suitable for epoch_days.
# ss_MJD = 94493
# ss_POSIX = 135080
ss_NTP = 109513
}
function sstamp_to_ymdhMs(sstamp, epoch_days, \
quadcentury, century, quadyear, year, month, day)
{
ss_hour = int(sstamp / 3600) % 24
ss_min = int(sstamp / 60) % 60
ss_sec = sstamp % 60
# Start with a count of days since 1600-03-01 Gregorian.
day = epoch_days + int(sstamp / (24 * 60 * 60))
# Compute a year-month-day date with days of the month numbered
# 0-30, months (March-February) numbered 0-11, and years that start
# start March 1 and end after the last day of February. A quad-year
# starts on March 1 of a year evenly divisible by 4 and ends after
# the last day of February 4 years later. A century starts on and
# ends before March 1 in years evenly divisible by 100.
# A quad-century starts on and ends before March 1 in years divisible
# by 400. While the number of days in a quad-century is a constant,
# the number of days in each other time period can vary by 1.
# Any variation is in the last day of the time period (there might
# or might not be a February 29) where it is easy to deal with.
quadcentury = int(day / ss_quadcentury_days)
day -= quadcentury * ss_quadcentury_days
ss_wday = (day + 3) % 7
century = int(day / ss_century_days)
century -= century == 4
day -= century * ss_century_days
quadyear = int(day / ss_quadyear_days)
day -= quadyear * ss_quadyear_days
year = int(day / ss_year_days)
year -= year == 4
day -= year * ss_year_days
for (month = 0; month < 11; month++) {
if (day < ss_mon_days[month])
break
day -= ss_mon_days[month]
}
# Convert the date to a conventional day of month (1-31),
# month (1-12, January-December) and Gregorian year.
ss_mday = day + 1
if (month <= 9) {
ss_month = month + 3
} else {
ss_month = month - 9
year++
}
ss_year = 1600 + quadcentury * 400 + century * 100 + quadyear * 4 + year
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More