Compare commits

..

No commits in common. "main" and "22.5.12042" have entirely different histories.

6495 changed files with 1390212 additions and 4848999 deletions

View File

@ -1 +1 @@
Observium CE 24.12 Observium CE 22.5

View File

@ -7,57 +7,52 @@
* *
* @package observium * @package observium
* @subpackage cli * @subpackage cli
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
/// FIXME. This is mostly DERP arguments parsing /// FIXME. This is mostly DERP arguments parsing, new cmd will be soon
chdir(dirname($argv[0])); chdir(dirname($argv[0]));
$options = getopt("dhpt", [], $opt_index); $options = getopt("dhpt");
if (isset($options['d'])) { array_shift($argv); }
include("includes/observium.inc.php"); include("includes/sql-config.inc.php");
include("includes/discovery/functions.inc.php"); include("includes/discovery/functions.inc.php");
print_message("%g" . OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION . "\n%WAdd Device(s)%n\n", 'color'); print_message("%g" . OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION . "\n%WAdd Device(s)%n\n", 'color');
if (OBS_DEBUG) { if (OBS_DEBUG) { print_versions(); }
print_versions();
}
if (isset($options['h'])) { if (isset($options['h'])) { print_help(OBS_SCRIPT_NAME); exit; }
print_help(OBS_SCRIPT_NAME);
exit;
}
$snmp_options = []; $snmp_options = array();
// Just test, do not add a device // Just test, do not add device
if (isset($options['t'])) { if (isset($options['t'])) {
$snmp_options['test'] = TRUE; $snmp_options['test'] = TRUE;
array_shift($argv);
} }
// Add skip pingable checks if argument -p passed // Add skip pingable checks if argument -p passed
if (isset($options['p'])) { if (isset($options['p'])) {
$snmp_options['ping_skip'] = 1; $snmp_options['ping_skip'] = 1;
array_shift($argv);
} }
// Remove options and script name from argv
$argv = array_slice($argv, $opt_index);
$added = 0; $added = 0;
$add_array = [];
if (!empty($argv[0])) { if (!empty($argv[1])) {
if (is_file($argv[0])) { $add_array = array();
// Parse file into an array with devices to add if (is_file($argv[1])) {
foreach (new SplFileObject($argv[0]) as $line) { // Parse file into array with devices to add
foreach (new SplFileObject($argv[1]) as $line) {
$d = preg_split('/\s/', $line, -1, PREG_SPLIT_NO_EMPTY); $d = preg_split('/\s/', $line, -1, PREG_SPLIT_NO_EMPTY);
if (empty($d) || str_starts_with($d[0], '#')) { if (empty($d) || strpos(reset($d), '#') === 0) { continue; }
// Skip empty lines or commented
continue;
}
$add_array[] = $d; $add_array[] = $d;
} }
} else { } else {
$add_array[] = $argv; $add_array[0] = $argv;
array_shift($add_array[0]);
} }
// Save base SNMP v3 credentials and v2c/v1 community // Save base SNMP v3 credentials and v2c/v1 community
@ -65,40 +60,156 @@ if (!empty($argv[0])) {
$snmp_config_community = $config['snmp']['community']; $snmp_config_community = $config['snmp']['community'];
foreach ($add_array as $add) { foreach ($add_array as $add) {
$snmp = get_device_snmp_argv($add, $snmp_options); $hostname = strtolower($add[0]);
if (!$snmp) { $snmp_community = $add[1];
//print_error("Try to add $hostname:"); $snmp_version = strtolower($add[2]);
continue;
} $snmp_port = 161;
$hostname = $snmp['hostname']; if (str_contains($hostname, ':') && get_ip_version($hostname) !== 6) {
$snmp_version = $snmp['snmp_version']; // Allow pass common hostname:port
$snmp_transport = $snmp['snmp_transport']; list($host_tmp, $port_tmp) = explode(':', $hostname, 2);
$snmp_port = $snmp['snmp_port']; if (is_valid_param($port_tmp, 'port')) {
$hostname = $host_tmp;
$snmp_port = $port_tmp;
}
unset($host_tmp, $port_tmp);
}
$snmp_transport = 'udp';
// FIXME. Still used hard set v2c/v3 auth by config
if ($snmp_version === "v3") { if ($snmp_version === "v3") {
// v3 $config['snmp']['v3'] = $snmp_config_v3; // Restore base SNMP v3 credentials
$config['snmp']['v3'] = $snmp['snmp_v3_auth']; $snmp_v3_seclevel = $snmp_community;
} elseif (!empty($snmp_version)) {
// These values are the same as in defaults.inc.php
$snmp_v3_auth = [
'authlevel' => "noAuthNoPriv",
'authname' => "observium",
'authpass' => "",
'authalgo' => "MD5",
'cryptopass' => "",
'cryptoalgo' => "AES"
];
$add_context = FALSE; // Derp, last arg after transport is context
if ($snmp_v3_seclevel === "nanp" || $snmp_v3_seclevel === "any" || $snmp_v3_seclevel === "noAuthNoPriv") {
$snmp_v3_auth['authlevel'] = "noAuthNoPriv";
$snmp_v3_args = array_slice($add, 3);
while ($arg = array_shift($snmp_v3_args)) {
// parse all remaining args
if (is_valid_param($arg, 'port')) {
$snmp_port = $arg;
} elseif (preg_match('/^(' . implode("|", $config['snmp']['transports']) . ')$/', $arg)) {
$snmp_transport = $arg;
$add_context = TRUE; // Derp, last arg after transport is context
} elseif ($add_context && strlen($arg)) {
$snmp_context = $arg;
break;
} else {
// FIXME: should add a sanity check of chars allowed in user
$user = $arg;
}
}
if ($snmp_v3_seclevel !== "any") {
$config['snmp']['v3'] = [ $snmp_v3_auth ];
}
} elseif ($snmp_v3_seclevel === "anp" || $snmp_v3_seclevel === "authNoPriv") {
$snmp_v3_auth['authlevel'] = "authNoPriv";
$snmp_v3_args = array_slice($argv, 4);
$snmp_v3_auth['authname'] = array_shift($snmp_v3_args);
$snmp_v3_auth['authpass'] = array_shift($snmp_v3_args);
while ($arg = array_shift($snmp_v3_args)) {
// parse all remaining args
if (is_valid_param($arg, 'port')) {
$snmp_port = $arg;
} elseif (preg_match('/^(' . implode("|", $config['snmp']['transports']) . ')$/i', $arg)) {
$snmp_transport = $arg;
$add_context = TRUE; // Derp, last arg after transport is context
} elseif (is_valid_param($arg, 'snmp_authalgo')) {
$snmp_v3_auth['authalgo'] = $arg;
} elseif ($add_context && strlen($arg)) {
$snmp_context = $arg;
break;
}
}
$config['snmp']['v3'] = [ $snmp_v3_auth ];
} elseif ($snmp_v3_seclevel === "ap" || $snmp_v3_seclevel === "authPriv") {
$snmp_v3_auth['authlevel'] = "authPriv";
$snmp_v3_args = array_slice($argv, 4);
$snmp_v3_auth['authname'] = array_shift($snmp_v3_args);
$snmp_v3_auth['authpass'] = array_shift($snmp_v3_args);
$snmp_v3_auth['cryptopass'] = array_shift($snmp_v3_args);
while ($arg = array_shift($snmp_v3_args)) {
// parse all remaining args
if (is_valid_param($arg, 'port')) {
$snmp_port = $arg;
} elseif (preg_match('/^(' . implode("|", $config['snmp']['transports']) . ')$/i', $arg)) {
$snmp_transport = $arg;
$add_context = TRUE; // Derp, last arg after transport is context
} elseif (is_valid_param($arg, 'snmp_authalgo')) {
$snmp_v3_auth['authalgo'] = $arg;
} elseif (is_valid_param($arg, 'snmp_cryptoalgo')) {
$snmp_v3_auth['cryptoalgo'] = $arg;
} elseif ($add_context && strlen($arg)) {
$snmp_context = $arg;
break;
}
}
$config['snmp']['v3'] = [ $snmp_v3_auth ];
}
//print_debug_vars($snmp_v3_auth);
//print_debug_vars($config['snmp']['v3']);
} else {
// v1 or v2c // v1 or v2c
$config['snmp']['community'] = $snmp['snmp_community']; $snmp_v2_args = array_slice($argv, 2);
$add_context = FALSE; // Derp, last arg after transport is context
while ($arg = array_shift($snmp_v2_args)) {
// parse all remaining args
if (is_valid_param($arg, 'port')) {
$snmp_port = $arg;
} elseif (preg_match('/(' . implode("|", $config['snmp']['transports']) . ')/i', $arg)) {
$snmp_transport = $arg;
$add_context = TRUE; // Derp, last arg after transport is context
} elseif (preg_match('/^(v1|v2c)$/i', $arg)) {
$snmp_version = $arg;
} elseif ($add_context && strlen($arg)) {
$snmp_context = $arg;
break;
}
}
$config['snmp']['community'] = ($snmp_community ? array($snmp_community) : $snmp_config_community);
}
// Add snmp context to params
if (isset($snmp_context)) {
$snmp_options['snmp_context'] = $snmp_context;
unset($snmp_context);
} }
print_message("Try to add $hostname:"); print_message("Try to add $hostname:");
if (in_array($snmp_version, array('v1', 'v2c', 'v3'))) {
// If snmp version passed in arguments, then use the exact version
$device_id = add_device($hostname, $snmp_version, $snmp_port, $snmp_transport, $snmp_options);
} else {
// If snmp version unknown check all possible snmp versions and auth options
$device_id = add_device($hostname, NULL, $snmp_port, $snmp_transport, $snmp_options);
}
// If a known snmp version passed in arguments, then use the exact version (v1, v2c, v3) if ($device_id) {
// otherwise checks all possible snmp versions and auth options if (!isset($options['t'])) {
if ($device_id = add_device($hostname, $snmp_version, $snmp_port, $snmp_transport, $snmp_options)) {
if (!isset($snmp_options['test'])) {
$device = device_by_id_cache($device_id); $device = device_by_id_cache($device_id);
print_success("Added device " . $device['hostname'] . " (" . $device_id . ")."); print_success("Added device " . $device['hostname'] . " (" . $device_id . ").");
} // Else this is device testing, success message already written by add_device() } // Else this is device testing, success message already written by add_device()
$added++; $added++;
} }
// Restore base SNMP v1/2c/3 credentials (need for add multiple devices)
$config['snmp']['community'] = $snmp_config_community;
$config['snmp']['v3'] = $snmp_config_v3;
} }
} }

View File

@ -7,45 +7,41 @@
* *
* @package observium * @package observium
* @subpackage cli * @subpackage cli
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
chdir(dirname($argv[0])); chdir(dirname($argv[0]));
$options = getopt("d"); $options = getopt("d");
if (isset($options['d'])) { if (isset($options['d'])) { array_shift($argv); } // for compatibility
array_shift($argv);
} // for compatibility
include("includes/observium.inc.php"); include("includes/sql-config.inc.php");
print_message("%g".OBSERVIUM_PRODUCT." ".OBSERVIUM_VERSION."\n%WAdd User%n\n", 'color'); print_message("%g".OBSERVIUM_PRODUCT." ".OBSERVIUM_VERSION."\n%WAdd User%n\n", 'color');
if (OBS_DEBUG) { if (OBS_DEBUG) { print_versions(); }
print_versions();
}
$auth_file = $config['html_dir'].'/includes/authentication/' . $config['auth_mechanism'] . '.inc.php'; $auth_file = $config['html_dir'].'/includes/authentication/' . $config['auth_mechanism'] . '.inc.php';
if (is_file($auth_file)) { if (is_file($auth_file))
// Include base auth functions calls {
include_once($config['html_dir'] . '/includes/sessions.inc.php'); include($auth_file);
include_once($config['html_dir'] . '/includes/authenticate-functions.inc.php');
include_once($auth_file); // Include base auth functions calls
include($config['html_dir'].'/includes/authenticate-functions.inc.php');
} else { } else {
print_error("ERROR: no valid auth_mechanism defined."); print_error("ERROR: no valid auth_mechanism defined.");
exit(); exit();
} }
if (!auth_usermanagement()) { if (auth_usermanagement())
print_error("Auth module does not allow adding users!"); {
exit(); if (isset($argv[1]) && isset($argv[2]) && isset($argv[3]))
} {
if (!auth_user_exists($argv[1]))
if (isset($argv[1], $argv[2], $argv[3])) { {
if (!auth_user_exists($argv[1])) { if (adduser($argv[1], $argv[2], $argv[3], @$argv[4]))
if (adduser($argv[1], $argv[2], $argv[3], @$argv[4])) { {
print_success("User ".$argv[1]." added successfully."); print_success("User ".$argv[1]." added successfully.");
} else { } else {
print_error("User ".$argv[1]." creation failed!"); print_error("User ".$argv[1]." creation failed!");
@ -54,22 +50,25 @@ if (isset($argv[1], $argv[2], $argv[3])) {
print_warning("User ".$argv[1]." already exists!"); print_warning("User ".$argv[1]." already exists!");
} }
} else { } else {
$msg = "%n $msg = "%n
USAGE: USAGE:
$scriptname <username> <password> <level 1-10> $scriptname <username> <password> <level 1-10> [email]
EXAMPLE: EXAMPLE:
%WADMIN%n: $scriptname <username> <password> 10 %WADMIN%n: $scriptname <username> <password> 10 [email]
USER LEVELS:" . PHP_EOL; USER LEVELS:" . PHP_EOL;
foreach ($GLOBALS['config']['user_level'] as $level => $entry) { foreach($GLOBALS['config']['user_level'] as $level => $entry)
{
$msg .= ' '.$level.' - %W'.$entry['name'].'%n ('.$entry['subtext'].')'. PHP_EOL; $msg .= ' '.$level.' - %W'.$entry['name'].'%n ('.$entry['subtext'].')'. PHP_EOL;
} }
$msg .= PHP_EOL . "%rInvalid arguments!%n"; $msg .= PHP_EOL . "%rInvalid arguments!%n";
print_message($msg, 'color', FALSE); print_message($msg, 'color', FALSE);
} }
} else {
print_error("Auth module does not allow adding users!");
}
// EOF // EOF

View File

@ -7,15 +7,15 @@
* *
* @package observium * @package observium
* @subpackage cli * @subpackage cli
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
chdir(dirname($argv[0])); chdir(dirname($argv[0]));
$options = getopt("h:p:dqrsV"); $options = getopt("h:i:m:n:p:dqrsV");
include("includes/observium.inc.php"); include("includes/sql-config.inc.php");
include("includes/polling/functions.inc.php"); include("includes/polling/functions.inc.php");
include("html/includes/functions.inc.php"); include("html/includes/functions.inc.php");
@ -40,7 +40,7 @@ if ($options['h'] === "all") {
$where = " "; $where = " ";
$doing = "all"; $doing = "all";
} elseif ($options['h']) { } elseif ($options['h']) {
$params = []; $params = array();
if (is_numeric($options['h'])) { if (is_numeric($options['h'])) {
$where = "AND `device_id` = ?"; $where = "AND `device_id` = ?";
$doing = $options['h']; $doing = $options['h'];
@ -52,26 +52,25 @@ if ($options['h'] === "all") {
} }
} }
if (isset($options['p'])) {
print_cli_heading("%WConstrained to poller partition id " . $options['p']);
$where .= ' AND `poller_id` = ?';
$params[] = $options['p'];
}
if (!$where) { if (!$where) {
print_message("%n print_message("%n
USAGE: USAGE:
$scriptname [-drqV] [-p poller_id] [-h device] $scriptname [-drqV] [-i instances] [-n number] [-m module] [-h device]
EXAMPLE: EXAMPLE:
-h <device id> | <device hostname wildcard> Poll single device -h <device id> | <device hostname wildcard> Poll single device
-h odd Poll odd numbered devices (same as -i 2 -n 0)
-h even Poll even numbered devices (same as -i 2 -n 1)
-h all Poll all devices -h all Poll all devices
-h new Poll all devices that have not had a discovery run before
-p <poller_id> Poll for specific poller_id -i <instances> -n <number> Poll as instance <number> of <instances>
Instances start at 0. 0-3 for -n 4
OPTIONS: OPTIONS:
-h Device hostname, id or hostname or keys all. -h Device hostname, id or key odd/even/all/new.
-p Poller ID. -i Poll instance.
-n Poll number.
-s Sends alerts even if they have already been sent. -s Sends alerts even if they have already been sent.
-q Quiet output. -q Quiet output.
-V Show version and exit. -V Show version and exit.
@ -80,6 +79,7 @@ DEBUGGING OPTIONS:
-r Do not create or update RRDs -r Do not create or update RRDs
-d Enable debugging output. -d Enable debugging output.
-dd More verbose debugging output. -dd More verbose debugging output.
-m Specify module(s) (separated by commas) to be run.
%rInvalid arguments!%n", 'color'); %rInvalid arguments!%n", 'color');
exit; exit;
@ -100,16 +100,14 @@ $_SESSION['userlevel'] = 10;
//$params[] = $config['poller_id']; //$params[] = $config['poller_id'];
$query = "SELECT * FROM `devices` WHERE `disabled` = 0 $where ORDER BY `device_id` ASC"; $query = "SELECT * FROM `devices` WHERE `disabled` = 0 $where ORDER BY `device_id` ASC";
foreach (dbFetchRows($query, $params) as $device) { foreach (dbFetch($query, $params) as $device) {
humanize_device($device); humanize_device($device);
process_alerts($device); process_alerts($device);
if ($config['poller-wrapper']['notifications'] || $spam) { process_notifications(array('device_id' => $device['device_id'])); // Send all notifications (also for syslog from queue)
process_notifications(['device_id' => $device['device_id']]); // Send all notifications (also for syslog from queue)
}
dbUpdate(['last_alerter' => ['NOW()']], 'devices', '`device_id` = ?', [$device['device_id']]); dbUpdate(array('last_alerter' => array('NOW()')), 'devices', '`device_id` = ?', array($device['device_id']));
} }

57
check-errors.php Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env php
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage cli
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
chdir(dirname($argv[0]));
$options = getopt("d");
if (isset($options['d'])) { array_shift($argv); } // for compatibility
include("includes/sql-config.inc.php");
// Check all of our interface RRD files for errors
if ($argv[1]) { $where = "AND `port_id` = ?"; $params = array($argv[1]); }
$i = 0;
$errored = 0;
foreach (dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where", $params) as $interface)
{
$errors = $interface['ifInErrors_delta'] + $interface['ifOutErrors_delta'];
if ($errors > '1')
{
$errored[] = generate_device_link($interface, $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $interface['ifInErrors_delta'] . " - " . $interface['ifOutErrors_delta']);
$errored++;
}
$i++;
}
echo("Checked $i interfaces\n");
if (is_array($errored))
{ // If there are errored ports
$i = 0;
$msg = "Interfaces with errors : \n\n";
foreach ($errored as $int)
{
$msg .= "$int\n"; // Add a line to the report email warning about them
$i++;
}
// Send the alert email
//notify($device, "Observium detected errors on $i interface" . ($i != 1 ? 's' : ''), $msg);
}
echo("$errored interfaces with errors over the past 5 minutes.\n");
// EOF

View File

@ -6,7 +6,7 @@
* *
* @package observium * @package observium
* @subpackage poller * @subpackage poller
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
@ -15,30 +15,20 @@
chdir(dirname($argv[0])); chdir(dirname($argv[0]));
// Get options before definitions! // Get options before definitions!
$options = getopt("o:dt"); $options = getopt("o:d");
$cload_time = microtime(TRUE);
if (isset($options['o'])) { require_once("includes/sql-config.inc.php");
// Skip load full definitions, while not required on initial config
define('OBS_DEFINITIONS_SKIP', TRUE);
}
require_once("includes/observium.inc.php");
if (!is_cli()) {
return;
}
if (isset($options['t'])) {
print_cli(OBS_PROCESS_NAME . ' Load time: ' . elapsed_time($cload_time, 4) . PHP_EOL);
exit;
}
if (is_cli()) {
if (isset($options['o'])) { if (isset($options['o'])) {
// get filtered options // get filtered options
get_config_json($options['o']); get_config_json($options['o']);
//print_vars($options);
} else { } else {
// All config options // All config options
get_config_json(); get_config_json();
//print(safe_json_encode($config));
}
} }
// EOF // EOF

View File

@ -7,25 +7,25 @@
* *
* @package observium * @package observium
* @subpackage cli * @subpackage cli
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
chdir(dirname($argv[0])); chdir(dirname($argv[0]));
$options = getopt("d"); $options = getopt("d");
if (isset($options['d'])) { if (isset($options['d'])) { array_shift($argv); } // for compatibility
array_shift($argv);
} // for compatibility
include("includes/observium.inc.php"); include("includes/sql-config.inc.php");
print_message("%g".OBSERVIUM_PRODUCT." ".OBSERVIUM_VERSION."\n%WRemove Device%n\n", 'color'); print_message("%g".OBSERVIUM_PRODUCT." ".OBSERVIUM_VERSION."\n%WRemove Device%n\n", 'color');
// Remove a host and all related data from the system // Remove a host and all related data from the system
if ($argv[1]) { if ($argv[1])
{
$host = strtolower($argv[1]); $host = strtolower($argv[1]);
if (is_numeric($host)) { if (is_numeric($host))
{
$id = $host; $id = $host;
} else { } else {
$id = get_device_id_by_hostname($host); $id = get_device_id_by_hostname($host);
@ -33,7 +33,8 @@ if ($argv[1]) {
$delete_rrd = isset($argv[2]) && strtolower($argv[2]) === 'rrd'; $delete_rrd = isset($argv[2]) && strtolower($argv[2]) === 'rrd';
// Test if a valid id was fetched from get_device_id_by_hostname() // Test if a valid id was fetched from get_device_id_by_hostname()
if (isset($id) && is_numeric($id)) { if (isset($id) && is_numeric($id))
{
print_warning(delete_device($id, $delete_rrd)); print_warning(delete_device($id, $delete_rrd));
print_success("Device $host removed."); print_success("Device $host removed.");
} else { } else {

View File

@ -7,16 +7,16 @@
* *
* @package observium * @package observium
* @subpackage discovery * @subpackage discovery
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* *
*/ */
chdir(dirname($argv[0])); chdir(dirname($argv[0]));
// Get options before definitions! // Get options before definitions!
$options = getopt("h:i:m:n:p:U:dfquaMV"); $options = getopt("h:i:m:n:p:U:dquaMV");
include("includes/observium.inc.php"); include("includes/sql-config.inc.php");
include("includes/discovery/functions.inc.php"); include("includes/discovery/functions.inc.php");
$cli = TRUE; $cli = TRUE;
@ -24,23 +24,18 @@ $cli = TRUE;
//if (is_cron()) { $options['q'] = TRUE; } // Set quiet for cron //if (is_cron()) { $options['q'] = TRUE; } // Set quiet for cron
$start = utime(); $start = utime();
$runtime_stats = []; $runtime_stats = array();
if (isset($options['V'])) { if (isset($options['V'])) {
if (is_array($options['V'])) { print_message(OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION);
// Show more detailed Observium version and installed software versions if (is_array($options['V'])) { print_versions(); }
print_versions();
} else {
print_message(OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION_LONG);
}
exit; exit;
} }
if (isset($options['M'])) { if (isset($options['M'])) {
print_message(OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION); print_message(OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION);
print_message('Enabled discovery modules:'); print_message('Enabled discovery modules:');
$m_disabled = []; $m_disabled = array();
foreach ($config['discovery_modules'] as $module => $ok) { foreach ($config['discovery_modules'] as $module => $ok) {
if ($ok) { if ($ok) {
print_message(' ' . $module); print_message(' ' . $module);
@ -58,33 +53,17 @@ if (isset($options['M'])) {
if (!isset($options['q'])) { if (!isset($options['q'])) {
print_cli_banner(); print_cli_banner();
if (OBS_DEBUG) { if (OBS_DEBUG) { print_versions(); }
print_versions();
}
// Warning about obsolete configs. // Warning about obsolete configs.
if (print_obsolete_config()) { if (print_obsolete_config()) { echo PHP_EOL; }
echo PHP_EOL;
}
} }
if (isset($options['u']) || isset($options['U']) || if (isset($options['u']) || isset($options['U']) ||
(isset($options['h']) && in_array($options['h'], [ 'all', 'odd', 'even', 'none' ]))) { (isset($options['h']) && in_array($options['h'], [ 'all', 'odd', 'even', 'none' ]))) {
$options['u'] = TRUE; $options['u'] = TRUE;
if (isset($options['f'])) {
//$options['U'] = TRUE;
}
include($config['install_dir'] . '/includes/update/update.php'); include($config['install_dir'] . '/includes/update/update.php');
if ($updating) {
// DB schema updated. force alert/groups update
$options['a'] = TRUE;
}
// check remote poller params
if (OBS_DISTRIBUTED) {
check_local_poller();
}
} elseif (!isset($options['q'])) { } elseif (!isset($options['q'])) {
// Warn about need DB schema update // Warn about need DB schema update
$db_version = get_db_version(); $db_version = get_db_version();
@ -98,7 +77,7 @@ if (isset($options['u']) || isset($options['U']) ||
$where = ''; $where = '';
if (isset($options['h'])) { if (isset($options['h'])) {
$params = []; $params = array();
switch ($options['h']) { switch ($options['h']) {
case 'odd': case 'odd':
$options['n'] = 1; $options['n'] = 1;
@ -143,13 +122,14 @@ if (isset($options['h'])) {
} }
} }
if (isset($options['i'], $options['n']) && $options['i']) { if (isset($options['i']) && $options['i'] && isset($options['n'])) {
$where .= ' AND MOD(device_id,' . $options['i'] . ') = ?'; $where .= ' AND MOD(device_id,' . $options['i'] . ') = ?';
$params[] = $options['n']; $params[] = $options['n'];
$doing = $options['n'] . '/' . $options['i']; $doing = $options['n'] . '/' . $options['i'];
} }
if (!$where && !$options['u'] && !isset($options['a'])) { if (!$where && !$options['u'] && !isset($options['a']))
{
print_message("%n print_message("%n
USAGE: USAGE:
$scriptname [-dquV] [-i instances] [-n number] [-m module] [-h device] $scriptname [-dquV] [-i instances] [-n number] [-m module] [-h device]
@ -169,13 +149,12 @@ OPTIONS:
-i Discovery instance. -i Discovery instance.
-n Discovery number. -n Discovery number.
-q Quiet output. -q Quiet output.
-a Update Groups/Alerts table -a Force update Groups/Alerts table
-u Upgrade DB schema -u Upgrade DB schema
-M Show globally enabled/disabled modules and exit. -M Show globally enabled/disabled modules and exit.
-V Show version and exit. -V Show version and exit.
DEBUGGING OPTIONS: DEBUGGING OPTIONS:
-f Force requested option
-d Enable debugging output. -d Enable debugging output.
-dd More verbose debugging output. -dd More verbose debugging output.
-m Specify modules (separated by commas) to be run. -m Specify modules (separated by commas) to be run.
@ -188,39 +167,23 @@ if ($config['version_check'] && ($options['h'] !== 'new' || $options['u'])) {
} }
if (!$where) { if (!$where) {
// Only update Group/Alert tables // Only update Group/Alert tables
if (isset($options['a'])) { if (isset($options['a'])) {
// Distributed handling doesn't make sense here. It's just database action.
// if (OBS_DISTRIBUTED && function_exists('run_action_queue')) {
//run_action_queue('device_add');
//run_action_queue('device_rename');
//run_action_queue('device_delete');
// Update alert and group tables
// run_action_queue('tables_update', $options);
// } else {
$silent = isset($options['q']); $silent = isset($options['q']);
if (function_exists('update_group_tables')) { // Not exist in CE
update_group_tables($silent); if (function_exists('update_group_tables')) { update_group_tables($silent); }
} // Not exist in CE if (function_exists('update_alert_tables')) { update_alert_tables($silent); }
if (function_exists('update_alert_tables')) {
update_alert_tables($silent);
}
// }
} }
exit; exit;
} }
// For not new devices discovery, skip down devices // For not new devices discovery, skip down devices
if ($options['h'] !== 'new' && !isset($options['f'])) { if ($options['h'] !== 'new') {
$where .= ' AND `status` = ?'; $where .= ' AND `status` = ?';
$params[] = 1; $params[] = 1;
} }
// Discovered device counter
$discovered_devices = 0; $discovered_devices = 0;
print_cli_heading("%WStarting discovery run at " . date("Y-m-d H:i:s"), 0); print_cli_heading("%WStarting discovery run at " . date("Y-m-d H:i:s"), 0);
@ -230,24 +193,21 @@ $params[] = $config['poller_id'];
foreach (dbFetchRows("SELECT * FROM `devices` WHERE `disabled` = 0 $where ORDER BY `last_discovered_timetaken` ASC", $params) as $device) { foreach (dbFetchRows("SELECT * FROM `devices` WHERE `disabled` = 0 $where ORDER BY `last_discovered_timetaken` ASC", $params) as $device) {
// Additional check if device SNMPable, because during // Additional check if device SNMPable, because during
// discovery many devices (long time), some device can be switched off // discovery many devices (long time), the some device can be switched off
if ($options['h'] === 'new' || is_snmpable($device)) { if ($options['h'] === 'new' || isSNMPable($device)) {
$discover_status = discover_device($device, $options); discover_device($device, $options);
} else { } else {
$string = "Device '" . $device['hostname'] . "' skipped, because switched off during runtime discovery process."; $string = "Device '" . $device['hostname'] . "' skipped, because switched off during runtime discovery process.";
print_debug($string); print_debug($string);
logfile($argv[0] . ": $string"); logfile($argv[0] . ": $string");
$discover_status = FALSE;
}
if ($discover_status !== FALSE) {
$discovered_devices++;
} }
} }
print_cli_heading("%WFinished discovery run at " . date("Y-m-d H:i:s"), 0); print_cli_heading("%WFinished discovery run at " . date("Y-m-d H:i:s"), 0);
$discovery_time = elapsed_time($start, 4); $end = utime();
$run = $end - $start;
$discovery_time = substr($run, 0, 5);
// Update Group/Alert tables // Update Group/Alert tables
if (($discovered_devices && !isset($options['m'])) || isset($options['a'])) { if (($discovered_devices && !isset($options['m'])) || isset($options['a'])) {
@ -255,18 +215,13 @@ if (($discovered_devices && !isset($options['m'])) || isset($options['a'])) {
if (OBS_DISTRIBUTED && !isset($options['a']) && function_exists('add_action_queue') && if (OBS_DISTRIBUTED && !isset($options['a']) && function_exists('add_action_queue') &&
$action_id = add_action_queue('tables_update', 'discovery', [ 'silent' => $silent ])) { $action_id = add_action_queue('tables_update', 'discovery', [ 'silent' => $silent ])) {
print_message("Update alert and group tables added to queue [$action_id]."); print_message("Update alert and group tables added to queue [$action_id].");
//log_event("Device with hostname '$hostname' added to queue [$action_id] for addition on remote Poller [{$vars['poller_id']}].", NULL, 'info', NULL, 7); //log_event("Device with hostname '$hostname' added to queue [$action_id] for addition on remote Poller [${vars['poller_id']}].", NULL, 'info', NULL, 7);
} else { } elseif (OBSERVIUM_EDITION !== 'community') {
// Not exist in CE // Not exist in CE
if (function_exists('update_group_tables')) { update_group_tables($silent);
// update_group_tables($silent);
update_group_tables();
}
if (function_exists('update_alert_tables')) {
update_alert_tables($silent); update_alert_tables($silent);
} }
} }
}
if ($discovered_devices) { if ($discovered_devices) {
// Single device ID convert to hostname for log // Single device ID convert to hostname for log
@ -274,8 +229,22 @@ if ($discovered_devices) {
$doing = $device['hostname']; $doing = $device['hostname'];
// This discovery passed from wrapper and with process id // This discovery passed from wrapper and with process id
if (OBS_DISTRIBUTED && !$options['u']) { if ($config['poller_id'] > 0 &&
check_local_poller(); $poller = dbFetchRow('SELECT * FROM `pollers` WHERE `poller_id` = ?', [ $config['poller_id'] ])) {
print_debug_vars($poller, 1);
$host_id = get_local_id();
$update = [];
if ($poller['host_id'] != $host_id) {
$update['host_id'] = $host_id;
log_event("Poller ".$config['poller_id']." host ID changed: '".$poller['host_id']."' -> '".$host_id."'");
}
if ($poller['host_uname'] != php_uname()) {
$update['host_uname'] = php_uname();
log_event("Poller ".$config['poller_id']." host uname changed: '".$poller['host_uname']."' -> '".$update['host_uname']."'");
}
if (count($update)) {
dbUpdate($update, 'pollers', '`poller_id` = ?', [ $config['poller_id'] ]);
}
} }
} }
} elseif (!isset($options['q']) && !$options['u']) { } elseif (!isset($options['q']) && !$options['u']) {
@ -288,15 +257,15 @@ logfile($string);
// Clean stale observium processes // Clean stale observium processes
$process_sql = "SELECT * FROM `observium_processes` WHERE `poller_id` = ? AND `process_start` < ?"; $process_sql = "SELECT * FROM `observium_processes` WHERE `poller_id` = ? AND `process_start` < ?";
foreach (dbFetchRows($process_sql, [ $config['poller_id'], get_time('fourhour') ]) as $process) { foreach (dbFetchRows($process_sql, [ $config['poller_id'], $config['time']['fourhour'] ]) as $process) {
// We found processes in DB, check if it exists on a system // We found processes in DB, check if it exist on system
print_debug_vars($process); print_debug_vars($process);
$pid_info = get_pid_info($process['process_pid']); $pid_info = get_pid_info($process['process_pid']);
if (is_array($pid_info) && str_contains($pid_info['COMMAND'], $process['process_name'])) { if (is_array($pid_info) && str_contains($pid_info['COMMAND'], $process['process_name'])) {
// Process still running // Process still running
} else { } else {
// Remove stalled DB entries // Remove stalled DB entries
dbDelete('observium_processes', '`process_id` = ?', [$process['process_id']]); dbDelete('observium_processes', '`process_id` = ?', array($process['process_id']));
print_debug("Removed stale process entry from DB (cmd: '" . $process['process_command'] . "', PID: '" . $process['process_pid'] . "')"); print_debug("Removed stale process entry from DB (cmd: '" . $process['process_command'] . "', PID: '" . $process['process_pid'] . "')");
} }
} }
@ -308,9 +277,8 @@ if (!isset($options['q'])) {
print_cli_data('Devices Discovered', $discovered_devices, 0); print_cli_data('Devices Discovered', $discovered_devices, 0);
print_cli_data('Discovery Time', $discovery_time . " secs", 0); print_cli_data('Discovery Time', $discovery_time . " secs", 0);
print_cli_data('Definitions', $defs_time . " secs", 0); print_cli_data('Memory usage', formatStorage(memory_get_usage(TRUE), 2, 4) .
print_cli_data('Memory usage', format_bytes(memory_get_usage(TRUE), 2, 4) . ' (peak: ' . formatStorage(memory_get_peak_usage(TRUE), 2, 4) . ')', 0);
' (peak: ' . format_bytes(memory_get_peak_usage(TRUE), 2, 4) . ')', 0);
print_cli_data('MySQL Usage', 'Cell[' . ($db_stats['fetchcell'] + 0) . '/' . round($db_stats['fetchcell_sec'] + 0, 3) . 's]' . print_cli_data('MySQL Usage', 'Cell[' . ($db_stats['fetchcell'] + 0) . '/' . round($db_stats['fetchcell_sec'] + 0, 3) . 's]' .
' Row[' . ($db_stats['fetchrow'] + 0) . '/' . round($db_stats['fetchrow_sec'] + 0, 3) . 's]' . ' Row[' . ($db_stats['fetchrow'] + 0) . '/' . round($db_stats['fetchrow_sec'] + 0, 3) . 's]' .
' Rows[' . ($db_stats['fetchrows'] + 0) . '/' . round($db_stats['fetchrows_sec'] + 0, 3) . 's]' . ' Rows[' . ($db_stats['fetchrows'] + 0) . '/' . round($db_stats['fetchrows_sec'] + 0, 3) . 's]' .

View File

@ -7,36 +7,32 @@
* *
* @package observium * @package observium
* @subpackage cli * @subpackage cli
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
chdir(dirname($argv[0])); chdir(dirname($argv[0]));
$options = getopt("A:VyaselurpdbitxT"); $options = getopt("A:VyaselurpdbiT");
include("includes/observium.inc.php"); include("includes/sql-config.inc.php");
$cli = is_cli(); $cli = is_cli();
if (isset($options['V'])) { if (isset($options['V'])) {
print_message(OBSERVIUM_PRODUCT." ".OBSERVIUM_VERSION); print_message(OBSERVIUM_PRODUCT." ".OBSERVIUM_VERSION);
if (is_array($options['V'])) { if (is_array($options['V'])) { print_versions(); }
print_versions();
}
exit; exit;
} }
// Prevent running housekeeping on remote pollers (not needed, won't work properly, potential data loss vector) /* Prevent run housekeeping on remote pollers (that not needed)
if (!isset($options['f']) && $config['poller_id'] !== 0) { if ($config['poller_id'] !== 0) {
print_message("%yHousekeeping only needs to be run on the main node. Do not run housekeeping on partitioned pollers.%n\n", 'color'); print_message("%yHouseKeeping only needs to be run on the main node.%n\n", 'color');
exit; exit;
} }
*/
print_message("%g" . OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION . "\n%WHousekeeping%n\n", 'color'); print_message("%g".OBSERVIUM_PRODUCT." ".OBSERVIUM_VERSION."\n%WHouseKeeping%n\n", 'color');
if (OBS_DEBUG) { if (OBS_DEBUG) { print_versions(); }
print_versions();
}
// For interactive prompt/answer checks // For interactive prompt/answer checks
// if it is started from crontab - prompt disabled and answer always 'yes' // if it is started from crontab - prompt disabled and answer always 'yes'
@ -47,45 +43,23 @@ if (is_cron()) {
} }
$answer = TRUE; $answer = TRUE;
$modules = []; $modules = array();
if (isset($options['a']) || isset($options['s'])) {
$modules[] = 'syslog';
}
if (isset($options['a']) || isset($options['e'])) {
$modules[] = 'eventlog';
}
if (isset($options['a']) || isset($options['l'])) {
$modules[] = 'alertlog';
}
if (isset($options['a']) || isset($options['u'])) {
$modules[] = 'authlog';
}
if (isset($options['a']) || isset($options['p'])) {
$modules[] = 'ports';
}
if (isset($options['a']) || isset($options['b'])) {
$modules[] = 'staledb';
}
if (isset($options['a']) || isset($options['i'])) {
$modules[] = 'inventory';
}
if (isset($options['a']) || isset($options['r'])) {
$modules[] = 'rrd';
}
if (isset($options['x'])) {
$modules[] = 'billing_data';
}
if (isset($options['a']) || isset($options['s'])) { $modules[] = 'syslog'; }
if (isset($options['a']) || isset($options['e'])) { $modules[] = 'eventlog'; }
if (isset($options['a']) || isset($options['l'])) { $modules[] = 'alertlog'; }
if (isset($options['a']) || isset($options['u'])) { $modules[] = 'authlog'; }
if (isset($options['a']) || isset($options['p'])) { $modules[] = 'ports'; }
if (isset($options['a']) || isset($options['b'])) { $modules[] = 'staledb'; }
if (isset($options['a']) || isset($options['i'])) { $modules[] = 'inventory'; }
if (isset($options['a']) || isset($options['r'])) { $modules[] = 'rrd'; }
// Get age from command line // Get age from command line
if (isset($options['A'])) { if (isset($options['A'])) {
$age = age_to_seconds($options['A']); $age = age_to_seconds($options['A']);
if ($age) { if ($age) {
foreach ($modules as $module) { foreach ($modules as $module) {
if ($module === 'ports') { if ($module === 'ports') { $module = 'deleted_ports'; }
$module = 'deleted_ports';
}
$config['housekeeping'][$module]['age'] = $age; $config['housekeeping'][$module]['age'] = $age;
} }
} else { } else {
@ -107,7 +81,7 @@ NOTE, by default $scriptname asks 'Are you sure want to delete (y/N)?'.
OPTIONS: OPTIONS:
-V Show version and exit. -V Show version and exit.
-y Automatically answer 'yes' to prompts -y Automatically answer 'yes' to prompts
-a Maintain all modules except billing as specified below. -a Maintain all modules as specified below.
-s Clean up syslog -s Clean up syslog
-e Clean up event log -e Clean up event log
-l Clean up alert log -l Clean up alert log
@ -117,9 +91,6 @@ OPTIONS:
-p Clean up deleted ports -p Clean up deleted ports
-b Clean up stale database entries -b Clean up stale database entries
-A <age> Specifies maximum age for all modules (overrides configuration) -A <age> Specifies maximum age for all modules (overrides configuration)
-f Force run Housekeeping on Poller ID other than 0 (main)
-x Clean up billing data
DEBUGGING OPTIONS: DEBUGGING OPTIONS:
-T Testing, not do any actions, only show counts. -T Testing, not do any actions, only show counts.
@ -138,15 +109,11 @@ $test = isset($options['T']);
foreach ($modules as $module) { foreach ($modules as $module) {
if (is_file($config['install_dir'] . "/includes/housekeeping/$module.inc.php")) { if (is_file($config['install_dir'] . "/includes/housekeeping/$module.inc.php")) {
include($config['install_dir'] . "/includes/housekeeping/$module.inc.php"); include($config['install_dir'] . "/includes/housekeeping/$module.inc.php");
if (!$test) { if (!$test) { set_obs_attrib("housekeeping_lastrun_$module", time()); }
set_obs_attrib("housekeeping_lastrun_$module", time());
}
} else { } else {
print_warning("Housekeeping module not found: $module"); print_warning("Housekeeping module not found: $module");
} }
} }
if (!$test) { if (!$test) { set_obs_attrib("housekeeping_lastrun", time()); }
set_obs_attrib("housekeeping_lastrun", time());
}
// EOF // EOF

View File

@ -3,10 +3,9 @@
Options FollowSymlinks Multiviews Options FollowSymlinks Multiviews
ErrorDocument 404 /error.php?404
RedirectMatch 404 /\. RedirectMatch 404 /\.
RewriteEngine On RewriteEngine on
RewriteBase / RewriteBase /
#Block access to hidden files/dirs #Block access to hidden files/dirs
RewriteRule ^\..*$ - [F,L] RewriteRule ^\..*$ - [F,L]

View File

@ -6,15 +6,19 @@
* *
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
include_once("../../includes/observium.inc.php"); $config['install_dir'] = "../..";
include_once("../../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { if (!$_SESSION['authenticated'])
{
print_json_status('failed', 'Unauthorized.'); print_json_status('failed', 'Unauthorized.');
exit(); exit();
} }
@ -22,7 +26,6 @@ if (!$_SESSION['authenticated']) {
$vars = get_vars([ 'JSON', 'POST' ]); // Got a JSON payload. Replace $var. $vars = get_vars([ 'JSON', 'POST' ]); // Got a JSON payload. Replace $var.
$readonly = $_SESSION['userlevel'] < 7; $readonly = $_SESSION['userlevel'] < 7;
$limitwrite = $_SESSION['userlevel'] >= 9;
$readwrite = $_SESSION['userlevel'] >= 10; $readwrite = $_SESSION['userlevel'] >= 10;
switch ($vars['action']) { switch ($vars['action']) {
@ -53,6 +56,8 @@ switch ($vars['action']) {
print_json_status('ok', 'Big graphs set.'); print_json_status('ok', 'Big graphs set.');
session_unset_var("big_graphs"); // clear old session_unset_var("big_graphs"); // clear old
} }
//session_set_var("big_graphs", TRUE);
//print_json_status('ok', 'Big graphs set.');
break; break;
case "normal_graphs": case "normal_graphs":
@ -61,6 +66,8 @@ switch ($vars['action']) {
print_json_status('ok', 'Normal graphs set.'); print_json_status('ok', 'Normal graphs set.');
session_unset_var("big_graphs"); // clear old session_unset_var("big_graphs"); // clear old
} }
//session_unset_var("big_graphs");
//print_json_status('ok', 'Small graphs set.');
break; break;
case "touch_on": case "touch_on":
@ -73,6 +80,35 @@ switch ($vars['action']) {
print_json_status('ok', 'Touch mode disabled.'); print_json_status('ok', 'Touch mode disabled.');
break; break;
case "set_refresh":
session_set_var("dark_mode", TRUE);
print_json_status('ok', 'Dark mode set.');
break;
case "alert_assoc_edit":
// Currently edit allowed only for Admins
if (!$readwrite) {
print_json_status('failed', 'Action not allowed.');
exit();
}
if (dbFetchRow("SELECT * FROM `alert_tests` WHERE `alert_test_id` = ?", array($vars['alert_test_id']))) {
$rows_updated = dbUpdate([ 'alert_assoc' => $vars['alert_assoc'] ], 'alert_tests', '`alert_test_id` = ?', [ $vars['alert_test_id'] ]);
if ($rows_updated) {
update_alert_table($vars['alert_test_id']);
print_json_status('ok', '', [ 'id' => $vars['alert_test_id'],
'redirect' => generate_url([ 'page' => 'alert_check', 'alert_test_id' => $vars['alert_test_id'] ]) ]);
} else {
print_json_status('failed', 'Database was not updated.');
}
} else {
print_json_status('failed', 'Alert Checker does not exist: [' . $vars['alert_test_id'] . ']');
}
break;
case "save_grid": // Save current layout of dashboard grid case "save_grid": // Save current layout of dashboard grid
// Currently edit allowed only for Admins // Currently edit allowed only for Admins
@ -82,8 +118,8 @@ switch ($vars['action']) {
} }
foreach ($vars['grid'] as $w) { foreach ($vars['grid'] as $w) {
dbUpdate(['x' => $w['x'], 'y' => $w['y'], 'width' => $w['width'], 'height' => $w['height'],], 'dash_widgets', dbUpdate(array('x' => $w['x'], 'y' => $w['y'], 'width' => $w['width'], 'height' => $w['height'],), 'dash_widgets',
'`widget_id` = ?', [$w['id']] '`widget_id` = ?', array($w['id'])
); );
} }
break; break;
@ -97,7 +133,7 @@ switch ($vars['action']) {
} }
if (isset($vars['dash_id']) && isset($vars['widget_type'])) { if (isset($vars['dash_id']) && isset($vars['widget_type'])) {
$widget_id = dbInsert(['dash_id' => $vars['dash_id'], 'widget_config' => json_encode([]), 'widget_type' => $vars['widget_type']], $widget_id = dbInsert(array('dash_id' => $vars['dash_id'], 'widget_config' => json_encode(array()), 'widget_type' => $vars['widget_type']),
'dash_widgets' 'dash_widgets'
); );
} }
@ -118,7 +154,7 @@ switch ($vars['action']) {
} }
if (is_numeric($vars['id'])) { if (is_numeric($vars['id'])) {
$rows_deleted = dbDelete('wifi_aps', '`wifi_ap_id` = ?', [$vars['id']]); $rows_deleted = dbDelete('wifi_aps', '`wifi_ap_id` = ?', array($vars['id']));
} }
if ($rows_deleted) { if ($rows_deleted) {
@ -136,7 +172,7 @@ switch ($vars['action']) {
} }
if (is_numeric($vars['widget_id'])) { if (is_numeric($vars['widget_id'])) {
$rows_deleted = dbDelete('dash_widgets', '`widget_id` = ?', [$vars['widget_id']]); $rows_deleted = dbDelete('dash_widgets', '`widget_id` = ?', array($vars['widget_id']));
} }
if ($rows_deleted) { if ($rows_deleted) {
@ -153,7 +189,7 @@ switch ($vars['action']) {
} }
if (is_numeric($vars['dash_id'])) { if (is_numeric($vars['dash_id'])) {
$rows_updated = dbUpdate(['dash_name' => $vars['dash_name']], 'dashboards', '`dash_id` = ?', [$vars['dash_id']]); $rows_updated = dbUpdate(array('dash_name' => $vars['dash_name']), 'dashboards', '`dash_id` = ?', array($vars['dash_id']));
} else { } else {
print_json_status('failed', 'Invalid Dashboard ID.'); print_json_status('failed', 'Invalid Dashboard ID.');
} }
@ -175,8 +211,8 @@ switch ($vars['action']) {
} }
if (is_numeric($vars['dash_id'])) { if (is_numeric($vars['dash_id'])) {
$rows_deleted = dbDelete('dash_widgets', '`dash_id` = ?', [$vars['dash_id']]); $rows_deleted = dbDelete('dash_widgets', '`dash_id` = ?', array($vars['dash_id']));
$rows_deleted += dbDelete('dashboards', '`dash_id` = ?', [$vars['dash_id']]); $rows_deleted += dbDelete('dashboards', '`dash_id` = ?', array($vars['dash_id']));
} else { } else {
print_json_status('failed', 'Invalid Dashboard ID.'); print_json_status('failed', 'Invalid Dashboard ID.');
} }
@ -199,25 +235,20 @@ switch ($vars['action']) {
exit(); exit();
} }
$widget = dbFetchRow("SELECT * FROM `dash_widgets` WHERE `widget_id` = ?", [$vars['widget_id']]); $widget = dbFetchRow("SELECT * FROM `dash_widgets` WHERE widget_id = ?", array($vars['widget_id']));
$widget['widget_config'] = safe_json_decode($widget['widget_config']); $widget['widget_config'] = safe_json_decode($widget['widget_config']);
// Verify config value applies to this widget here // Verify config value applies to this widget here
$default_on = ['legend'];
if (isset($vars['config_field']) && isset($vars['config_value'])) { if (isset($vars['config_field']) && isset($vars['config_value'])) {
if (empty($vars['config_value']) || if (empty($vars['config_value'])) {
(in_array($vars['config_field'], $default_on) && get_var_true($vars['config_value'])) ||
(!in_array($vars['config_field'], $default_on) && get_var_false($vars['config_value']))) {
// Just unset the value if it's empty or it's a default value.
unset($widget['widget_config'][$vars['config_field']]); unset($widget['widget_config'][$vars['config_field']]);
} else { } else {
$widget['widget_config'][$vars['config_field']] = $vars['config_value']; $widget['widget_config'][$vars['config_field']] = $vars['config_value'];
} }
dbUpdate(['widget_config' => json_encode($widget['widget_config'])], 'dash_widgets', dbUpdate(array('widget_config' => json_encode($widget['widget_config'])), 'dash_widgets',
'`widget_id` = ?', [$widget['widget_id']] '`widget_id` = ?', array($widget['widget_id'])
); );
//echo dbError(); //echo dbError();
@ -234,7 +265,7 @@ switch ($vars['action']) {
// Validate CSRF Token // Validate CSRF Token
//r($vars); //r($vars);
$json = ''; $json = '';
if (!str_contains_array($vars['action'], ['widget', 'dash', 'settings_user']) && // widget & dashboard currently not send request token if (!str_contains_array($vars['action'], [ 'widget', 'dash' ]) && // widget & dashboard currently not send request token
!request_token_valid($vars, $json)) { !request_token_valid($vars, $json)) {
$json = safe_json_decode($json); $json = safe_json_decode($json);
$json['reload'] = TRUE; $json['reload'] = TRUE;
@ -244,7 +275,8 @@ switch ($vars['action']) {
unset($json); unset($json);
$action_path = __DIR__ . '/actions/'. $vars['action'] . '.inc.php'; $action_path = __DIR__ . '/actions/'. $vars['action'] . '.inc.php';
if (is_alpha($vars['action']) && is_file($action_path)) { if (is_alpha($vars['action']) && is_file($action_path))
{
include $action_path; include $action_path;
} else { } else {
print_json_status('failed', 'Unknown action requested.'); print_json_status('failed', 'Unknown action requested.');

View File

@ -1,38 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage ajax
* @copyright (C) Adam Armstrong
*
*/
// Currently edit allowed only for Admins
if (!$limitwrite) {
print_json_status('failed', 'Action not allowed.');
exit();
}
if ($alert_test = dbFetchRow("SELECT * FROM `alert_tests` WHERE `alert_test_id` = ?", [ $vars['alert_test_id'] ])) {
if ($alert_test['alert_assoc'] !== $vars['alert_assoc']) {
if (dbUpdate([ 'alert_assoc' => $vars['alert_assoc'] ], 'alert_tests', '`alert_test_id` = ?', [ $vars['alert_test_id'] ])) {
update_alert_table($vars['alert_test_id']);
print_json_status('ok', 'Associations updated.',
[ 'id' => $vars['alert_test_id'],
'redirect' => generate_url([ 'page' => 'alert_check', 'alert_test_id' => $vars['alert_test_id'] ]) ]);
} else {
print_json_status('failed', 'Database was not updated.');
}
} else {
print_json_status('warning', 'Associations not changed.');
}
} else {
print_json_status('failed', 'Alert Checker does not exist: [' . $vars['alert_test_id'] . ']');
}
// EOF

View File

@ -5,20 +5,20 @@
* This file is part of Observium. * This file is part of Observium.
* *
* @package observium * @package observium
* @subpackage web * @subpackage ajax
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
// Currently allowed only for Admins and Limit Write // Currently allowed only for Admins
if (!$limitwrite) { if (!$readwrite) {
print_json_status('failed', 'Action not allowed.'); print_json_status('failed', 'Action not allowed.');
return; return;
} }
$ok = TRUE; $ok = TRUE;
foreach ([ 'entity_type', 'alert_name', 'alert_severity', 'alert_conditions' ] as $var) { foreach (array('entity_type', 'alert_name', 'alert_severity', 'alert_conditions') as $var) {
if (safe_empty($vars[$var])) { if (!isset($vars[$var]) || strlen($vars[$var]) == '0') {
$ok = FALSE; $ok = FALSE;
$failed[] = $var; $failed[] = $var;
} }
@ -30,20 +30,12 @@ if ($ok) {
return; return;
} }
$check_array = []; $check_array = array();
$conditions = []; $conditions = array();
foreach (explode("\n", trim($vars['alert_conditions'])) as $cond) { foreach (explode("\n", trim($vars['alert_conditions'])) as $cond) {
if (preg_match(OBS_PATTERN_XSS, $cond)) { $condition = array();
print_json_status('failed', "Prevent XSS payload."); list($condition['metric'], $condition['condition'], $condition['value']) = explode(" ", trim($cond), 3);
return;
}
$condition = [];
[ $condition['metric'], $condition['condition'], $condition['value'] ] = explode(" ", trim($cond), 3);
if (!is_alpha($condition['metric'])) {
print_json_status('failed', "Incorrect condition metric '" . escape_html($condition['metric']) . "'");
return;
}
$conditions[] = $condition; $conditions[] = $condition;
} }
$check_array['conditions'] = safe_json_encode($conditions); $check_array['conditions'] = safe_json_encode($conditions);

View File

@ -1,37 +0,0 @@
<?php
if ($_SESSION['userlevel'] >= 8) {
if (is_intnum($vars['value'])) {
$alert_entry = get_alert_entry_by_id($vars['value']);
if(!count($alert_entry)) {
print_json_status('failed', 'Alert entry not found. No update performed.');
die;
}
$update_array = [];
if ($alert_entry['ignore_until_ok'] != 1) {
$update_array['ignore_until_ok'] = '1';
}
if ($alert_entry['alert_status'] == 0) {
$update_array['alert_status'] = '3';
}
if (count($update_array)) {
//r($alert_entry);
dbUpdate($update_array, 'alert_table', 'alert_table_id = ?', [$alert_entry['alert_table_id']]);
$alert_device = device_by_id_cache($alert_entry['device_id']);
//print_message("Alert entry [{$vars['form_alert_table_id']}] for device '{$alert_device['hostname']}' suppressed.");
print_json_status('ok', 'alert '.$vars['form_alert_table_id'].' ignored until ok. status updated.', ['update_array' => $update_array]);
}
unset($update_array);
// FIXME - eventlog? audit log?
}
} else {
print_json_status('failed', 'Action not permitted. Not performed.');
}

View File

@ -6,15 +6,13 @@
* *
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
if ($readonly) { if ($readonly) { return; } // Currently edit allowed only for 7+
return;
} // Currently edit allowed only for 7+
$widget = dbFetchRow("SELECT * FROM `dash_widgets` WHERE `widget_id` = ?", [$vars['widget_id']]); $widget = dbFetchRow("SELECT * FROM `dash_widgets` WHERE widget_id = ?", array($vars['widget_id']));
$widget['widget_config'] = safe_json_decode($widget['widget_config']); $widget['widget_config'] = safe_json_decode($widget['widget_config']);
@ -24,111 +22,11 @@ switch ($widget['widget_type']) {
if (safe_count($widget['widget_config'])) { if (safe_count($widget['widget_config'])) {
// echo '
// <form onsubmit="return false">
// Title <input name="widget-config-input" data-field="title" value="'.$widget['widget_config']['title'].'" data-id="'.$widget['widget_id'].'"></input>
// </form>
// ';
//r($widget['widget_config']);
//r(isset($widget['widget_config']['legend']) && $widget['widget_config']['legend'] === 'no');
$modal_args = [
'id' => 'modal-edit_widget_' . $widget['widget_id'],
'title' => 'Configure Widget',
//'hide' => TRUE,
//'fade' => TRUE,
//'role' => 'dialog',
//'class' => 'modal-md',
];
$form = [
'form_only' => TRUE, // Do not add modal open/close divs (it's generated outside)
'type' => 'horizontal',
'id' => 'edit_widget_' . $widget['widget_id'],
'userlevel' => 7, // Minimum user level for display form
'modal_args' => $modal_args, // !!! This generate modal specific form
//'help' => 'This will completely delete the rule and all associations and history.',
'class' => '', // Clean default box class!
//'url' => generate_url([ 'page' => 'syslog_rules' ]),
'onsubmit' => "return false",
];
$form['fieldset']['body'] = ['class' => 'modal-body']; // Required this class for modal body!
$form['fieldset']['footer'] = ['class' => 'modal-footer']; // Required this class for modal footer!
$form['row'][1]['widget-config-title'] = [
'type' => 'text',
'fieldset' => 'body',
'name' => 'Title',
'placeholder' => 'Graph Title',
'class' => 'input-xlarge',
'attribs' => [
'data-id' => $widget['widget_id'],
'data-field' => 'title',
'data-type' => 'text'
],
'value' => $widget['widget_config']['title']
];
$form['row'][2]['widget-config-legend'] = [
'type' => 'checkbox',
'fieldset' => 'body',
'name' => 'Show Legend',
//'placeholder' => 'Yes, please delete this rule.',
//'onchange' => "javascript: toggleAttrib('disabled', 'delete_button_".$la['la_id']."'); showDiv(!this.checked, 'warning_".$la['la_id']."_div');",
'attribs' => [
'data-id' => $widget['widget_id'],
'data-field' => 'legend',
'data-type' => 'checkbox'
],
'value' => safe_empty($widget['widget_config']['legend']) ? 'yes' : $widget['widget_config']['legend'] //'legend'
];
$form['row'][8]['close'] = [
'type' => 'submit',
'fieldset' => 'footer',
'div_class' => '', // Clean default form-action class!
'name' => 'Close',
'icon' => '',
'attribs' => [
'data-dismiss' => 'modal',
'aria-hidden' => 'true'
]
];
echo generate_form_modal($form);
unset($form);
/*
echo ' echo '
<form onsubmit="return false" class="form form-horizontal" style="margin-bottom: 0px;"> <form onsubmit="return false">
<fieldset> Title <input name="widget-config-input" data-field="title" value="'.$widget['widget_config']['title'].'" data-id="'.$widget['widget_id'].'"></input>
<div id="purpose_div" class="control-group" style="margin-bottom: 10px;"> <!-- START row-1 --> </form>
<label class="control-label" for="purpose">Title</label> ';
<div id="purpose_div" class="controls">
<input type="text" placeholder="Graph Title" name="widget-config-title" class="input" data-field="title" style="width: 100%;" value="'.$widget['widget_config']['title'].'" data-id="'.$widget['widget_id'].'">
</div>
</div>
<div id="ignore_div" class="control-group" style="margin-bottom: 10px;"> <!-- START row-6 -->
<label class="control-label" for="ignore">Show Legend</label>
<div id="ignore_div" class="controls">
<input type="checkbox" name="widget-config-legend" data-field="legend" data-type="checkbox" value="legend" '.(isset($widget['widget_config']['legend']) && $widget['widget_config']['legend'] === 'no' ? '' : 'checked').' data-id="'.$widget['widget_id'].'">
</div>
</div>
</fieldset> <!-- END fieldset-body -->
<div class="modal-footer">
<fieldset>
<button id="close" name="close" type="submit" class="btn btn-default text-nowrap" value="" data-dismiss="modal" aria-hidden="true">Close</button>
<!-- <button id="action" name="action" type="submit" class="btn btn-primary text-nowrap" value="add_contact"><i style="margin-right: 0px;" class="icon-ok icon-white"></i>&nbsp;&nbsp;Add Contact</button> -->
</fieldset>
</div>
</form>';
*/
} else { } else {
@ -143,7 +41,8 @@ switch ($widget['widget_type']) {
break; break;
default: default:
r($widget['widget_config']); print_vars($widget);
} }
// EOF // EOF

View File

@ -6,7 +6,7 @@
* *
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
@ -15,14 +15,15 @@ $update_ports = [];
//r($vars); //r($vars);
//$ports_attribs = get_device_entities_attribs($device_id, 'port'); // Get all attribs //$ports_attribs = get_device_entities_attribs($device_id, 'port'); // Get all attribs
foreach ($vars['port'] as $port_id => $port_data) { foreach($vars['port'] as $port_id => $port_data)
{
if (is_entity_write_permitted('port', $port_id)) { if (is_entity_write_permitted('port', $port_id)) {
$port = get_port_by_id_cache($port_id); $port = get_port_by_id_cache($port_id);
$device = device_by_id_cache($port['device_id']); $device = device_by_id_cache($port['device_id']);
$updated = FALSE; $updated = FALSE;
$update_array = []; $update_array = array();
$port_attribs = get_entity_attribs('port', $port['port_id']); $port_attribs = get_entity_attribs('port', $port['port_id']);
@ -31,7 +32,7 @@ foreach ($vars['port'] as $port_id => $port_data) {
} }
// Check ignored and disabled port // Check ignored and disabled port
foreach (['ignore', 'disabled'] as $param) { foreach (array('ignore', 'disabled') as $param) {
$old_param = $port[$param] ? 1 : 0; $old_param = $port[$param] ? 1 : 0;
$new_param = (isset($port_data[$param]) && $port_data[$param]) ? 1 : 0; $new_param = (isset($port_data[$param]) && $port_data[$param]) ? 1 : 0;
if ($old_param != $new_param) { if ($old_param != $new_param) {
@ -40,7 +41,7 @@ foreach ($vars['port'] as $port_id => $port_data) {
} }
if (count($update_array)) { if (count($update_array)) {
dbUpdate($update_array, 'ports', '`port_id` = ?', [$port_id]); dbUpdate($update_array, 'ports', '`port_id` = ?', array($port_id));
$updated = TRUE; $updated = TRUE;
} }

View File

@ -1,35 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage web
* @copyright (C) Adam Armstrong
*
*/
// Currently, allowed only for Admins
if (!$readwrite) {
print_json_status('failed', 'Insufficient permissions to delete role.');
return;
}
$role_id = (int)$vars['role_id'];
if ($role_id > 0) {
$rows_deleted = dbDelete('roles', '`role_id` = ?', [$role_id]);
//$rows_deleted = 0;
if ($rows_deleted > 0) {
dbDelete('roles_entity_permissions', '`role_id` = ?', [$role_id]);
dbDelete('roles_permissions', '`role_id` = ?', [$role_id]);
dbDelete('roles_users', '`role_id` = ?', [$role_id]);
print_json_status('ok', 'Role deleted successfully.', ['reload' => TRUE]);
} else {
print_json_status('failed', 'Failed to delete role.');
}
} else {
print_json_status('failed', 'Invalid role ID.');
}
// EOF

View File

@ -6,7 +6,7 @@
* *
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
@ -30,8 +30,8 @@ foreach ($vars['sensors'] as $sensor_id => $sensor_update) {
} else { } else {
// State sensors not allow edit limits // State sensors not allow edit limits
$fields_switch = ['sensor_ignore']; $fields_switch = array('sensor_ignore');
$fields_limit = []; $fields_limit = array();
} }
// Switch selectors // Switch selectors
@ -63,7 +63,7 @@ foreach ($vars['sensors'] as $sensor_id => $sensor_update) {
} }
if (count($update_array)) { if (count($update_array)) {
dbUpdate($update_array, 'sensors', '`sensor_id` = ?', [$sensor['sensor_id']]); dbUpdate($update_array, 'sensors', '`sensor_id` = ?', array($sensor['sensor_id']));
$msg = 'Sensor updated (custom): ' . $sensor['sensor_class'] . ' ' . $sensor['sensor_type'] . ' ' . $sensor['sensor_id'] . ' ' . escape_html($sensor['sensor_descr']) . ' '; $msg = 'Sensor updated (custom): ' . $sensor['sensor_class'] . ' ' . $sensor['sensor_type'] . ' ' . $sensor['sensor_id'] . ' ' . escape_html($sensor['sensor_descr']) . ' ';
if ($update_array['sensor_limit_low']) { if ($update_array['sensor_limit_low']) {
$msg .= '[L: ' . $update_array['sensor_limit_low'] . ']'; $msg .= '[L: ' . $update_array['sensor_limit_low'] . ']';

View File

@ -6,7 +6,7 @@
* *
* @package observium * @package observium
* @subpackage web * @subpackage web
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
@ -34,7 +34,7 @@ $updates = 0;
// Set fields that were submitted with custom value // Set fields that were submitted with custom value
if (safe_count($sets)) { if (safe_count($sets)) {
$query = 'SELECT * FROM `users_prefs` WHERE `user_id` = ?' . generate_query_values_and(array_keys($sets), 'pref'); $query = 'SELECT * FROM `users_prefs` WHERE `user_id` = ?' . generate_query_values(array_keys($sets), 'pref');
// Fetch current rows in config file so we know which one to UPDATE and which one to INSERT // Fetch current rows in config file so we know which one to UPDATE and which one to INSERT
$in_db = []; $in_db = [];
foreach (dbFetchRows($query, [ $user_id ]) as $row) { foreach (dbFetchRows($query, [ $user_id ]) as $row) {
@ -52,7 +52,7 @@ if (safe_count($sets)) {
// Delete fields that were reset to default // Delete fields that were reset to default
if (safe_count($deletes)) { if (safe_count($deletes)) {
dbDelete('users_prefs', '`user_id` = ? ' . generate_query_values_and($deletes, 'pref'), [$user_id]); dbDelete('users_prefs', '`user_id` = ? ' . generate_query_values($deletes, 'pref'), [ $user_id ]);
$updates++; $updates++;
} }

View File

@ -1,66 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage web
* @copyright (C) Adam Armstrong
*
*/
switch (str_replace('->', '|', $vars['setting'])) {
case "theme":
case "web_theme_default":
$pref = 'web_theme_default';
if ($vars['value'] === 'reset') {
session_unset_var("theme");
if ($config['web_theme_default'] === 'system') {
// Override default
session_unset_var("theme_default");
}
if (del_user_pref($_SESSION['user_id'], $pref)) {
print_json_status('ok', 'Theme reset.');
}
} elseif (isset($config['themes'][$vars['value']]) || $vars['value'] === 'system') {
if (set_user_pref($_SESSION['user_id'], $pref, serialize($vars['value']))) {
print_json_status('ok', 'Theme set.');
}
} else {
print_json_status('failed', 'Invalid theme.');
}
break;
case "big_graphs":
$pref = 'graphs|size';
if (set_user_pref($_SESSION['user_id'], $pref, serialize('big'))) {
print_json_status('ok', 'Big graphs set.');
session_unset_var("big_graphs"); // clear old
}
//session_set_var("big_graphs", TRUE);
//print_json_status('ok', 'Big graphs set.');
break;
case "normal_graphs":
$pref = 'graphs|size';
if (set_user_pref($_SESSION['user_id'], $pref, serialize('normal'))) {
print_json_status('ok', 'Normal graphs set.');
session_unset_var("big_graphs"); // clear old
}
//session_unset_var("big_graphs");
//print_json_status('ok', 'Small graphs set.');
break;
case "sensors|web_measured_compact":
// BOOL values
$pref = $vars['setting'];
if (set_user_pref($_SESSION['user_id'], $pref, serialize(get_var_true($vars['value'])))) {
print_json_status('ok', 'Setting was set.', ['reload' => TRUE]);
}
break;
}
// EOF

View File

@ -6,7 +6,7 @@
* *
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
@ -22,8 +22,8 @@ foreach ($vars['status'] as $status_id => $status_update) {
$device_id = $status['device_id']; $device_id = $status['device_id'];
$fields_switch = ['status_ignore']; $fields_switch = array('status_ignore');
$fields_limit = []; $fields_limit = array();
// Switch selectors // Switch selectors
foreach ($fields_switch as $field) { foreach ($fields_switch as $field) {
@ -34,7 +34,7 @@ foreach ($vars['status'] as $status_id => $status_update) {
} }
if (count($update_array)) { if (count($update_array)) {
dbUpdate($update_array, 'status', '`status_id` = ?', [$status['status_id']]); dbUpdate($update_array, 'status', '`status_id` = ?', array($status['status_id']));
$msg = 'Status updated (custom): ' . $status['status_type'] . ' ' . $status['status_id'] . ' ' . escape_html($status['status_descr']) . ' '; $msg = 'Status updated (custom): ' . $status['status_type'] . ' ' . $status['status_id'] . ' ' . escape_html($status['status_descr']) . ' ';
log_event($msg, $device_id, 'status', $status['status_id']); log_event($msg, $device_id, 'status', $status['status_id']);
$rows_updated++; $rows_updated++;

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Observium * Observium
* *
@ -6,26 +7,31 @@
* *
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @copyright (C) Adam Armstrong * @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* *
*/ */
include_once("../../includes/observium.inc.php"); $config['install_dir'] = "../..";
include_once("../../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
echo("unauthenticated");
exit;
}
if ($_SESSION['userlevel'] >= '5') { if ($_SESSION['userlevel'] >= '5')
{
switch ($_GET['entity_type']) { switch ($_GET['entity_type'])
{
case "sensor": case "sensor":
foreach (dbFetchRows("SELECT * FROM `sensors` WHERE device_id = ?", [$_GET['device_id']]) as $sensor) { foreach (dbFetch("SELECT * FROM `sensors` WHERE device_id = ?", array($_GET['device_id'])) as $sensor)
if (is_entity_permitted($sensor, 'sensor')) { {
if(is_entity_permitted($sensor, 'sensor'))
{
$string = addslashes($sensor['sensor_descr']); $string = addslashes($sensor['sensor_descr']);
echo("obj.options[obj.options.length] = new Option('".$string."','".$sensor['sensor_id']."');\n"); echo("obj.options[obj.options.length] = new Option('".$string."','".$sensor['sensor_id']."');\n");
} }
@ -33,7 +39,8 @@ if ($_SESSION['userlevel'] >= '5') {
break; break;
case "netscalervsvr": case "netscalervsvr":
foreach (dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ?", [$_GET['device_id']]) as $entity) { foreach (dbFetch("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ?", array($_GET['device_id'])) as $entity)
{
$string = addslashes($entity['vsvr_label']); $string = addslashes($entity['vsvr_label']);
echo("obj.options[obj.options.length] = new Option('".$string."','".$entity['vsvr_id']."');\n"); echo("obj.options[obj.options.length] = new Option('".$string."','".$entity['vsvr_id']."');\n");
} }
@ -41,7 +48,8 @@ if ($_SESSION['userlevel'] >= '5') {
case "port": case "port":
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `deleted` = '0'", [$_GET['device_id']]) as $port) { foreach (dbFetch("SELECT * FROM `ports` WHERE `device_id` = ? AND `deleted` = '0'", array($_GET['device_id'])) as $port)
{
$string = addslashes($port['port_label_short']." - ".$port['ifAlias']); $string = addslashes($port['port_label_short']." - ".$port['ifAlias']);
echo("obj.options[obj.options.length] = new Option('".$string."','".$port['port_id']."');\n"); echo("obj.options[obj.options.length] = new Option('".$string."','".$port['port_id']."');\n");
} }
@ -50,4 +58,4 @@ if ($_SESSION['userlevel'] >= '5') {
} }
// EOF ?>

View File

@ -8,29 +8,33 @@
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @author Adam Armstrong <adama@observium.org> * @author Adam Armstrong <adama@observium.org>
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* *
*/ */
include_once("../../includes/observium.inc.php"); $config['install_dir'] = "../..";
include_once("../../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
echo("unauthenticated");
exit;
}
if (is_numeric($_GET['device_id']) && device_permitted($_GET['device_id'])) { if (is_numeric($_GET['device_id']) && device_permitted($_GET['device_id']))
foreach (dbFetchRows("SELECT `port_id`,`port_label_short`,`ifAlias`,`ifDescr`,`ifName` FROM `ports` WHERE `device_id` = ? AND deleted = 0 ORDER BY ifIndex", [$_GET['device_id']]) as $interface) { {
$descr = []; foreach (dbFetchRows("SELECT `port_id`,`port_label_short`,`ifAlias`,`ifDescr`,`ifName` FROM `ports` WHERE `device_id` = ? AND deleted = 0 ORDER BY ifIndex", array($_GET['device_id'])) as $interface)
if (empty($interface['port_label_short'])) { {
$descr = array();
if (empty($interface['port_label_short']))
{
$device = device_by_id_cache($interface['port_id']); $device = device_by_id_cache($interface['port_id']);
process_port_label($interface, $device); process_port_label($interface, $device);
} }
$descr[] = $interface['port_label_short']; $descr[] = $interface['port_label_short'];
if ($interface['ifAlias']) { if ($interface['ifAlias'])
{
// second part // second part
$descr[] = $interface['ifAlias']; $descr[] = $interface['ifAlias'];
} }

View File

@ -8,24 +8,26 @@
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @author Adam Armstrong <adama@observium.org> * @author Adam Armstrong <adama@observium.org>
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* *
*/ */
include_once("../../includes/observium.inc.php"); $config['install_dir'] = "../..";
include_once("../../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
echo("unauthenticated");
exit;
}
$result = []; $result = array();
if ($_SESSION['userlevel'] >= '5') { if ($_SESSION['userlevel'] >= '5')
{
switch ($_GET['entity_type']) { switch ($_GET['entity_type'])
{
case "port": case "port":

View File

@ -6,29 +6,25 @@
* *
* @package observium * @package observium
* @subpackage web * @subpackage web
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
require_once("../../includes/observium.inc.php"); $config['install_dir'] = "../..";
require_once($config['install_dir']."/includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { if (!$_SESSION['authenticated']) { print_error('Session expired, please log in again!'); exit; }
print_error('Session expired, please log in again!');
exit;
}
ob_start(); ob_start();
$vars = get_vars([ 'JSON', 'POST', 'GET' ]); $vars = get_vars();
$vars['page'] = "popup"; $vars['page'] = "popup";
if (isset($vars['debug'])) {
r($vars);
}
switch ($vars['entity_type']) { switch ($vars['entity_type']) {
case "port": case "port":
if (is_numeric($vars['entity_id']) && (port_permitted($vars['entity_id']))) { if (is_numeric($vars['entity_id']) && (port_permitted($vars['entity_id']))) {
@ -39,23 +35,6 @@ switch ($vars['entity_type']) {
} }
break; break;
case "link":
if (is_numeric($vars['entity_id_a']) && (port_permitted($vars['entity_id_a']))) {
$port = get_port_by_id($vars['entity_id_a']);
echo generate_port_popup($port);
} else {
print_warning("You are not permitted to view this port.");
}
if (is_numeric($vars['entity_id_b']) && (port_permitted($vars['entity_id_b']))) {
$port = get_port_by_id($vars['entity_id_b']);
echo generate_port_popup($port, '', 'none'); // suppress graph for b side of link
} else {
print_warning("You are not permitted to view this port.");
}
break;
case "device": case "device":
if (is_numeric($vars['entity_id']) && device_permitted($vars['entity_id'])) { if (is_numeric($vars['entity_id']) && device_permitted($vars['entity_id'])) {
$device = device_by_id_cache($vars['entity_id']); $device = device_by_id_cache($vars['entity_id']);
@ -68,17 +47,21 @@ switch ($vars['entity_type']) {
case "group": case "group":
if (is_numeric($vars['entity_id']) && $_SESSION['userlevel'] >= 5) { if (is_numeric($vars['entity_id']) && $_SESSION['userlevel'] >= 5) {
$group = get_group_by_id($vars['entity_id']); $group = get_group_by_id($vars['entity_id']);
echo generate_group_popup_header($group); echo generate_group_popup_header($group, array());
} else { } else {
print_warning("You are not permitted to view this group."); print_warning("You are not permitted to view this group.");
} }
break; break;
// FIXME : mac is not an observium entity. This should go elsewhere!
case "mac": case "mac":
if (preg_match('/^' . OBS_PATTERN_MAC . '$/i', $vars['entity_id'])) { if (preg_match('/^' . OBS_PATTERN_MAC . '$/i', $vars['entity_id'])) {
$mac = format_mac($vars['entity_id']);
// Other way by using Pear::Net_MAC, see here: http://pear.php.net/manual/en/package.networking.net-mac.importvendors.php // Other way by using Pear::Net_MAC, see here: http://pear.php.net/manual/en/package.networking.net-mac.importvendors.php
if ($response = get_http_def('macvendors_mac', [ 'mac' => format_mac($vars['entity_id']) ])) { $url = 'https://api.macvendors.com/' . urlencode($mac);
echo 'MAC vendor: ' . escape_html($response); $response = get_http_request($url);
if ($response) {
echo 'MAC vendor: ' . $response;
} else { } else {
echo 'Not Found'; echo 'Not Found';
} }
@ -88,7 +71,7 @@ switch ($vars['entity_type']) {
break; break;
case "ip": case "ip":
$ip = explode('/', $vars['entity_id'])[0]; list($ip) = explode('/', $vars['entity_id']);
if ($ip_version = get_ip_version($ip)) { if ($ip_version = get_ip_version($ip)) {
$cache_key = 'response_' . $vars['entity_type'] . '_' . $ip; $cache_key = 'response_' . $vars['entity_type'] . '_' . $ip;
@ -101,12 +84,94 @@ switch ($vars['entity_type']) {
} }
$response = ''; $response = '';
if ($reverse_dns = gethostbyaddr6($ip)) { $reverse_dns = gethostbyaddr6($ip);
$response .= '<h4>' . escape_html($reverse_dns) . '</h4><hr />' . PHP_EOL; if ($reverse_dns) {
$response .= '<h4>' . $reverse_dns . '</h4><hr />' . PHP_EOL;
} }
// WHOIS // WHOIS
$response .= escape_html(ip_whois($ip)); if (!isset($config['http_proxy']) && is_executable($config['whois'])) {
// Use direct whois cmd query (preferred)
// NOTE, for now not tested and not supported for KRNIC, ie: 202.30.50.0, 2001:02B8:00A2::
$cmd = $config['whois'] . ' ' . $ip;
$whois = external_exec($cmd);
$multi_whois = explode('# start', $whois); // Some time whois return multiple (ie: whois 8.8.8.8), than use last
if (safe_count($multi_whois) > 1) {
$whois = array_pop($multi_whois);
}
$org = 0;
foreach (explode("\n", $whois) as $line) {
if (preg_match('/^(\w[\w\s\-\/]+):.*$/', $line, $matches)) {
if (in_array($matches[1], [ 'Ref', 'source', 'nic-hdl-br' ])) {
if ($org === 1) {
$response .= PHP_EOL;
$org++;
continue;
}
break;
}
if (in_array($matches[1], array('Organization', 'org', 'mnt-irt'))) {
$org++; // has org info
} elseif ($matches[1] === 'Comment') {
continue; // skip comments
}
$response .= $line . PHP_EOL;
}
}
} else {
// Use RIPE whois API query
$whois_url = 'https://stat.ripe.net/data/whois/data.json?';
$whois_url .= 'sourceapp=' . urlencode(OBSERVIUM_PRODUCT . '-' . get_unique_id());
$whois_url .= '&resource=' . urlencode($ip);
if ($request = get_http_request($whois_url)) {
$request = safe_json_decode($request); // Convert to array
if ($request['status'] === 'ok' && safe_count($request['data']['records'])) {
$whois_parts = array();
foreach ($request['data']['records'] as $i => $parts) {
$key = $parts[0]['key'];
if (in_array($key, [ 'NetRange', 'inetnum', 'inet6num' ])) {
$org = 0;
$whois_parts[0] = '';
foreach ($parts as $part) {
if (in_array($part['key'], [ 'Ref', 'source', 'nic-hdl-br' ])) {
break;
}
if (in_array($part['key'], [ 'Organization', 'org', 'mnt-irt' ])) {
$org = 1; // has org info
$org_name = $part['value'];
} elseif ($part['key'] === 'Comment') {
continue; // skip comments
}
$whois_parts[0] .= sprintf('%-16s %s' . PHP_EOL, $part['key'] . ':', $part['value']);
}
} elseif ($org === 1 && $key === 'OrgName' && strpos($org_name, $parts[0]['value']) === 0) {
$whois_parts[1] = '';
foreach ($parts as $part) {
if (in_array($part['key'], [ 'Ref', 'source', 'nic-hdl-br' ])) {
break;
}
if ($part['key'] === 'Comment') {
continue; // skip comments
}
$whois_parts[1] .= sprintf('%-16s %s' . PHP_EOL, $part['key'] . ':', $part['value']);
}
break;
}
}
$response .= implode(PHP_EOL, $whois_parts);
//print_vars($request['data']['records']);
}
}
}
if ($response) { if ($response) {
$cache_entry = '<pre class="small">' . $response . '</pre>'; $cache_entry = '<pre class="small">' . $response . '</pre>';
@ -190,9 +255,8 @@ switch ($vars['entity_type']) {
break; break;
} }
$cache_entry = '<div style="width: 280px;">'; $cache_entry = '<div style="width: 280px;">';
$cache_entry .= "<h4>" . escape_html($last_reason) . "</h4><hr />"; $cache_entry .= "<h4>$last_reason</h4><hr />";
$cache_entry .= '<strong style="margin-left: 10px;">Autodiscovery checked:</strong> ' . $cache_entry .= '<strong style="margin-left: 10px;">Autodiscovery checked:</strong> '. format_uptime(time() - $entry['last_checked_unixtime'], 'shorter') . ' ago</span>';
format_uptime(get_time() - $entry['last_checked_unixtime'], 'shorter') . ' ago</span>';
$cache_entry .= '</div>'; $cache_entry .= '</div>';
//$cache_entry .= build_table_row($entry); //$cache_entry .= build_table_row($entry);
set_cache_session($cache_key, $cache_entry); set_cache_session($cache_key, $cache_entry);
@ -202,76 +266,9 @@ switch ($vars['entity_type']) {
} }
break; break;
case 'latlon':
// Check if latitude and longitude are set
if (!isset($vars['lat'], $vars['lon'])) {
echo "ERROR: Latitude and Longitude required";
break;
}
$location = [];
// Fetch devices and their locations
$devices = dbFetchRows("SELECT * FROM `devices` LEFT JOIN `devices_locations` USING (`device_id`) " .
generate_where_clause(generate_query_permitted_ng(['devices']),
"location_lat = ? AND location_lon = ?"),
[$vars['lat'], $vars['lon']]);
foreach ($devices as $device) {
if (!$config['web_show_disabled'] && $device["disabled"]) {
continue;
}
if ($device['location'] != '') {
$location['location_name'] = $device['location'];
}
// Categorize devices as up or down
if ($device["status"] == "0" && $device["ignore"] == "0") {
$location["down_hosts"][] = $device;
} else {
$location["up_hosts"][] = $device;
}
}
// Display location information
if (!isset($location['location_name'])) {
echo "Unknown Location";
} else {
$num_up = safe_count($location["up_hosts"]);
$num_down = safe_count($location["down_hosts"]);
$total_hosts = $num_up + $num_down;
$state = 'unknown';
if ($num_down > 0) {
$state = 'down';
} elseif ($num_up > 0) {
$state = 'up';
}
// Generate tooltip content
$tooltip = "<h3>" . escape_html($location['location_name']) . "</h3><hr />";
$tooltip .= '<p><span class="label label-success">Up ' . $num_up . '</span>
<span class="label label-error">Down ' . $num_down . '</span></p>';
if($num_up < 50) {
foreach ($location["up_hosts"] as $host) {
$tooltip .= '<span class="label label-success">' . escape_html($host['hostname']) . '</span> ';
}
}
foreach ($location["down_hosts"] as $host) {
$tooltip .= '<span class="label label-error">' . escape_html($host['hostname']) . '</span> ';
}
//$tooltip .= "<p><small>Coordinates: ".$vars['lat'].",".$vars['lon']."</small></p>";
echo $tooltip;
}
break;
default: default:
if (isset($config['entities'][$vars['entity_type']])) { if (isset($config['entities'][$vars['entity_type']])) {
$entity_ids = []; $entity_ids = array();
foreach (explode(',', $vars['entity_id']) as $id) { foreach (explode(',', $vars['entity_id']) as $id) {
// Filter permitted IDs // Filter permitted IDs
if (is_numeric($id) && (is_entity_permitted($id, $vars['entity_type']))) { if (is_numeric($id) && (is_entity_permitted($id, $vars['entity_type']))) {
@ -280,6 +277,11 @@ switch ($vars['entity_type']) {
} }
if (count($entity_ids)) { if (count($entity_ids)) {
echo generate_entity_popup_multi($entity_ids, $vars); echo generate_entity_popup_multi($entity_ids, $vars);
//}
//elseif (is_numeric($vars['entity_id']) && (is_entity_permitted($vars['entity_id'], $vars['entity_type'])))
//{
// $entity = get_entity_by_id_cache($vars['entity_type'], $vars['entity_id']);
// echo generate_entity_popup($entity, $vars);
} else { } else {
print_warning("You are not permitted to view this entity."); print_warning("You are not permitted to view this entity.");
} }

View File

@ -1,95 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage web
* @copyright (C) Adam Armstrong
*
*/
ini_set('allow_url_fopen', 0); // Why here?
include_once("../../includes/observium.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php");
include($config['html_dir'] . "/includes/cache-data.inc.php");
if (!$_SESSION['authenticated']) {
echo("unauthenticated");
exit;
}
$vars = get_vars('GET');
$geo = [];
foreach (dbFetchRows("SELECT * FROM `devices` LEFT JOIN `devices_locations` USING (`device_id`) " . generate_where_clause(generate_query_permitted_ng(['devices']))) as $device) {
if (!$config['web_show_disabled'] && $device["disabled"]) {
continue;
}
$lat = (is_numeric($device['location_lat']) ? $device['location_lat'] : $config['geocoding']['default']['lat']);
$lon = (is_numeric($device['location_lon']) ? $device['location_lon'] : $config['geocoding']['default']['lon']);
if ($device["status"] == "0") {
if ($device["ignore"] == "0") {
$locations[$lat][$lon]["down_hosts"][] = $device;
}
} else {
$locations[$lat][$lon]["up_hosts"][] = $device;
}
}
foreach ($locations as $la => $lat) {
foreach ($lat as $lo => $lon) {
$tooltip = "";
$num_up = safe_count($lon["up_hosts"]);
$num_down = safe_count($lon["down_hosts"]);
$total_hosts = $num_up + $num_down;
$tooltip = '<p><span class="label label-success">Up ' . $num_up . '</span> <span class="label label-error">Down ' . $num_down . '</span></p>';
$state = 'unknown';
$location_name = "";
if ($num_down > 0) {
$state = 'down';
$location_name = ($lon['down_hosts'][0]['location'] === '' ? OBS_VAR_UNSET : $lon['down_hosts'][0]['location']);
$location_url = generate_location_url($lon['down_hosts'][0]['location']);
} elseif ($num_up > 0) {
$state = 'up';
$location_name = ($lon['up_hosts'][0]['location'] === '' ? OBS_VAR_UNSET : $lon['up_hosts'][0]['location']);
$location_url = generate_location_url($lon['up_hosts'][0]['location']);
}
$tooltip = "<h3>" . $location_name . "</h3><hr />" . $tooltip;
foreach ($lon["down_hosts"] as $down_host) {
$tooltip .= '<span class="label label-error">' . escape_html($down_host['hostname']) . '</span> ';
}
$feature = ['geometry' => ['type' => 'Point',
'coordinates' => [(float)$lo, (float)$la]],
'type' => 'Feature',
'properties' => ['name' => $location_name,
'state' => $state,
'id' => safename($location_name),
//'popupContent' => $tooltip,
'url' => $location_url]];
$features[] = $feature;
//echo "[$la, $lo, $num_up, $num_down, \"$tooltip\", '$location_name', '$location_url'],\n ";
}
}
$geo = ['type' => 'FeatureCollection', 'features' => $features];
header('Content-type: application/javascript');
//echo 'var geojson = ' . json_encode($geo) . ';';
//print_r($features);
echo safe_json_encode($geo);
//r($geo);
// EOF

View File

@ -1,93 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage ajax
* @author Adam Armstrong <adama@observium.org>
* @copyright (C) Adam Armstrong
*
*/
include_once("../../includes/observium.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) {
echo("unauthenticated");
exit;
}
if ($_SESSION['userlevel'] >= '5') {
$options = [];
$device_id = filter_input(INPUT_GET, 'device_id', FILTER_SANITIZE_NUMBER_INT);
$entity_type = filter_input(INPUT_GET, 'entity_type', FILTER_SANITIZE_STRING);
switch ($entity_type) {
case "device":
include($config['html_dir'] . '/includes/cache-data.inc.php');
$options = generate_device_form_values(NULL, NULL, [ 'filter_mode' => 'exclude', 'subtext' => '%location%', 'show_disabled' => TRUE, 'show_icon' => TRUE ]);
break;
case "sensor":
foreach (dbFetchRows("SELECT * FROM `sensors` WHERE device_id = ?", [ $device_id ]) as $sensor) {
if (is_entity_permitted($sensor, 'sensor')) {
$nice_class = nicecase($sensor['sensor_class']);
$symbol = str_replace('&deg;', '°', $config['sensor_types'][$sensor['sensor_class']]['symbol']);
$options[] = [
'value' => $sensor['sensor_id'],
'group' => $nice_class,
'name' => addslashes($sensor['sensor_descr']),
'subtext' => round($sensor['sensor_value'],2) . $symbol,
'icon' => $config['sensor_types'][$sensor['sensor_class']]['icon'],
//'class' => 'bg-info'
];
}
}
break;
case "netscalervsvr":
// Example for netscalervsvr type
foreach (dbFetchRows("SELECT * FROM `netscaler_vservers` WHERE device_id = ?", [ $device_id ]) as $entity) {
$options[] = [
'value' => $entity['vsvr_id'],
'name' => addslashes($entity['vsvr_label']),
//'subtext' => 'Extra details for netscalervsvr',
//'icon' => 'netscaler-icon',
//'class' => 'custom-class'
];
}
break;
case "port":
// Example for port type
foreach (dbFetchRows("SELECT * FROM `ports` WHERE device_id = ? AND deleted = 0", [$_GET['device_id']]) as $port) {
humanize_port($port);
$port_type = $port['human_type'];
$options[] = [
'value' => $port['port_id'],
'group' => $port_type,
'name' => addslashes($port['port_label_short']),
//'content' => addslashes($port['port_label_short']) . ' <span class="label">'.format_si($port['ifSpeed']).'bps</span> ',
'subtext' => '['.format_si($port['ifSpeed']).'bps] ' . addslashes($port['ifAlias']),
'icon' => $port['icon'],
//'class' => 'port-class'
];
}
break;
}
echo json_encode($options, JSON_UNESCAPED_UNICODE); // Return JSON encoded data
}

View File

@ -6,29 +6,27 @@
* *
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
// FIXME, create api-internal for such // FIXME, create api-internal for such
include_once("../../includes/observium.inc.php"); $config['install_dir'] = "../..";
include_once("../../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { if (!$_SESSION['authenticated']) { echo('<li class="nav-header">Session expired, please log in again!</li>'); exit; }
echo('<li class="nav-header">Session expired, please log in again!</li>');
exit;
}
$vars = get_vars('GET'); $vars = get_vars('GET');
$array_filter = in_array($vars['field'], [ 'syslog_program' ], TRUE); // modules with cached field $array_filter = in_array($vars['field'], [ 'syslog_program' ], TRUE); // modules with cached field
if (!safe_empty($vars['field']) && $vars['cache'] !== 'no' && ($array_filter || safe_empty($vars['query']))) { if (!safe_empty($vars['field']) && $vars['cache'] !== 'no' && ($array_filter || safe_empty($vars['query']))) {
$cache_key = 'options_' . $vars['field']; $cache_key = 'options_' . $vars['field'];
foreach ($vars as $param => $value) { foreach ($vars as $param => $value) {
if (in_array($param, ['field', 'query', 'cache'], TRUE)) { if (in_array($param, [ 'field', 'query', 'cache' ], TRUE)) { continue; }
continue;
}
$cache_key .= "_$param=$value"; $cache_key .= "_$param=$value";
} }
} else { } else {
@ -42,40 +40,36 @@ if ($cache_key && $options = get_cache_session($cache_key)) {
//echo safe_json_encode(array('options' => $_SESSION['cache'][$cache_key])); //echo safe_json_encode(array('options' => $_SESSION['cache'][$cache_key]));
//$options = $_SESSION['cache'][$cache_key]; //$options = $_SESSION['cache'][$cache_key];
} else { } else {
$where = []; $params = array();
$params = [];
//print_vars($vars); //print_vars($vars);
switch ($vars['field']) { switch ($vars['field']) {
case 'ipv4_network': case 'ipv4_network':
case 'ipv6_network': case 'ipv6_network':
$ip_version = explode('_', $vars['field'])[0]; list($ip_version) = explode('_', $vars['field']);
$query_permitted = generate_query_permitted_ng('ports'); $query_permitted = generate_query_permitted('ports');
$network_permitted = dbFetchColumn('SELECT DISTINCT(`' . $ip_version . '_network_id`) FROM `' . $ip_version . '_addresses` WHERE ' . $query_permitted); $network_permitted = dbFetchColumn('SELECT DISTINCT(`' . $ip_version . '_network_id`) FROM `' . $ip_version . '_addresses` WHERE 1' . $query_permitted);
$where[] = generate_query_values($network_permitted, $ip_version . '_network_id'); $query = 'SELECT `' . $ip_version . '_network` FROM `' . $ip_version . '_networks` WHERE 1 ' . generate_query_values($network_permitted, $ip_version . '_network_id');
if (!safe_empty($vars['query'])) { if (!safe_empty($vars['query'])) {
//$query .= ' AND `' . $ip_version . '_network` LIKE ?'; //$query .= ' AND `' . $ip_version . '_network` LIKE ?';
//$params[] = '%' . $vars['query'] . '%'; //$params[] = '%' . $vars['query'] . '%';
$where[] = generate_query_values($vars['query'], $vars['field'], '%LIKE%'); $query .= generate_query_values($vars['query'], $vars['field'], '%LIKE%');
} }
$query = 'SELECT `' . $ip_version . '_network` FROM `' . $ip_version . '_networks` ';
$query .= generate_where_clause($where);
$query .= ' ORDER BY `' . $ip_version . '_network`;'; $query .= ' ORDER BY `' . $ip_version . '_network`;';
//print_vars($query); //print_vars($query);
break; break;
case 'ifspeed': case 'ifspeed':
$query_permitted = generate_query_permitted('ports'); $query_permitted = generate_query_permitted('ports');
$query = 'SELECT `ifSpeed`, COUNT(`ifSpeed`) as `count` FROM `ports` WHERE `ifSpeed` > 0 ' . $query = 'SELECT `ifSpeed`, COUNT(`ifSpeed`) as `count` FROM `ports` WHERE `ifSpeed` > 0 '. $query_permitted .' GROUP BY ifSpeed ORDER BY `count` DESC';
$query_permitted . ' GROUP BY ifSpeed ORDER BY `count` DESC';
$call_function = 'formatRates'; $call_function = 'formatRates';
$call_params = [4, 4]; $call_params = array(4, 4);
break; break;
case 'syslog_program': case 'syslog_program':
//$query_permitted = generate_query_permitted(); //$query_permitted = generate_query_permitted();
$query = 'SELECT DISTINCT `program` FROM `syslog`'; $query = 'SELECT DISTINCT `program` FROM `syslog`';
if (is_intnum($vars['device_id'])) { if (is_intnum($vars['device_id'])) {
$query .= ' WHERE ' . generate_query_values($vars['device_id'], 'device_id'); $query .= ' WHERE ' . generate_query_values($vars['device_id'], 'device_id', NULL, FALSE);
} }
$array_filter = TRUE; // Search query string in array instead sql query (when this faster) $array_filter = TRUE; // Search query string in array instead sql query (when this faster)
break; break;
@ -87,38 +81,40 @@ if ($cache_key && $options = get_cache_session($cache_key)) {
$query = 'SELECT DISTINCT CONCAT(?, CONCAT_WS(?, `'.$column.'`, `astext`)) AS `'.$vars['field'].'` FROM `bgpPeers` WHERE 1 ' . $query_permitted; $query = 'SELECT DISTINCT CONCAT(?, CONCAT_WS(?, `'.$column.'`, `astext`)) AS `'.$vars['field'].'` FROM `bgpPeers` WHERE 1 ' . $query_permitted;
$params[] = 'AS'; $params[] = 'AS';
$params[] = ': '; $params[] = ': ';
//$query = 'SELECT DISTINCT `' . $column . '`, `astext` FROM `bgpPeers` WHERE 1 ' . $cache['where']['devices_permitted'] . ' ORDER BY `' . $column . '`';
if (!safe_empty($vars['query'])) { if (!safe_empty($vars['query'])) {
$query .= ' AND (`' . $column . '` LIKE ? OR `astext` LIKE ?)'; $query .= ' AND (`' . $column . '` LIKE ? OR `astext` LIKE ?)';
$params[] = '%' . $vars['query'] . '%'; $params[] = '%' . $vars['query'] . '%';
$params[] = '%' . $vars['query'] . '%'; $params[] = '%' . $vars['query'] . '%';
//$query .= generate_query_values_and($vars['query'], $vars['field'], '%LIKE%'); //$query .= generate_query_values($vars['query'], $vars['field'], '%LIKE%');
} }
break; break;
case 'bgp_local_ip': case 'bgp_local_ip':
case 'bgp_peer_ip': case 'bgp_peer_ip':
$columns = ['local_ip' => 'bgpPeerLocalAddr', $columns = array('local_ip' => 'bgpPeerLocalAddr',
'peer_ip' => 'bgpPeerRemoteAddr']; 'peer_ip' => 'bgpPeerRemoteAddr',
);
$param = str_replace('bgp_', '', $vars['field']); $param = str_replace('bgp_', '', $vars['field']);
$column = $columns[$param]; $column = $columns[$param];
$query_permitted = generate_query_permitted('devices');
$query = 'SELECT DISTINCT `' . $column . '` FROM `bgpPeers` WHERE 1 ' . $query_permitted;
if (!safe_empty($vars['query'])) { if (!safe_empty($vars['query'])) {
$where[] = generate_query_values($vars['query'], $column, '%LIKE%'); $query .= generate_query_values($vars['query'], $column, '%LIKE%');
} }
$query = 'SELECT DISTINCT `' . $column . '` FROM `bgpPeers`';
$query .= generate_where_clause($where, generate_query_permitted_ng('devices'));
break; break;
default: default:
json_output('error', 'Search type unknown'); json_output('error', 'Search type unknown');
} }
if (!safe_empty($query)) { if (strlen($query)) {
$options = dbFetchColumn($query, $params); $options = dbFetchColumn($query, $params);
if (safe_count($options)) { if (safe_count($options)) {
if (isset($call_function)) { if (isset($call_function)) {
$call_options = []; $call_options = array();
foreach ($options as $option) { foreach ($options as $option) {
$call_options[] = call_user_func_array($call_function, array_merge([$option], $call_params)); $call_options[] = call_user_func_array($call_function, array_merge(array($option), $call_params));
} }
$options = $call_options; $options = $call_options;
} }
@ -141,7 +137,7 @@ if (safe_count($options)) {
if ($array_filter) { if ($array_filter) {
$new_options = []; $new_options = [];
foreach ($options as $option) { foreach ($options as $option) {
if (str_contains_array($option, $vars['query'])) { if (stripos($option, $vars['query']) !== FALSE) {
$new_options[] = $option; $new_options[] = $option;
} }
} }
@ -149,7 +145,7 @@ if (safe_count($options)) {
} }
header("Content-type: application/json; charset=utf-8"); header("Content-type: application/json; charset=utf-8");
echo safe_json_encode(['options' => $options]); echo safe_json_encode(array( 'options' => $options ));
} else { } else {
json_output('error', 'Data fields are empty'); json_output('error', 'Data fields are empty');
} }

View File

@ -6,18 +6,18 @@
* *
* @package observium * @package observium
* @subpackage web * @subpackage web
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
include_once("../../includes/observium.inc.php"); $config['install_dir'] = "../..";
include_once("../../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { if (!$_SESSION['authenticated']) { echo('<li class="nav-header">Session expired, please log in again!</li>'); exit; }
echo('<li class="nav-header">Session expired, please log in again!</li>');
exit;
}
include($config['html_dir'] . "/includes/cache-data.inc.php"); include($config['html_dir'] . "/includes/cache-data.inc.php");
@ -26,22 +26,30 @@ $query_limit = 8; // Limit per query
$vars = get_vars([ 'POST', 'GET' ]); $vars = get_vars([ 'POST', 'GET' ]);
// Is there a POST/GET query string? // Is there a POST/GET query string?
if (isset($vars['queryString'])) { if (isset($vars['queryString']))
{
$queryString = trim($vars['queryString']); $queryString = trim($vars['queryString']);
// Is the string length greater than 0? // Is the string length greater than 0?
if (strlen($queryString) > 0) { if (strlen($queryString) > 0)
{
$query_param = "%$queryString%"; $query_param = "%$queryString%";
// Start out with a clean slate // Start out with a clean slate
$search_results = []; $search_results = array();
// Increase query_limit by one, so we can show "+" on result display if there are more than $query_limit entries // Increase query_limit by one, so we can show "+" on result display if there are more than $query_limit entries
$query_limit++; $query_limit++;
// Prepare user permission SQL query for use in search module queries
$query_permitted_device = $cache['where']['devices_permitted'];
$query_permitted_port = $cache['where']['ports_permitted'];
// Run search modules // Run search modules
foreach ($config['wui']['search_modules'] as $module) { foreach ($config['wui']['search_modules'] as $module)
if (is_file($config['html_dir'] . "/includes/search/$module.inc.php")) { {
if (is_file($config['html_dir'] . "/includes/search/$module.inc.php"))
{
include($config['html_dir'] . "/includes/search/$module.inc.php"); include($config['html_dir'] . "/includes/search/$module.inc.php");
} }
} }
@ -49,18 +57,21 @@ if (isset($vars['queryString'])) {
// Reset query_limit // Reset query_limit
$query_limit--; $query_limit--;
foreach ($search_results as $results) { foreach ($search_results as $results)
{
$display_count = safe_count($results['results']); $display_count = safe_count($results['results']);
// If there are more results than query_limit (can happen, as we ++'d above), cut array to desired size and add + to counter // If there are more results than query_limit (can happen, as we ++'d above), cut array to desired size and add + to counter
if ($display_count > $query_limit) { if ($display_count > $query_limit)
{
$results['results'] = array_slice($results['results'], 0, $query_limit); $results['results'] = array_slice($results['results'], 0, $query_limit);
$display_count .= '+'; $display_count .= '+';
} }
echo('<li class="nav-header">' . $results['descr'] . ': '. $display_count . '</li>' . PHP_EOL); echo('<li class="nav-header">' . $results['descr'] . ': '. $display_count . '</li>' . PHP_EOL);
foreach ($results['results'] as $result) { foreach ($results['results'] as $result)
{
$data = []; $data = [];
foreach ($result['data'] as $str) { foreach ($result['data'] as $str) {
$str = str_replace('| |', '|', $str); $str = str_replace('| |', '|', $str);
@ -81,7 +92,8 @@ if (isset($vars['queryString'])) {
} }
} }
if (!safe_count($search_results)) { if (!safe_count($search_results))
{
echo('<li class="nav-header">No search results.</li>'); echo('<li class="nav-header">No search results.</li>');
} }
} }

View File

@ -6,43 +6,51 @@
* *
* @package observium * @package observium
* @subpackage ajax * @subpackage ajax
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
include_once("../../includes/observium.inc.php"); $config['install_dir'] = "../..";
include_once("../../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { if (!$_SESSION['authenticated'])
{
echo("unauthenticated"); echo("unauthenticated");
exit; exit;
} }
include_dir($config['html_dir'] . "/includes/widgets/"); include_dir($config['html_dir'] . "/includes/widgets/");
$widget = dbFetchRow("SELECT * FROM `dash_widgets` WHERE `widget_id` = ?", [ $_POST['id'] ]); $widget = dbFetchRow("SELECT * FROM `dash_widgets` WHERE widget_id = ?", array($_POST['id']));
$widget['height'] = is_numeric($_POST['height']) ? $_POST['height'] : 3; $widget['height'] = (is_numeric($_POST['height']) ? $_POST['height'] : '3');
$widget['width'] = is_numeric($_POST['width']) ? $_POST['width'] : 4; $widget['width'] = (is_numeric($_POST['width']) ? $_POST['width'] : '4');
print_dash_mod($widget); print_dash_mod($widget);
function print_dash_mod($mod) { function print_dash_mod ($mod)
{
global $config, $cache; global $config;
global $cache;
$mod['vars'] = safe_json_decode($mod['widget_config']); $mod['vars'] = json_decode($mod['widget_config'], TRUE);
$width = is_numeric($mod['width']) ? $mod['width'] : 1240; $width = (is_numeric($mod['width']) ? $mod['width'] : 1240);
$height = is_numeric($mod['height']) ? $mod['height'] : 80; $height = (is_numeric($mod['height']) ? $mod['height'] : 80);
switch ($mod['widget_type']) { switch ($mod['widget_type'])
{
case "welcome": case "welcome":
echo '<div class="box box-solid do-not-update" style="padding:10px; padding-left: 375px; background-image: url(images/hamster-login.png); background-position: left 10px top -100px; background-repeat: no-repeat;">'; echo '<div class="box box-solid do-not-update" style="padding:10px; padding-left: 375px; background-image: url(images/login-hamster-large.png); background-position: left 10px top -100px; background-repeat: no-repeat;">';
echo '<h3>Welcome to your new Observium dashboard!</h3>'; echo '<h3>Welcome to your new Observium dashboard!</h3>';
if (isset($mod['vars']['converted'])) { if(isset($mod['vars']['converted']))
{
echo 'This was autogenerated based on your previous front page. It can be modified to suit your requirements.<br />'; echo 'This was autogenerated based on your previous front page. It can be modified to suit your requirements.<br />';
} else { } else {
echo 'This is an autogenerated default dashboard. It can be modified to suit your requirements.<br />'; echo 'This is an autogenerated default dashboard. It can be modified to suit your requirements.<br />';
@ -55,15 +63,16 @@ function print_dash_mod($mod) {
echo '<div class="box box-solid do-not-update">'; echo '<div class="box box-solid do-not-update">';
$wmap = dbFetchRow("SELECT * FROM `weathermaps` WHERE `wmap_name` = ?", [ $mod['vars']['mapname'] ]); $wmap = dbFetchRow("SELECT * FROM `weathermaps` WHERE `wmap_name` = ?", array($mod['vars']['mapname']));
echo ' <div class="hover-hide widget-title" style="z-index: 900; position: absolute; overflow: hidden;" class="widget-title"><h4 style="wwriting-mode: vertical-lr; ttext-orientation: mixed;" class="box-title">' . echo ' <div class="hover-hide widget-title" style="z-index: 900; position: absolute; overflow: hidden;" class="widget-title"><h4 style="wwriting-mode: vertical-lr; ttext-orientation: mixed;" class="box-title">' .
escape_html($wmap['wmap_name']) . '</h4></div>' . PHP_EOL; '' . htmlentities($wmap['wmap_name']) . '</h4>' .
'</div>' . PHP_EOL;
echo ' <div class="box-content" style="overflow: hidden">'; echo ' <div class="box-content" style="overflow: hidden">';
echo '<div style="height:100%; overflow:hidden; width: 110%;">'; echo '<div style="height:100%; overflow:hidden; width: 110%;">';
echo '<a href="'.generate_url(['page' => 'wmap', 'mapname' => $wmap['map_name']]).'">'; echo '<a href="'.generate_url(['page' => 'wmap', 'mapname' => $wmap['map_name']]).'">';
echo '<img src="/weathermap.php?mapname=' . escape_html($wmap['wmap_name']) . '&action=draw&unique=' . time() . '&width=' . $width . '&height=' . $height . '">'; echo '<img src="/weathermap.php?mapname=' . htmlentities($wmap['wmap_name']) . '&action=draw&unique=' . time() . '&width='.$width.'&height='.$height.'">';
echo '</a>'; echo '</a>';
echo '</div>'; echo '</div>';
@ -76,11 +85,17 @@ function print_dash_mod($mod) {
echo '<div class="box box-solid do-not-update">'; echo '<div class="box box-solid do-not-update">';
print_dash_map($mod, $width, $height); print_dash_map($mod, $width, $height);
echo '</div>'; echo '</div>';
break;
case "graph":
echo '<div class="box box-solid do-not-update">';
print_dash_graph($mod, $width, $height);
echo '</div>';
break; break;
case "port_percent": case "port_percent":
if ($_SESSION['userlevel'] < 5) { if($_SESSION['userlevel'] < 5)
{
echo '<div class="box box-solid" style="width: 100%; height: 100%; float:none; display: block; padding: 10px;">'; echo '<div class="box box-solid" style="width: 100%; height: 100%; float:none; display: block; padding: 10px;">';
echo '<div class="alert statusbox alert-warning" style="border-left: 1px; width: 100%; height: 100%; margin-right: 10px; float:none; display: block;">'; echo '<div class="alert statusbox alert-warning" style="border-left: 1px; width: 100%; height: 100%; margin-right: 10px; float:none; display: block;">';
echo '<div style="margin: auto; line-height: 75px; text-align: center;">You have insufficient permissions to view this widget.</div>'; echo '<div style="margin: auto; line-height: 75px; text-align: center;">You have insufficient permissions to view this widget.</div>';
@ -98,30 +113,21 @@ function print_dash_mod($mod) {
case "alert_table": case "alert_table":
echo '<div class="box box-solid" style="overflow: hidden; height: auto; max-height: 100%">'; echo '<div class="box box-solid" style="overflow: hidden; height: auto; max-height: 100%">';
echo ' <div class="box-header" style="cursor: hand;"><h3 class="box-title">Alert Status</h3></div>'; echo ' <div class="box-header" style="cursor: hand;"><h3 class="box-title">Alert Status</h3></div>';
echo ' <div class="box-content" style="height: ' . ($height - 40) . 'px; overflow: auto;">'; echo ' <div class="box-content" style="overflow:auto;">';
//echo ' <div class="box-content" style="overflow: scroll; overflow-x:scroll;">'; print_alert_table(array('status' => 'failed',
//echo ' <div class="box-content" style="overflow:auto;">'; 'pagination' => FALSE,
'short' => TRUE)
$short = !($width > 1000); );
print_alert_table([ 'status' => 'failed', 'pagination' => FALSE, 'short' => $short ]);
echo ' </div>'; echo ' </div>';
echo ' </div>'; echo ' </div>';
echo '</div>'; echo '</div>';
break; break;
case "status_summary": case "status_summary":
echo '<div class="row">'; echo '<div class="row">';
if ($width > 1000) { if($width > 1000) { $div_class = "col-md-6"; } else { $div_class = "col-md-12"; }
$div_class = "col-md-6";
} else {
$div_class = "col-md-12";
}
if ($height < 210) { if($height < 210) { $hide_group_bar = 1; }
$hide_group_bar = 1;
}
include($config['html_dir'] . '/includes/cache-data.inc.php'); include($config['html_dir'] . '/includes/cache-data.inc.php');
include($config['html_dir'] . "/includes/status-summary.inc.php"); include($config['html_dir'] . "/includes/status-summary.inc.php");
@ -135,7 +141,8 @@ function print_dash_mod($mod) {
//$count = round(($width) / 165) * round(($height+10) / 90); // 1.5 wide //$count = round(($width) / 165) * round(($height+10) / 90); // 1.5 wide
$count = floor(($width+10) / 198) * floor(($height+10) / 96); // 1.5 wide $count = floor(($width+10) / 198) * floor(($height+10) / 96); // 1.5 wide
echo '<div style="width: auto; height: 100%; overflow-x: visible; overflow-y: visible; margin-right: -25px;">'; echo '<div style="width: auto; height: 100%; overflow-x: visible; overflow-y: visible; margin-right: -25px;">';
if ($mod['widget_type'] == 'alert_boxes') { if($mod['widget_type'] == 'alert_boxes')
{
print_status_boxes($mod, $count); print_status_boxes($mod, $count);
} else { } else {
print_status_boxes($config['frontpage']['device_status'], $count); print_status_boxes($config['frontpage']['device_status'], $count);
@ -162,14 +169,8 @@ function print_dash_mod($mod) {
echo ' <div class="box box-solid" style="overflow: hidden; height: auto; max-height: 100%">'; echo ' <div class="box box-solid" style="overflow: hidden; height: auto; max-height: 100%">';
echo ' <div class="box-header" style="cursor: hand;"><h3 class="box-title"><a href="/syslog/">Syslog</a></h3></div>'; echo ' <div class="box-header" style="cursor: hand;"><h3 class="box-title"><a href="/syslog/">Syslog</a></h3></div>';
echo ' <div class="box-content" style="overflow: hidden; overflow-x:scroll;">'; echo ' <div class="box-content" style="overflow: hidden; overflow-x:scroll;">';
print_syslogs(array('short' => TRUE, 'pagesize' => ($height - 36) / 26,
$short = !($width > 1000); 'priority' => $config['frontpage']['syslog']['priority']));
$syslog_vars = array_merge($mod['vars'], [ 'short' => $short, 'pagesize' => ($height - 36) / 26,
'priority' => $config['frontpage']['syslog']['priority'] ]);
print_syslogs($syslog_vars);
echo ' </div>'; echo ' </div>';
echo '</div>'; echo '</div>';
break; break;
@ -178,13 +179,7 @@ function print_dash_mod($mod) {
echo ' <div class="box box-solid" style="overflow: hidden; height: auto; max-height: 100%">'; echo ' <div class="box box-solid" style="overflow: hidden; height: auto; max-height: 100%">';
echo ' <div class="box-header" style="cursor: hand;"><h3 class="box-title"><a href="/syslog_alerts/">Syslog Alerts</a></h3></div>'; echo ' <div class="box-header" style="cursor: hand;"><h3 class="box-title"><a href="/syslog_alerts/">Syslog Alerts</a></h3></div>';
echo ' <div class="box-content" style="overflow: hidden; overflow-x:scroll;">'; echo ' <div class="box-content" style="overflow: hidden; overflow-x:scroll;">';
print_logalert_log(array('short' => TRUE, 'pagesize' => ($height - 36) / 26) );
$short = !($width > 1000);
$alertlog_vars = array_merge($mod['vars'], [ 'short' => $short, 'pagesize' => ($height - 36) / 26 ]);
print_logalert_log($alertlog_vars);
echo ' </div>'; echo ' </div>';
echo '</div>'; echo '</div>';
break; break;
@ -193,13 +188,7 @@ function print_dash_mod($mod) {
echo ' <div class="box box-solid" style="overflow: hidden; height: auto; max-height: 100%">'; echo ' <div class="box box-solid" style="overflow: hidden; height: auto; max-height: 100%">';
echo ' <div class="box-header" style="cursor: hand;"><h3 class="box-title"><a href="/alert_log/">Alert Log</a></h3></div>'; echo ' <div class="box-header" style="cursor: hand;"><h3 class="box-title"><a href="/alert_log/">Alert Log</a></h3></div>';
echo ' <div class="box-content" style="overflow: hidden; overflow-x:scroll;">'; echo ' <div class="box-content" style="overflow: hidden; overflow-x:scroll;">';
print_alert_log_short(array('short' => TRUE, 'pagesize' => ($height - 36) / 26));
$short = !($width > 1000);
$alertlog_vars = array_merge($mod['vars'], [ 'short' => $short, 'pagesize' => ($height - 36) / 26 ]);
print_alert_log($alertlog_vars);
echo ' </div>'; echo ' </div>';
echo '</div>'; echo '</div>';
break; break;
@ -210,14 +199,10 @@ function print_dash_mod($mod) {
echo ' <div class="box-content" style="overflow: hidden; overflow-x:scroll;">'; echo ' <div class="box-content" style="overflow: hidden; overflow-x:scroll;">';
$pagesize = floor(($height - 36) / 26); $pagesize = floor(($height - 36) / 26);
//if($width > 1000) { $pagesize -= 3; $short = FALSE; } else { $short = TRUE; }
$short = !($width > 1000); print_events(array('short' => TRUE, 'pagesize' => $pagesize, 'pageno' => 1,
'severity' => $config['frontpage']['eventlog']['severity']));
$eventlog_vars = array_merge($mod['vars'], [ 'short' => $short, 'pagesize' => $pagesize, 'pageno' => 1,
'severity' => $config['frontpage']['eventlog']['severity'] ]);
print_events($eventlog_vars);
echo ' </div>'; echo ' </div>';
echo '</div>'; echo '</div>';
break; break;
@ -240,12 +225,6 @@ function print_dash_mod($mod) {
break; break;
default: default:
$widget_path = $config['html_dir'] . '/includes/widgets/' . $mod['widget_type'] . '.inc.php';
if (is_file($widget_path)) {
include($widget_path);
} else {
echo '<div class="grid-stack-item-content box box-solid" style="overflow: hidden; justify-content: center; align-items: center;">'; echo '<div class="grid-stack-item-content box box-solid" style="overflow: hidden; justify-content: center; align-items: center;">';
echo ' <div class="box-content" style="overflow: hidden;">'; echo ' <div class="box-content" style="overflow: hidden;">';
echo ' <h3 class="box-title">Unconfigured Module</h3>'; echo ' <h3 class="box-title">Unconfigured Module</h3>';
@ -253,29 +232,28 @@ function print_dash_mod($mod) {
echo '</div>'; echo '</div>';
break; break;
} }
}
//echo '</div>'; //echo '</div>';
} }
function print_dash_map($mod, $width, $height) function print_dash_map ($vars, $width, $height)
{ {
global $config; global $config;
?> ?>
<style type="text/css"> <style type="text/css">
#map<?php echo $mod['widget_id']; ?> label { #map<?php echo $vars['widget_id']; ?> label {
width: auto; width: auto;
display: inline; display: inline;
} }
#map<?php echo $mod['widget_id']; ?> img { #map<?php echo $vars['widget_id']; ?> img {
max-width: none; max-width: none;
} }
#map<?php echo $mod['widget_id']; ?> { #map<?php echo $vars['widget_id']; ?> {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
@ -283,12 +261,179 @@ function print_dash_map($mod, $width, $height)
<?php <?php
echo '<div id="map' . $mod['widget_id'] . '"></div>'; echo '<div id="map'.$vars['widget_id'].'"></div>';
$vars = $mod['vars']; // set the $vars array to be used mostly by geojson
include($config['html_dir']. '/includes/map/leaflet.inc.php'); include($config['html_dir']. '/includes/map/leaflet.inc.php');
} // End show_map } // End show_map
function print_dash_graph($mod, $width, $height) {
global $config;
$vars = $mod['vars'];
if (!isset($vars['type']))
{
echo '<div style="position: relative; top: 50%; transform: perspective(1px) translateY(-50%); width: 100%; text-align: center;">
<btn class="btn btn-primary" onclick="configWidget(' . $mod['widget_id'] . ')"><i class="icon-signal"/> &nbsp; Select Graph</btn>
</div>';
exit();
}
if (isset($vars['timestamp_from']) && preg_match(OBS_PATTERN_TIMESTAMP, $vars['timestamp_from'])) {
$vars['from'] = strtotime($vars['timestamp_from']);
unset($vars['timestamp_from']);
}
if (isset($vars['timestamp_to']) && preg_match(OBS_PATTERN_TIMESTAMP, $vars['timestamp_to'])) {
$vars['to'] = strtotime($vars['timestamp_to']);
unset($vars['timestamp_to']);
}
// Period alone is sufficient
/*
if (isset($vars['period']))
{
$vars['to'] = "now";
$vars['from'] = "-".$vars['period'];
}
if (!isset($vars['from']))
{
$vars['from'] = $config['time']['day'];
}
if (!isset($vars['to']))
{
$vars['to'] = $config['time']['now'];
}
*/
preg_match('/^(?P<type>[a-z0-9A-Z-]+)_(?P<subtype>.+)/', $vars['type'], $graphtype);
if (OBS_DEBUG) {
print_vars($graphtype);
}
$type = $graphtype['type'];
$subtype = $graphtype['subtype'];
if (is_numeric($vars['device'])) {
$device = device_by_id_cache($vars['device']);
} elseif (!empty($vars['device'])) {
$device = device_by_name($vars['device']);
} elseif ($type === "device" && is_numeric($vars['id'])) {
$device = device_by_id_cache($vars['id']);
}
$preserve_id = $vars['id'];
if (is_file($config['html_dir'] . "/includes/graphs/" . $type . "/auth.inc.php"))
{
include($config['html_dir'] . "/includes/graphs/" . $type . "/auth.inc.php");
}
$vars['id'] = $preserve_id;
if (!$auth) {
print_error_permission();
return;
}
if (isset($config['entities'][$type])) {
$entity = get_entity_by_id_cache($type, $vars['id']);
entity_rewrite($type, $entity);
}
if ($type === 'bgp') {
$entity = get_entity_by_id_cache('bgp_peer', $vars['id']);
entity_rewrite('bgp_peer', $entity);
}
//$device = device_by_id_cache($entity['device_id']);
//$graph_array['type'] = $vars['entity_type'] . '_' . $vars['graph_type'];
//$graph_array['id'] = $vars['entity_id'];
// Generate navbar with subtypes
$graph_array = $vars;
//$graph_array['from'] = '-1day';
//$graph_array['to'] = 'now';
$graph_array['width'] = $width - 76 + 14; // RRD graphs are 75px wider than request value
$graph_array['height'] = $height - 34; //68; // RRD graphs are taller than request value
if ($graph_array['width'] > 350)
{
$graph_array['width'] -= 6;
} // RRD graphs > 350px are 6 px wider because of larger legend font
if ($graph_array['width'] > 350)
{
$graph_array['height'] -= 6;
} // RRD graphs > 350px are 6 px wider because of larger legend font
$title_div = 'top:0px; left: 0px; padding: 4px; border-top-left-radius: 4px; border: 1px solid #e5e5e5; border-left: none; border-top: none; background-color: rgba(255, 255,255, 0.75); ';
$title_div = 'widget-title';
if ($height < 100)
{
$graph_array['height'] = $height;
$graph_array['width'] = $width;
$graph_array['graph_only'] = 'yes';
$title_div = 'top:5px; left: 5px; padding: none; border-radius: 2px; border: 1px solid #e5e5e5; background: rgba(255, 255, 255, 0.7);';
$title_div = 'widget-title-small';
} else {
$graph_array['draw_all'] = 'yes';
}
$t_len = $vars['width'] / 10;
$subtype_text = (isset($config['graph_types'][$type][$subtype]) ? $config['graph_types'][$type][$subtype]['descr'] : nicecase($subtype));
if (!isset($graph_array['title'])) {
if ($type === 'global')
{
$title = "Global :: " . $subtype_text;
} elseif (str_contains($type, "multi")) {
$count = safe_count($graph_array['id']);
$title = $count . ' ' . nicecase(str_replace("multi-", '', $type)) . ' :: ' . $subtype_text;
} else {
$title = device_name($device, $t_len / 2 - 2) . ($type === "device" ? ' :: ' : ' :: ' . truncate($entity['entity_shortname'], 32) . ' :: ' ) . $subtype_text;
}
} else {
$title = $graph_array['title'];
unset($graph_array['title']);
}
//$graph_array['format'] = 'png';
//$graph_array['img_id'] = generate_random_string(5);
$graph_array['legend'] = 'no';
$graph_array['class'] = 'image-refresh';
$graph = generate_graph_tag($graph_array, TRUE);
$link_array = $graph_array;
$link_array['page'] = "graphs";
unset($link_array['graph_only']);
unset($link_array['height'], $link_array['width']);
$link = generate_url($link_array);
//echo ' <div class="box-header with-border">' . $device['hostname'] . '<span class="pull-right">' . truncate($entity['entity_name'], 32) . '</span></div>';
echo ' <div class="hover-hide ' . $title_div . '" style="z-index: 900; position: absolute; overflow: hidden;" class="widget-title"><h4 style="wwriting-mode: vertical-lr; ttext-orientation: mixed;" class="box-title">' .
'' . escape_html($title) . '</h4>' .
'</div>' . PHP_EOL;
echo ' <div class="box-content" style="overflow: hidden">';
echo '<div style="height:100%; overflow:hidden; width: 110%;">';
echo '<a href="'.$link.'">'.$graph['img_tag'].'</a>';
echo '</div>';
echo ' </div>';
}
// EOF // EOF

View File

@ -3,7 +3,6 @@
Options FollowSymlinks Multiviews Options FollowSymlinks Multiviews
ErrorDocument 404 /error.php?404
RedirectMatch 404 /\. RedirectMatch 404 /\.
RewriteEngine on RewriteEngine on

View File

@ -1,32 +1,25 @@
<?php <?php
/** /**
* Observium * Observium
* *
* This file is part of Observium. * This file is part of Observium.
* *
* @package observium * @package observium
* @subpackage web * @subpackage webinterface
* @copyright (C) Adam Armstrong * @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* *
*/ */
ini_set('allow_url_fopen', 0); ini_set('allow_url_fopen', 0);
include_once("../includes/observium.inc.php"); include_once("../includes/sql-config.inc.php");
if (!$config['web_iframe'] && is_iframe()) {
print_error_permission("Not allowed to run in a iframe!");
die();
}
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) { if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) { if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; } }
if (!$_SESSION['authenticated']) {
// not authenticated
die("Unauthenticated");
}
}
require_once($config['html_dir'] . "/includes/jpgraph/src/jpgraph.php"); require_once($config['html_dir'] . "/includes/jpgraph/src/jpgraph.php");
require_once($config['html_dir'] . "/includes/jpgraph/src/jpgraph_line.php"); require_once($config['html_dir'] . "/includes/jpgraph/src/jpgraph_line.php");
require_once($config['html_dir'] . "/includes/jpgraph/src/jpgraph_bar.php"); require_once($config['html_dir'] . "/includes/jpgraph/src/jpgraph_bar.php");
@ -35,9 +28,12 @@ require_once($config['html_dir'] . "/includes/jpgraph/src/jpgraph_date.php");
$vars = get_vars('GET'); $vars = get_vars('GET');
if (is_numeric($vars['bill_id'])) { if (is_numeric($vars['bill_id']))
if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) { {
if (bill_permitted($vars['bill_id'])) { if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'])
{
if (bill_permitted($vars['bill_id']))
{
$bill_id = $vars['bill_id']; $bill_id = $vars['bill_id'];
} else { } else {
echo("Unauthorised Access Prohibited."); echo("Unauthorised Access Prohibited.");
@ -53,9 +49,8 @@ if (is_numeric($vars['bill_id'])) {
// Workaround for JPGraph 3.5 on Ubuntu per 0015246 // Workaround for JPGraph 3.5 on Ubuntu per 0015246
if( !function_exists('imageantialias') ) { if( !function_exists('imageantialias') ) {
function imageantialias($image, $enabled) function imageantialias( $image, $enabled ) {
{ return false;
return FALSE;
} }
} }
@ -68,22 +63,24 @@ $ysize = (is_numeric($vars['y']) ? $vars['y'] : "250");
//$dur = $end - $start; //$dur = $end - $start;
//$datefrom = date('Ymthis', $start); //$datefrom = date('Ymthis', $start);
//$dateto = date('Ymthis', $end); //$dateto = date('Ymthis', $end);
$imgtype = $vars['type'] ?? "historical"; $imgtype = (isset($vars['type']) ? $vars['type'] : "historical" );
$imgbill = $vars['imgbill'] ?? FALSE; $imgbill = (isset($vars['imgbill']) ? $vars['imgbill'] : false);
$yaxistitle = "Bytes"; $yaxistitle = "Bytes";
$in_data = []; $in_data = array();
$out_data = []; $out_data = array();
$tot_data = []; $tot_data = array();
$allow_data = []; $allow_data = array();
$ave_data = []; $ave_data = array();
$overuse_data = []; $overuse_data = array();
$ticklabels = []; $ticklabels = array();
if ($imgtype === "historical") { if ($imgtype == "historical")
{
$i = "0"; $i = "0";
foreach (dbFetchRows("SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY `bill_datefrom` DESC LIMIT 12", [$bill_id]) as $data) { foreach (dbFetchRows("SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY `bill_datefrom` DESC LIMIT 12", array($bill_id)) as $data)
{
$datefrom = strftime("%e %b %Y", strtotime($data['bill_datefrom'])); $datefrom = strftime("%e %b %Y", strtotime($data['bill_datefrom']));
$dateto = strftime("%e %b %Y", strtotime($data['bill_dateto'])); $dateto = strftime("%e %b %Y", strtotime($data['bill_dateto']));
$datelabel = $datefrom."\n".$dateto; $datelabel = $datefrom."\n".$dateto;
@ -91,7 +88,8 @@ if ($imgtype === "historical") {
$traf['out'] = $data['traf_out']; $traf['out'] = $data['traf_out'];
$traf['total'] = $data['traf_total']; $traf['total'] = $data['traf_total'];
if ($data['bill_type'] === "Quota") { if ($data['bill_type'] == "Quota")
{
$traf['allowed'] = $data['bill_allowed']; $traf['allowed'] = $data['bill_allowed'];
$traf['overuse'] = $data['bill_overuse']; $traf['overuse'] = $data['bill_overuse'];
} else { } else {
@ -99,76 +97,83 @@ if ($imgtype === "historical") {
$traf['overuse'] = "0"; $traf['overuse'] = "0";
} }
$ticklabels[] = $datelabel; array_push($ticklabels, $datelabel);
$in_data[] = $traf['in']; array_push($in_data, $traf['in']);
$out_data[] = $traf['out']; array_push($out_data, $traf['out']);
$tot_data[] = $traf['total']; array_push($tot_data, $traf['total']);
$allow_data[] = $traf['allowed']; array_push($allow_data, $traf['allowed']);
$overuse_data[] = $traf['overuse']; array_push($overuse_data, $traf['overuse']);
$i++; $i++;
//print_vars($data); //print_vars($data);
} }
if ($i < 12) { if ($i < 12)
{
$y = 12 - $i; $y = 12 - $i;
for ($x = 0; $x < $y; $x++) { for ($x=0;$x<$y;$x++)
{
$allowed = (($x == "0") ? $traf['allowed'] : "0" ); $allowed = (($x == "0") ? $traf['allowed'] : "0" );
$in_data[] = "0"; array_push($in_data, "0");
$out_data[] = "0"; array_push($out_data, "0");
$tot_data[] = "0"; array_push($tot_data, "0");
$allow_data[] = $allowed; array_push($allow_data, $allowed);
$overuse_data[] = "0"; array_push($overuse_data, "0");
$ticklabels[] = ""; array_push($ticklabels, "");
} }
} }
$yaxistitle = "Gigabytes"; $yaxistitle = "Gigabytes";
$graph_name = "Historical bandwidth over the last 12 billing periods"; $graph_name = "Historical bandwidth over the last 12 billing periods";
} else { } else {
$data = []; $data = array();
$average = 0; $average = 0;
if ($imgtype === "day") { if ($imgtype == "day")
foreach (dbFetchRows("SELECT DISTINCT UNIX_TIMESTAMP(timestamp) as timestamp, SUM(delta) as traf_total, SUM(in_delta) as traf_in, SUM(out_delta) as traf_out FROM bill_data WHERE `bill_id` = ? AND `timestamp` >= FROM_UNIXTIME(?) AND `timestamp` <= FROM_UNIXTIME(?) GROUP BY DATE(timestamp) ORDER BY timestamp ASC", [$bill_id, $start, $end]) as $data) { {
$traf['in'] = $data['traf_in'] ?? 0; foreach (dbFetch("SELECT DISTINCT UNIX_TIMESTAMP(timestamp) as timestamp, SUM(delta) as traf_total, SUM(in_delta) as traf_in, SUM(out_delta) as traf_out FROM bill_data WHERE `bill_id` = ? AND `timestamp` >= FROM_UNIXTIME(?) AND `timestamp` <= FROM_UNIXTIME(?) GROUP BY DATE(timestamp) ORDER BY timestamp ASC", array($bill_id, $start, $end)) as $data)
$traf['out'] = $data['traf_out'] ?? 0; {
$traf['total'] = $data['traf_total'] ?? 0; $traf['in'] = (isset($data['traf_in']) ? $data['traf_in'] : 0);
$traf['out'] = (isset($data['traf_out']) ? $data['traf_out'] : 0);
$traf['total'] = (isset($data['traf_total']) ? $data['traf_total'] : 0);
$datelabel = strftime("%e\n%b", $data['timestamp']); $datelabel = strftime("%e\n%b", $data['timestamp']);
array_push($ticklabels, $datelabel);
$ticklabels[] = $datelabel; array_push($in_data, $traf['in']);
$in_data[] = $traf['in']; array_push($out_data, $traf['out']);
$out_data[] = $traf['out']; array_push($tot_data, $traf['total']);
$tot_data[] = $traf['total'];
$average += $data['traf_total']; $average += $data['traf_total'];
} }
$ave_count = safe_count($tot_data); $ave_count = count($tot_data);
if ($imgbill) { if ($imgbill != false)
{
$days = strftime("%e", date($end - $start)) - $ave_count - 1; $days = strftime("%e", date($end - $start)) - $ave_count - 1;
for ($x = 0; $x < $days; $x++) { for ($x=0;$x<$days;$x++)
$ticklabels[] = ""; {
$in_data[] = 0; array_push($ticklabels, "");
$out_data[] = 0; array_push($in_data, 0);
$tot_data[] = 0; array_push($out_data, 0);
array_push($tot_data, 0);
} }
} }
} elseif ($imgtype === "hour") { } elseif ($imgtype == "hour")
foreach (dbFetchRows("SELECT DISTINCT UNIX_TIMESTAMP(timestamp) as timestamp, SUM(delta) as traf_total, SUM(in_delta) as traf_in, SUM(out_delta) as traf_out FROM bill_data WHERE `bill_id` = ? AND `timestamp` >= FROM_UNIXTIME(?) AND `timestamp` <= FROM_UNIXTIME(?) GROUP BY HOUR(timestamp) ORDER BY timestamp ASC", [$bill_id, $start, $end]) as $data) { {
$traf['in'] = $data['traf_in'] ?? 0; foreach (dbFetch("SELECT DISTINCT UNIX_TIMESTAMP(timestamp) as timestamp, SUM(delta) as traf_total, SUM(in_delta) as traf_in, SUM(out_delta) as traf_out FROM bill_data WHERE `bill_id` = ? AND `timestamp` >= FROM_UNIXTIME(?) AND `timestamp` <= FROM_UNIXTIME(?) GROUP BY HOUR(timestamp) ORDER BY timestamp ASC", array($bill_id, $start, $end)) as $data)
$traf['out'] = $data['traf_out'] ?? 0; {
$traf['total'] = $data['traf_total'] ?? 0; $traf['in'] = (isset($data['traf_in']) ? $data['traf_in'] : 0);
$traf['out'] = (isset($data['traf_out']) ? $data['traf_out'] : 0);
$traf['total'] = (isset($data['traf_total']) ? $data['traf_total'] : 0);
$datelabel = strftime("%H:%M", $data['timestamp']); $datelabel = strftime("%H:%M", $data['timestamp']);
array_push($ticklabels, $datelabel);
$ticklabels[] = $datelabel; array_push($in_data, $traf['in']);
$in_data[] = $traf['in']; array_push($out_data, $traf['out']);
$out_data[] = $traf['out']; array_push($tot_data, $traf['total']);
$tot_data[] = $traf['total'];
$average += $data['traf_total']; $average += $data['traf_total'];
} }
$ave_count = safe_count($tot_data); $ave_count = count($tot_data);
} }
$decimal = 0; $decimal = 0;
$average = float_div($average, $ave_count); $average = $average / $ave_count;
for ($x = 0, $x_max = safe_count($tot_data); $x <= $x_max; $x++) { for ($x = 0; $x <= count($tot_data); $x++)
$ave_data[] = $average; {
array_push($ave_data, $average);
} }
$graph_name = date('M j g:ia', $start)." - ".date('M j g:ia', $end); $graph_name = date('M j g:ia', $start)." - ".date('M j g:ia', $end);
} }
@ -183,7 +188,7 @@ $graph -> SetScale("textlin");
#$graph->title->Set("$graph_name"); #$graph->title->Set("$graph_name");
$graph->title->SetFont(FF_FONT2, FS_BOLD, 10); $graph->title->SetFont(FF_FONT2, FS_BOLD, 10);
$graph->SetMarginColor("white"); $graph->SetMarginColor("white");
$graph -> SetFrame(FALSE); $graph->SetFrame(false);
$graph->SetMargin("75", "30", "30", "65"); $graph->SetMargin("75", "30", "30", "65");
$graph->legend->SetFont(FF_FONT1, FS_NORMAL); $graph->legend->SetFont(FF_FONT1, FS_NORMAL);
$graph->legend->SetLayout(LEGEND_HOR); $graph->legend->SetLayout(LEGEND_HOR);
@ -193,7 +198,7 @@ $graph -> xaxis -> SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetPos('min'); $graph->xaxis->SetPos('min');
$graph->xaxis->SetTitleMargin(30); $graph->xaxis->SetTitleMargin(30);
$graph->xaxis->SetTickLabels($ticklabels); $graph->xaxis->SetTickLabels($ticklabels);
$graph -> xgrid -> Show(TRUE, TRUE); $graph->xgrid->Show(true,true);
$graph->xgrid->SetColor('#e0e0e0','#efefef'); $graph->xgrid->SetColor('#e0e0e0','#efefef');
$graph->yaxis->SetFont(FF_FONT1); $graph->yaxis->SetFont(FF_FONT1);
@ -201,7 +206,7 @@ $graph -> yaxis -> SetTitleMargin(50);
$graph->yaxis->title->SetFont(FF_FONT1, FS_NORMAL, 10); $graph->yaxis->title->SetFont(FF_FONT1, FS_NORMAL, 10);
$graph->yaxis->title->Set("Bytes Transferred"); $graph->yaxis->title->Set("Bytes Transferred");
$graph->yaxis->SetLabelFormatCallback('format_bytes_billing'); $graph->yaxis->SetLabelFormatCallback('format_bytes_billing');
$graph -> ygrid -> SetFill(TRUE, '#EFEFEF@0.5', '#FFFFFF@0.5'); $graph->ygrid->SetFill(true,'#EFEFEF@0.5','#FFFFFF@0.5');
// Create the bar plots // Create the bar plots
$barplot_tot = new BarPlot($tot_data); $barplot_tot = new BarPlot($tot_data);
@ -223,7 +228,8 @@ $barplot_out -> SetColor('#' . $config['graph_colours']['blues'][0]);
$barplot_out->SetFillColor('#'.$config['graph_colours']['blues'][1]); $barplot_out->SetFillColor('#'.$config['graph_colours']['blues'][1]);
$barplot_out->SetWeight(1); $barplot_out->SetWeight(1);
if ($imgtype === "historical") { if ($imgtype == "historical")
{
$barplot_over = new BarPlot($overuse_data); $barplot_over = new BarPlot($overuse_data);
$barplot_over->SetLegend("Traffic Overusage"); $barplot_over->SetLegend("Traffic Overusage");
$barplot_over->SetColor('darkred'); $barplot_over->SetColor('darkred');
@ -235,7 +241,7 @@ if ($imgtype === "historical") {
$lineplot_allow->SetColor('black'); $lineplot_allow->SetColor('black');
$lineplot_allow->SetWeight(1); $lineplot_allow->SetWeight(1);
$gbplot = new GroupBarPlot([$barplot_in, $barplot_tot, $barplot_out, $barplot_over]); $gbplot = new GroupBarPlot(array($barplot_in, $barplot_tot, $barplot_out, $barplot_over));
} else { } else {
$lineplot_allow = new LinePlot($ave_data); $lineplot_allow = new LinePlot($ave_data);
//$lineplot_allow->SetLegend("Average per ".$imgtype); //$lineplot_allow->SetLegend("Average per ".$imgtype);
@ -243,7 +249,7 @@ if ($imgtype === "historical") {
$lineplot_allow->SetColor('black'); $lineplot_allow->SetColor('black');
$lineplot_allow->SetWeight(1); $lineplot_allow->SetWeight(1);
$gbplot = new GroupBarPlot([$barplot_in, $barplot_tot, $barplot_out]); $gbplot = new GroupBarPlot(array($barplot_in, $barplot_tot, $barplot_out));
} }
$graph->Add($gbplot); $graph->Add($gbplot);

30
html/css/bootstrap-toggle.min.css vendored Normal file
View File

@ -0,0 +1,30 @@
/*! ========================================================================
* Bootstrap Toggle: bootstrap-toggle.css v2.2.0
* http://www.bootstraptoggle.com
* ========================================================================
* Copyright 2014 Min Hur, The New York Times Company
* Licensed under MIT
* ======================================================================== */
.checkbox label .toggle,.checkbox-inline .toggle{margin-left:-20px;margin-right:5px}
.toggle{position:relative;overflow:hidden}
.toggle input[type=checkbox]{display:none}
.toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;-moz-user-select:none;-webkit-user-select:none}
.toggle.off .toggle-group{left:-100%}
.toggle.inactive{opacity:.65;}
.toggle.disabled .toggle-on, .toggle.disabled .toggle-off, .toggle.disabled .toggle-handle{cursor:not-allowed;}
.toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0}
.toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0}
.toggle-handle{position:relative;vertical-align:baseline;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px}
.toggle.btn{min-width:46px;min-height:30px}
.toggle-on.btn{padding-right:24px}
.toggle-off.btn{padding-left:18px}
.toggle.btn-lg{min-width:79px;min-height:40px}
.toggle-on.btn-lg{padding-right:31px}
.toggle-off.btn-lg{padding-left:27px}
.toggle-handle.btn-lg{width:40px}
.toggle.btn-sm{min-width:50px;min-height:26px}
.toggle-on.btn-sm{padding-right:20px}
.toggle-off.btn-sm{padding-left:14px}
.toggle.btn-xs{min-width:35px;min-height:20px}
.toggle-on.btn-xs{padding-right:12px}
.toggle-off.btn-xs{padding-left:8px}

11743
html/css/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,168 +0,0 @@
/* Copyright Notice
* bootstrap5-toggle v3.7.4
* https://palcarazm.github.io/bootstrap5-toggle/
* @author 2011-2014 Min Hur (https://github.com/minhur)
* @author 2018-2019 Brent Ely (https://github.com/gitbrent)
* @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
* @funding GitHub Sponsors
* @see https://github.com/sponsors/palcarazm
* @license MIT
* @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
*/
/*
* @added 3.0.0: Return support for "*-xs" removed in Bootstrap-4
* @see: [Comment](https://github.com/twbs/bootstrap/issues/21881#issuecomment-341972830)
*/
/*.btn-group-xs > .btn, .btn-xs {*/
/* padding: .35rem .4rem .25rem .4rem;*/
/* font-size: .875rem;*/
/* line-height: .5;*/
/* border-radius: .2rem;*/
/*}*/
.checkbox label .toggle, .checkbox-inline .toggle {
margin-left: -1.25rem;
margin-right: .35rem;
}
.toggle {
position: relative;
overflow: hidden;
}
.toggle:hover > .toggle-group > .toggle-handle,
.toggle:focus > .toggle-group > .toggle-handle {
background-color: var(--light);
opacity: 0.5;
}
.toggle > input[type="checkbox"] {
display: none;
}
.toggle > .toggle-group {
position: absolute;
width: 200%;
top: 0;
bottom: 0;
left: 0;
transition: left 0.35s;
-webkit-transition: left 0.35s;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
}
.toggle.btn:not(.disabled) { cursor: pointer; }
.toggle.btn.disabled{ cursor:not-allowed; }
.toggle >.toggle-group >.btn { cursor: inherit; }
.toggle.off > .toggle-group {
left: -100%;
}
.toggle.indeterminate > .toggle-group {
left: -50%;
}
.toggle > .toggle-group > .toggle-on {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 50%;
margin: 0;
border: 0;
border-radius: 0;
}
.toggle > .toggle-group > .toggle-off {
position: absolute;
top: 0;
bottom: 0;
left: 50%;
right: 0;
margin: 0;
border: 0;
border-radius: 0;
box-shadow: none; /* Bootstrap 4.0 Support via (Issue #186)[https://github.com/minhur/bootstrap-toggle/issues/186]) */
}
.toggle > .toggle-group > .toggle-handle {
position: relative;
margin: 0 auto;
padding-top: 0px;
padding-bottom: 0px;
height: 100%;
width: 0px;
border-width: 0 1px;
background-color: var(--light);
border-color: var(--light);
}
/** Support for input-group
* @author (bryan-brancotte)[https://github.com/bryan-brancotte]
* @see https://github.com/gitbrent/bootstrap4-toggle/issues/32#issuecomment-616974580
*/
.input-group .toggle > .toggle-group > .toggle-on,
.input-group .toggle > .toggle-group > .toggle-off{
position: absolute;
}
.input-group:not(.has-validation)>:not(:last-child).toggle,
.input-group.has-validation>:nth-last-child(n+3).toggle{
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group>:not(:first-child).toggle{
margin-left: -1px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.toggle:not(:hover):not(:focus).btn-outline-primary > .toggle-group > .toggle-handle {
background-color: var(--primary);
border-color: var(--primary);
}
.toggle:not(:hover):not(:focus).btn-outline-secondary > .toggle-group > .toggle-handle {
background-color: var(--secondary);
border-color: var(--secondary);
}
.toggle:not(:hover):not(:focus).btn-outline-success > .toggle-group > .toggle-handle {
background-color: var(--success);
border-color: var(--success);
}
.toggle:not(:hover):not(:focus).btn-outline-danger > .toggle-group > .toggle-handle {
background-color: var(--danger);
border-color: var(--danger);
}
.toggle:not(:hover):not(:focus).btn-outline-warning > .toggle-group > .toggle-handle {
background-color: var(--warning);
border-color: var(--warning);
}
.toggle:not(:hover):not(:focus).btn-outline-info > .toggle-group > .toggle-handle {
background-color: var(--info);
border-color: var(--info);
}
.toggle:not(:hover):not(:focus).btn-outline-light > .toggle-group > .toggle-handle {
background-color: var(--light);
border-color: var(--light);
}
.toggle:not(:hover):not(:focus).btn-outline-dark > .toggle-group > .toggle-handle {
background-color: var(--dark);
border-color: var(--dark);
}
/* NOTE: Must come first, so classes below override as needed */
/* [default] (bootstrap-4.1.3 - .btn - h:38px) */
.toggle.btn { min-width: 3.7rem; min-height: 2.15rem; }
.toggle > .toggle-group > .toggle-on.btn { padding-right: 1.5rem; }
.toggle > .toggle-group > .toggle-off.btn { padding-left: 1.5rem; }
/* `lg` (bootstrap-4.1.3 - .btn - h:48px) */
.toggle.btn-lg { min-width: 5rem; min-height: 2.815rem; }
.toggle > .toggle-group > .toggle-on.btn-lg { padding-right: 2rem; }
.toggle > .toggle-group > .toggle-off.btn-lg { padding-left: 2rem; }
.toggle > .toggle-group > .toggle-handle.btn-lg { width: 2.5rem; }
/* `sm` (bootstrap-4.1.3 - .btn - h:31px) */
.toggle.btn-sm { min-width: 3.125rem; min-height: 1.938rem; }
.toggle > .toggle-group > .toggle-on.btn-sm { padding-right: 1rem; }
.toggle > .toggle-group > .toggle-off.btn-sm { padding-left: 1rem; }
/* `xs` (bootstrap-3.3 - .btn - h:22px) */
.toggle.btn-xs { min-width: 2.19rem; min-height: 1.375rem; }
.toggle > .toggle-group > .toggle-on.btn-xs { padding-right: .8rem; }
.toggle > .toggle-group > .toggle-off.btn-xs { padding-left: .8rem; }

View File

@ -1,14 +0,0 @@
/* Copyright Notice
* bootstrap5-toggle v3.7.4
* https://palcarazm.github.io/bootstrap5-toggle/
* @author 2011-2014 Min Hur (https://github.com/minhur)
* @author 2018-2019 Brent Ely (https://github.com/gitbrent)
* @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
* @funding GitHub Sponsors
* @see https://github.com/sponsors/palcarazm
* @license MIT
* @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
*/
.checkbox label .toggle,.checkbox-inline .toggle{margin-left:-1.25rem;margin-right:.35rem}.toggle{position:relative;overflow:hidden}.toggle:focus>.toggle-group>.toggle-handle,.toggle:hover>.toggle-group>.toggle-handle{background-color:var(--light);opacity:.5}.toggle>input[type=checkbox]{display:none}.toggle>.toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;user-select:none;-moz-user-select:none;-webkit-user-select:none}.toggle.btn:not(.disabled){cursor:pointer}.toggle.btn.disabled{cursor:not-allowed}.toggle>.toggle-group>.btn{cursor:inherit}.toggle.off>.toggle-group{left:-100%}.toggle.indeterminate>.toggle-group{left:-50%}.toggle>.toggle-group>.toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0}.toggle>.toggle-group>.toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0;box-shadow:none}.toggle>.toggle-group>.toggle-handle{position:relative;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px;background-color:var(--light);border-color:var(--light)}.input-group .toggle>.toggle-group>.toggle-off,.input-group .toggle>.toggle-group>.toggle-on{position:absolute}.input-group.has-validation>:nth-last-child(n+3).toggle,.input-group:not(.has-validation)>:not(:last-child).toggle{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>:not(:first-child).toggle{margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}.toggle:not(:hover):not(:focus).btn-outline-primary>.toggle-group>.toggle-handle{background-color:var(--primary);border-color:var(--primary)}.toggle:not(:hover):not(:focus).btn-outline-secondary>.toggle-group>.toggle-handle{background-color:var(--secondary);border-color:var(--secondary)}.toggle:not(:hover):not(:focus).btn-outline-success>.toggle-group>.toggle-handle{background-color:var(--success);border-color:var(--success)}.toggle:not(:hover):not(:focus).btn-outline-danger>.toggle-group>.toggle-handle{background-color:var(--danger);border-color:var(--danger)}.toggle:not(:hover):not(:focus).btn-outline-warning>.toggle-group>.toggle-handle{background-color:var(--warning);border-color:var(--warning)}.toggle:not(:hover):not(:focus).btn-outline-info>.toggle-group>.toggle-handle{background-color:var(--info);border-color:var(--info)}.toggle:not(:hover):not(:focus).btn-outline-light>.toggle-group>.toggle-handle{background-color:var(--light);border-color:var(--light)}.toggle:not(:hover):not(:focus).btn-outline-dark>.toggle-group>.toggle-handle{background-color:var(--dark);border-color:var(--dark)}.toggle.btn{min-width:3.7rem;min-height:2.15rem}.toggle>.toggle-group>.toggle-on.btn{padding-right:1.5rem}.toggle>.toggle-group>.toggle-off.btn{padding-left:1.5rem}.toggle.btn-lg{min-width:5rem;min-height:2.815rem}.toggle>.toggle-group>.toggle-on.btn-lg{padding-right:2rem}.toggle>.toggle-group>.toggle-off.btn-lg{padding-left:2rem}.toggle>.toggle-group>.toggle-handle.btn-lg{width:2.5rem}.toggle.btn-sm{min-width:3.125rem;min-height:1.938rem}.toggle>.toggle-group>.toggle-on.btn-sm{padding-right:1rem}.toggle>.toggle-group>.toggle-off.btn-sm{padding-left:1rem}.toggle.btn-xs{min-width:2.19rem;min-height:1.375rem}.toggle>.toggle-group>.toggle-on.btn-xs{padding-right:.8rem}.toggle>.toggle-group>.toggle-off.btn-xs{padding-left:.8rem}
/*# sourceMappingURL=bootstrap5-toggle.min.css.map */

File diff suppressed because one or more lines are too long

View File

@ -67,36 +67,6 @@
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
:root {
--blue: #2196F3;
--indigo: #3F51B5;
--purple: #9C27B0;
--pink: #E91E63;
--red: #b71c1c;
--orange: #FF9800;
--yellow: #FFEB3B;
--green: #4CAF50;
--teal: #20c997;
--cyan: #17a2b8;
--white: #fff;
--gray: #555555;
--gray-dark: #333333;
--primary: #116894;
--secondary: #6c757d;
--success: #4d9221;
--info: #4bb1cf;
--warning: #f0ad4e;
--danger: #b71c1c;
--light: #F5F7FA;
--dark: #434A54;
--breakpoint-xs: 0;
--breakpoint-sm: 576px;
--breakpoint-md: 768px;
--breakpoint-lg: 992px;
--breakpoint-xl: 1200px;
--font-family-sans-serif: 'Source Sans 3', 'Helvetica Neue', Helvetica, Arial, sans-serif;
--font-family-monospace: Monaco, Menlo, Consolas, "Courier New", monospace;
}
article, article,
aside, aside,
details, details,
@ -2074,7 +2044,7 @@ pre code {
} }
.pre-scrollable { .pre-scrollable {
max-height: 340px; max-height: 340px;
overflow-y: auto; overflow-y: scroll;
} }
form { form {
margin: 0 0 10px; margin: 0 0 10px;
@ -6055,8 +6025,6 @@ a .icon-flip-vertical:before {
-webkit-background-clip: padding-box; -webkit-background-clip: padding-box;
-moz-background-clip: padding; -moz-background-clip: padding;
background-clip: padding-box; background-clip: padding-box;
/*scrollbar-width: thin;
scrollbar-color: rgba(128, 128, 128, 0.2) @brand-border;*/
} }
.dropdown-menu.pull-right { .dropdown-menu.pull-right {
right: 0; right: 0;
@ -6077,22 +6045,16 @@ a .icon-flip-vertical:before {
color: #333333; color: #333333;
white-space: nowrap; white-space: nowrap;
} }
.dropdown-menu::-webkit-scrollbar-track {
background-color: #f9f9f9;
}
.dropdown-menu::-webkit-scrollbar-corner {
background-color: #f9f9f9;
}
.dropdown-menu ::-webkit-scrollbar { .dropdown-menu ::-webkit-scrollbar {
width: 10px; width: 10px;
height: 10px; }
/* background-color: @box-header-bg; */ .dropdown-menu ::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 65px rgba(0, 0, 0, 0.3);
border-radius: 2px;
} }
.dropdown-menu ::-webkit-scrollbar-thumb { .dropdown-menu ::-webkit-scrollbar-thumb {
border-radius: 2px; border-radius: 2px;
background-color: #dddddd; -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.6);
border: 2px solid #f9f9f9;
/*border: 2px solid @box-header-bg;*/
} }
/* /*
.navbar-narrow .dropdown-menu { .navbar-narrow .dropdown-menu {
@ -6313,10 +6275,6 @@ i.menu-icon,
margin-right: 5px; margin-right: 5px;
margin-top: 1px; margin-top: 1px;
} }
.dropdown-scrollable .dropdown-menu {
max-height: 1000px;
overflow-y: auto;
}
.well { .well {
min-height: 20px; min-height: 20px;
padding: 10px; padding: 10px;
@ -6811,7 +6769,6 @@ i.menu-icon,
color: #444; color: #444;
display: block; display: block;
padding: 7px 10px; padding: 7px 10px;
padding-bottom: 4px;
position: relative; position: relative;
background-color: #fafafa; background-color: #fafafa;
} }
@ -6869,7 +6826,10 @@ i.menu-icon,
box-shadow: none; box-shadow: none;
} }
.box-body { .box-body {
border-radius: 0 0 3px 3px; border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
padding: 10px; padding: 10px;
} }
.no-header .box-body { .no-header .box-body {
@ -6893,13 +6853,22 @@ i.menu-icon,
margin: -9px; margin: -9px;
} }
.box-body .box-pane { .box-body .box-pane {
border-radius: 0 0 0 3px; border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 3px;
} }
.box-body .box-pane-right { .box-body .box-pane-right {
border-radius: 0 0 3px 0; border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 0;
} }
.box-footer { .box-footer {
border-radius: 0 0 3px 3px; border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
border-top: 1px solid #f4f4f4; border-top: 1px solid #f4f4f4;
border-top: none; border-top: none;
padding: 10px; padding: 10px;
@ -6916,41 +6885,17 @@ i.menu-icon,
} }
.login-box { .login-box {
padding: 50px; padding: 50px;
background: url('../images/brand-observium.svg'); background: url('../images/brand-observium.png');
background-size: 162px 34px;
background-position: right 10px bottom 10px; background-position: right 10px bottom 10px;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.shadow-box { @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( min-device-pixel-ratio: 2), only screen and ( min-resolution: 144dpi), only screen and ( min-resolution: 2dppx) {
position: relative; .login-box {
-webkit-border-radius: 3px; background: url('../images/brand-observium-x2.png');
-moz-border-radius: 3px; background-size: 162px 30px;
border-radius: 3px; background-position: right 10px bottom 10px;
padding: 10px; background-repeat: no-repeat;
margin-bottom: 10px;
width: 100%;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.24);
} }
.box-content {
/*scrollbar-width: thin;
scrollbar-color: rgba(128, 128, 128, 0.2) @brand-border;*/
}
.box-content::-webkit-scrollbar-track {
background-color: #f9f9f9;
}
.box-content::-webkit-scrollbar-corner {
background-color: #f9f9f9;
}
.box-content::-webkit-scrollbar {
width: 10px;
height: 10px;
/* background-color: @box-header-bg; */
}
.box-content::-webkit-scrollbar-thumb {
border-radius: 2px;
background-color: #dddddd;
border: 2px solid #f9f9f9;
/*border: 2px solid @box-header-bg;*/
} }
.fade { .fade {
opacity: 0; opacity: 0;
@ -8615,8 +8560,7 @@ input[type="button"].btn-block {
text-decoration: none; text-decoration: none;
} }
.navbar .brand-observium { .navbar .brand-observium {
background: url('../images/brand-observium.svg'); background: url('../images/brand-observium.png');
background-size: 162px 30px;
display: inline-block; display: inline-block;
width: 162px; width: 162px;
height: 30px; height: 30px;
@ -8625,6 +8569,12 @@ input[type="button"].btn-block {
margin: 5px; margin: 5px;
margin-right: 20px; margin-right: 20px;
} }
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( min-device-pixel-ratio: 2), only screen and ( min-resolution: 144dpi), only screen and ( min-resolution: 2dppx) {
.navbar .brand-observium {
background: url('../images/brand-observium-x2.png');
background-size: 162px 30px;
}
}
.navbar-text { .navbar-text {
margin-bottom: 0; margin-bottom: 0;
line-height: 40px; line-height: 40px;
@ -9626,7 +9576,7 @@ a.thumbnail:focus {
} }
.label { .label {
display: inline; display: inline;
padding: 0.1em 0.5em 0.1em; padding: 0.1em 0.5em 0.2em;
font-size: 80%; font-size: 80%;
font-weight: 600; font-weight: 600;
line-height: 1; line-height: 1;
@ -10499,8 +10449,7 @@ a.badge:focus {
* Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11. * Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11.
* Does not work with IE 7. * Does not work with IE 7.
*/ */
.qtip-bootstrap, .qtip-bootstrap {
.tippy-box {
/** Taken from Bootstrap body */ /** Taken from Bootstrap body */
font-size: 14px; font-size: 14px;
line-height: 20px; line-height: 20px;
@ -10547,10 +10496,9 @@ a.badge:focus {
top: 45%; top: 45%;
border-style: none; border-style: none;
} }
.qtip-bootstrap .qtip-content, .qtip-bootstrap .qtip-content {
.tippy-content {
/** Taken from Bootstrap .popover-content */ /** Taken from Bootstrap .popover-content */
padding: 9px 9px; padding: 9px 14px;
} }
.qtip-bootstrap .qtip-icon { .qtip-bootstrap .qtip-icon {
/** /**
@ -10680,6 +10628,20 @@ x:-o-prefocus,
.grid-stack > .grid-stack-item > .grid-stack-item-content { .grid-stack > .grid-stack-item > .grid-stack-item-content {
z-index: unset!important; z-index: unset!important;
} }
.box-content::-webkit-scrollbar-track {
background-color: #dddddd;
}
.box-content::-webkit-scrollbar {
width: 10px;
height: 10px;
background-color: #fafafa;
}
.box-content::-webkit-scrollbar-thumb {
border-radius: 10px;
background-color: #333333;
background-color: rgba(128, 128, 128, 0.2);
border: 2px solid #fafafa;
}
.widget-title { .widget-title {
top: 3px; top: 3px;
left: 4px; left: 4px;
@ -10954,13 +10916,11 @@ select.selectpicker {
overflow: hidden; overflow: hidden;
} }
.bootstrap-select .dropdown-toggle .caret { .bootstrap-select .dropdown-toggle .caret {
right: 12px;
/*
position: absolute; position: absolute;
top: 50%; top: 50%;
right: 12px;
margin-top: -2px; margin-top: -2px;
vertical-align: middle; vertical-align: middle;
*/
} }
.input-group .bootstrap-select.form-control .dropdown-toggle { .input-group .bootstrap-select.form-control .dropdown-toggle {
border-radius: inherit; border-radius: inherit;
@ -10988,25 +10948,6 @@ select.selectpicker {
border-radius: 0; border-radius: 0;
-webkit-box-shadow: none; -webkit-box-shadow: none;
box-shadow: none; box-shadow: none;
/*scrollbar-width: thin;
scrollbar-color: rgba(128, 128, 128, 0.2) @brand-border;*/
}
.bootstrap-select .dropdown-menu .inner::-webkit-scrollbar-track {
background-color: #f9f9f9;
}
.bootstrap-select .dropdown-menu .inner::-webkit-scrollbar-corner {
background-color: #f9f9f9;
}
.bootstrap-select .dropdown-menu .inner::-webkit-scrollbar {
width: 10px;
height: 10px;
/* background-color: @box-header-bg; */
}
.bootstrap-select .dropdown-menu .inner::-webkit-scrollbar-thumb {
border-radius: 2px;
background-color: #dddddd;
border: 2px solid #f9f9f9;
/*border: 2px solid @box-header-bg;*/
} }
.bootstrap-select .dropdown-menu li { .bootstrap-select .dropdown-menu li {
position: relative; position: relative;
@ -11851,10 +11792,6 @@ svg.leaflet-image-layer.leaflet-interactive path {
.bootstrap-select ul.inner > li.divider { .bootstrap-select ul.inner > li.divider {
margin: 2px 1px; margin: 2px 1px;
} }
/* funny label background */
.label-rainbow {
background-image: linear-gradient(to right, gray, red, orange, yellow, green, blue, indigo, violet);
}
/* Remove hover line under links */ /* Remove hover line under links */
a [class^="icon-"], a [class^="icon-"],
a [class*=" icon-"] { a [class*=" icon-"] {
@ -11887,12 +11824,6 @@ a [class*=" icon-"] {
justify-content: center; justify-content: center;
/* Optional, to align inner flex-items horizontally within the column */ /* Optional, to align inner flex-items horizontally within the column */
} }
.confirmation-buttons > .btn-group {
display: flex;
/* Do not wrap confirmation buttons */
align-items: center;
justify-content: center;
}
.editing-only { .editing-only {
display: none; display: none;
} }
@ -12086,6 +12017,15 @@ form > button.btn-icon {
margin-right: 5px; margin-right: 5px;
margin-top: 1px; margin-top: 1px;
} }
[class^="sprite-"],
[class*=" sprite-"] {
display: inline-block;
height: 16px;
width: 16px;
margin-top: 2px;
margin-right: 0.4em;
vertical-align: text-top;
}
h3 > [class*=" sprite-"], h3 > [class*=" sprite-"],
h3 > [class^="sprite-"] { h3 > [class^="sprite-"] {
margin-top: 3px; margin-top: 3px;
@ -12187,12 +12127,6 @@ form.pagination {
.form-horizontal .col-md-4 .control-label { .form-horizontal .col-md-4 .control-label {
width: 120px; width: 120px;
} }
.dygraph-axis-label > .dygraph-axis-label-x {
color: #333333;
}
.dygraph-axis-label > .dygraph-axis-label-y {
color: #333333;
}
/*EOF*/ /*EOF*/
#suggestions { #suggestions {
display: none; display: none;

7
html/css/simplemde.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 339 KiB

View File

@ -1,484 +0,0 @@
<?php
// ******************************************
// sensible defaults
$mapdir = 'configs';
$observium_base = '../../';
$observium_url = '/';
$ignore_observium = FALSE;
$config['base_url'] = $observium_url;
include_once("../includes/observium.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php");
// Don't run if weathermap isn't enabled
if (!$config['weathermap']['enable'] || $_SESSION['userlevel'] < 7) {
die();
}
$config['base_url'] = $config['url_path'] ?? $observium_url;
$observium_found = TRUE;
// ******************************************
function js_escape($str) {
$str = str_replace([ '\\', "'" ], [ '\\\\', "\\\'" ], $str);
return ("'" . $str . "'");
}
if (isset($_REQUEST['command']) && $_REQUEST["command"] == 'link_step2') {
$dataid = (int)$_REQUEST['dataid'];
?>
<html>
<head>
<script type="text/javascript">
function update_source_step2(graphid) {
var graph_url, hover_url;
var base_url = '<?php echo isset($config['base_url']) ? $config['base_url'] : ''; ?>';
if (typeof window.opener == "object") {
graph_url = base_url + 'graph.php?height=100&width=512&device=' + graphid + '&type=device_bits&legend=no';
info_url = base_url + 'device/device=' + graphid + '/';
opener.document.forms["frmMain"].node_new_name.value = 'test';
opener.document.forms["frmMain"].node_label.value = 'testing';
opener.document.forms["frmMain"].link_infourl.value = info_url;
opener.document.forms["frmMain"].link_hover.value = graph_url;
}
self.close();
}
window.onload = update_source_step2(<?php echo $graphid; ?>);
</script>
</head>
<body>
This window should disappear in a moment.
</body>
</html>
<?php
// end of link step 2
}
if (isset($_REQUEST['command']) && $_REQUEST["command"] == 'link_step1') {
?>
<html>
<head>
<script type="text/javascript" src="editor-resources/jquery-latest.min.js"></script>
<script type="text/javascript">
function filterlist(previous) {
var filterstring = $('input#filterstring').val();
if (filterstring == '') {
$('ul#dslist > li').show();
if ($('#ignore_desc').is(':checked')) {
$("ul#dslist > li:contains('Desc::')").hide();
}
} else if (filterstring != previous) {
$('ul#dslist > li').hide();
$("ul#dslist > li:contains('" + filterstring + "')").show();
if ($('#ignore_desc').is(':checked')) {
$("ul#dslist > li:contains('Desc::')").hide();
}
} else if (filterstring == previous) {
if ($('#ignore_desc').is(':checked')) {
$("ul#dslist > li:contains('Desc::')").hide();
} else {
$('ul#dslist > li').hide();
$("ul#dslist > li:contains('" + filterstring + "')").show();
}
}
}
function filterignore() {
if ($('#ignore_desc').is(':checked')) {
$("ul#dslist > li:contains('Desc::')").hide();
} else {
//$('ul#dslist > li').hide();
$("ul#dslist > li:contains('" + previous + "')").show();
}
}
$(document).ready(function () {
$('span.filter').keyup(function () {
var previous = $('input#filterstring').val();
setTimeout(function () {
filterlist(previous)
}, 500);
}).show();
$('span.ignore').click(function () {
var previous = $('input#filterstring').val();
setTimeout(function () {
filterlist(previous)
}, 500);
});
});
function update_source_step2(graphid, name, portid, ifAlias, ifDesc, ifIndex) {
var graph_url, hover_url;
var base_url = '<?php echo isset($config['base_url']) ? $config['base_url'] : ''; ?>';
if (typeof window.opener == "object") {
graph_url = base_url + 'graph.php?height=100&width=512&id=' + portid + '&type=port_bits&legend=no';
info_url = base_url + 'graphs/type=port_bits/id=' + portid + '/';
opener.document.forms["frmMain"].node_new_name.value = 'test';
opener.document.forms["frmMain"].node_label.value = 'testing';
opener.document.forms["frmMain"].link_infourl.value = info_url;
opener.document.forms["frmMain"].link_hover.value = graph_url;
}
self.close();
}
function update_source_step1(dataid, name, portid, ifAlias, ifDesc, ifIndex) {
// This must be the section that looks after link properties
var newlocation;
var fullpath;
var rra_path = <?php echo js_escape($config['install_dir'] . '/rrd/'); ?>+name + '/port-';
if (typeof window.opener == "object") {
//fullpath = rra_path + ifIndex + '.rrd:INOCTETS:OUTOCTETS';
fullpath = 'obs_port:'+portid;
//if (document.forms['mini'].aggregate.checked) {
// opener.document.forms["frmMain"].link_target.value = opener.document.forms["frmMain"].link_target.value + " " + fullpath;
//} else {
opener.document.forms["frmMain"].link_target.value = fullpath;
//}
}
if (document.forms['mini'].overlib.checked) {
window.onload = update_source_step2(dataid, name, portid, ifAlias, ifDesc, ifIndex);
} else {
self.close();
}
}
function applyDSFilterChange(objForm) {
strURL = '?host_id=' + objForm.host_id.value;
strURL = strURL + '&command=link_step1';
if (objForm.overlib.checked) {
strURL = strURL + "&overlib=1";
} else {
strURL = strURL + "&overlib=0";
}
// document.frmMain.link_bandwidth_out_cb.checked
if (objForm.aggregate.checked) {
strURL = strURL + "&aggregate=1";
} else {
strURL = strURL + "&aggregate=0";
}
document.location = strURL;
}
</script>
<style type="text/css">
body {
font-family: sans-serif;
font-size: 10pt;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
ul {
border: 1px solid black;
}
ul li.row0 {
background: #ddd;
}
ul li.row1 {
background: #ccc;
}
ul li {
border-bottom: 1px solid #aaa;
border-top: 1px solid #eee;
padding: 2px;
}
ul li a {
text-decoration: none;
color: black;
}
</style>
<title>Pick a data source</title>
</head>
<body>
<?php
$host_id = -1;
$overlib = TRUE;
$aggregate = FALSE;
if (isset($_REQUEST['aggregate'])) {
$aggregate = ($_REQUEST['aggregate'] == 0 ? FALSE : TRUE);
}
if (isset($_REQUEST['overlib'])) {
$overlib = ($_REQUEST['overlib'] == 0 ? FALSE : TRUE);
}
if (isset($_REQUEST['host_id'])) {
$host_id = (int)$_REQUEST['host_id'];
}
$hosts = dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` ORDER BY `hostname`");
?>
<h3>Pick an Observium port:</h3>
<form name="mini">
<?php
if (!safe_empty($hosts)) {
print 'Host: <select name="host_id" onChange="applyDSFilterChange(document.mini)">';
print '<option ' . ($host_id == -1 ? 'SELECTED' : '') . ' value="-1">Any</option>';
print '<option ' . ($host_id == 0 ? 'SELECTED' : '') . ' value="0">None</option>';
foreach ($hosts as $host) {
print '<option ';
if ($host_id == $host['device_id']) {
print " SELECTED ";
}
print 'value="' . $host['device_id'] . '">' . $host['hostname'] . '</option>';
}
print '</select><br />';
}
print '<span class="filter" style="display: none;">Filter: <input id="filterstring" name="filterstring" size="20"> (case-sensitive)<br /></span>';
print '<input id="overlib" name="overlib" type="checkbox" value="yes" ' . ($overlib ? 'CHECKED' : '') . '> <label for="overlib">Also set OVERLIBGRAPH and INFOURL.</label><br />';
print '<input id="aggregate" name="aggregate" type="checkbox" value="yes" ' . ($aggregate ? 'CHECKED' : '') . '> <label for="aggregate">Append TARGET to existing one (Aggregate)</label><br />';
print '<span class="ignore"><input id="ignore_desc" name="ignore_desc" type="checkbox" value="yes"> <label for="ignore_desc">Ignore blank interface descriptions</label></span>';
print '</form><div class="listcontainer"><ul id="dslist">';
$query = "SELECT devices.device_id,hostname,ports.port_id,ports.ifAlias,ports.ifIndex,ports.ifDescr FROM devices LEFT JOIN ports ON devices.device_id=ports.device_id WHERE ports.disabled=0";
if ($host_id > 0) {
$query .= " AND devices.device_id='$host_id'";
}
$query .= " ORDER BY hostname,ports.ifAlias";
$ports = dbFetchRows($query);
$i = 0;
if (count($ports) > 0) {
foreach ($ports as $port) {
echo "<li class=\"row" . ($i % 2) . "\">";
$key = $port['device_id'] . "','" . $port['hostname'] . "','" . $port['port_id'] . "','" . addslashes($port['ifAlias']) . "','" . addslashes($port['ifDescr']) . "','" . $port['ifIndex'];
echo "<a href=\"#\" onclick=\"update_source_step1('$key')\">
<span style='color:darkred'>" . $port['hostname'] . "</span> <b>|</b>
<span style='color:darkblue'>" . $port['ifDescr'] . "</span> <b>|</b> " .
$port['ifAlias'] . "</a>";
echo "</li>\n";
$i++;
}
} else {
print "<li>No results...</li>";
}
?>
</ul>
</div>
</body>
</html>
<?php
} // end of link step 1
if (isset($_REQUEST['command']) && $_REQUEST["command"] == 'node_step1') {
$host_id = -1;
$overlib = TRUE;
$aggregate = FALSE;
if (isset($_REQUEST['aggregate'])) {
$aggregate = ($_REQUEST['aggregate'] == 0 ? FALSE : TRUE);
}
if (isset($_REQUEST['overlib'])) {
$overlib = ($_REQUEST['overlib'] == 0 ? FALSE : TRUE);
}
if (isset($_REQUEST['host_id'])) {
$host_id = (int)$_REQUEST['host_id'];
}
$hosts = dbFetchRows("SELECT `device_id` AS `id`,`hostname` as `name` FROM `devices` ORDER BY `hostname`");
?>
<html>
<head>
<script type="text/javascript" src="editor-resources/jquery-latest.min.js"></script>
<script type="text/javascript">
function filterlist(previous) {
var filterstring = $('input#filterstring').val();
if (filterstring == '') {
$('ul#dslist > li').show();
return;
}
if (filterstring != previous) {
$('ul#dslist > li').hide();
$("ul#dslist > li:contains('" + filterstring + "')").show();
//$('ul#dslist > li').contains(filterstring).show();
}
}
$(document).ready(function () {
$('span.filter').keyup(function () {
var previous = $('input#filterstring').val();
setTimeout(function () {
filterlist(previous)
}, 500);
}).show();
});
function applyDSFilterChange(objForm) {
strURL = '?host_id=' + objForm.host_id.value;
strURL = strURL + '&command=node_step1';
if (objForm.overlib.checked) {
strURL = strURL + "&overlib=1";
} else {
strURL = strURL + "&overlib=0";
}
document.location = strURL;
}
</script>
<script type="text/javascript">
function update_source_step1(graphid, name) {
// This is the section that sets the Node Properties
var graph_url, hover_url;
var base_url = '<?php echo($config['base_url'] ?? ''); ?>';
if (typeof window.opener == "object") {
graph_url = base_url + 'graph.php?height=100&width=512&device=' + graphid + '&type=device_bits&legend=no';
info_url = base_url + 'device/device=' + graphid + '/';
// only set the overlib URL unless the box is checked
if (document.forms['mini'].overlib.checked) {
opener.document.forms["frmMain"].node_infourl.value = info_url;
}
opener.document.forms["frmMain"].node_hover.value = graph_url;
opener.document.forms["frmMain"].node_new_name.value = name;
opener.document.forms["frmMain"].node_label.value = name;
}
self.close();
}
</script>
<style type="text/css">
body {
font-family: sans-serif;
font-size: 10pt;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
ul {
border: 1px solid black;
}
ul li.row0 {
background: #ddd;
}
ul li.row1 {
background: #ccc;
}
ul li {
border-bottom: 1px solid #aaa;
border-top: 1px solid #eee;
padding: 2px;
}
ul li a {
text-decoration: none;
color: black;
}
</style>
<title>Pick a graph</title>
</head>
<body>
<h3>Pick a graph:</h3>
<form name="mini">
<?php
if (!safe_empty($hosts)) {
print 'Host: <select name="host_id" onChange="applyDSFilterChange(document.mini)">';
print '<option ' . ($host_id == -1 ? 'SELECTED' : '') . ' value="-1">Any</option>';
print '<option ' . ($host_id == 0 ? 'SELECTED' : '') . ' value="0">None</option>';
foreach ($hosts as $host) {
print '<option ';
if ($host_id == $host['id']) {
print " SELECTED ";
}
print 'value="' . $host['id'] . '">' . $host['name'] . '</option>';
}
print '</select><br />';
}
print '<span class="filter" style="display: none;">Filter: <input id="filterstring" name="filterstring" size="20"> (case-sensitive)<br /></span>';
print '<input id="overlib" name="overlib" type="checkbox" value="yes" ' . ($overlib ? 'CHECKED' : '') . '> <label for="overlib">Set both OVERLIBGRAPH and INFOURL.</label><br />';
print '</form><div class="listcontainer"><ul id="dslist">';
if (!empty($SQL_picklist)) {
foreach (dbFetchRows($SQL_picklist) as $queryrows) {
echo "<li>";
$key = $queryrows['id'];
$name = $queryrows['name'];
echo "<a href=\"#\" onclick=\"update_source_step1('$key','$name')\">" . $queryrows['name'] . "</a>";
echo "</li>\n";
$i++;
}
}
//..} else {
// print "No results...";
// }
?>
</ul>
</body>
</html>
<?php
} // end of node step 1
// EOF

View File

@ -1,47 +1,39 @@
<?php <?php
/** /**
* Observium * Observium
* *
* This file is part of Observium. * This file is part of Observium.
* *
* @package observium * @package observium
* @subpackage web * @subpackage webinterface
* @copyright (C) Adam Armstrong * @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* *
*/ */
include_once("../includes/observium.inc.php"); include_once("../includes/sql-config.inc.php");
if (!$config['web_iframe'] && is_iframe()) {
print_error_permission("Not allowed to run in a iframe!");
die();
}
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted($_GET['id']))) { if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted($_GET['id'])))
{
$port = get_port_by_id($_GET['id']); $port = get_port_by_id($_GET['id']);
$device = device_by_id_cache($port['device_id']); $device = device_by_id_cache($port['device_id']);
//$title = generate_device_link($device); //$title = generate_device_link($device);
//$title .= " :: Port ".generate_port_link($port); //$title .= " :: Port ".generate_port_link($port);
$auth = TRUE; $auth = TRUE;
if ($device['os'] === 'netapp' && is_device_mib($device, "NETAPP-MIB")) { $time = time();
$oid_in_octets = 'if64InOctets'; $HC = ($port['port_64bit'] ? 'HC' : '');
$oid_out_octets = 'if64OutOctets';
$mib = "NETAPP-MIB";
} else {
$oid_in_octets = $port['port_64bit'] ? 'ifHCInOctets' : 'ifInOctets';
$oid_out_octets = $port['port_64bit'] ? 'ifHCOutOctets' : 'ifOutOctets';
$mib = "IF-MIB";
}
$data = snmp_get_multi_oid($device, [ $oid_in_octets . '.' . $port['ifIndex'], $oid_out_octets . '.' . $port['ifIndex'] ], [], $mib); $data = snmp_get_multi_oid($device, "if${HC}InOctets.".$port['ifIndex']." if${HC}OutOctets.".$port['ifIndex'], array(),"IF-MIB");
printf("%lf|%s|%s\n", snmp_endtime(), $data[$port['ifIndex']][$oid_in_octets], $data[$port['ifIndex']][$oid_out_octets]); printf("%lf|%s|%s\n", $time, $data[$port['ifIndex']]["if${HC}InOctets"], $data[$port['ifIndex']]["if${HC}OutOctets"]);
} else { } else {
// not authenticated echo("unauthenticated");
die("Unauthenticated"); exit;
} }
// EOF // EOF

View File

@ -1,18 +0,0 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage web
* @copyright (C) Adam Armstrong
*
*/
include_once("../includes/observium.inc.php");
//r(array_key_first($_GET));
display_error_http(array_key_first($_GET));
// EOF

View File

@ -6,16 +6,24 @@
* *
* @package observium * @package observium
* @subpackage feed * @subpackage feed
* @copyright (C) Adam Armstrong * @author Mike Stupalov <mike@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* *
*/ */
include_once("../includes/observium.inc.php"); /*
if (isset($_GET['debug']) && $_GET['debug'])
if (is_iframe()) { {
display_error_http(403, 'Not allowed to run in a iframe'); ini_set('display_errors', 1);
ini_set('display_startup_errors', 0);
ini_set('log_errors', 0);
ini_set('allow_url_fopen', 0);
ini_set('error_reporting', E_ALL);
} }
*/
include_once("../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
//include($config['html_dir'] . "/includes/authenticate.inc.php"); // not for RSS! //include($config['html_dir'] . "/includes/authenticate.inc.php"); // not for RSS!
$auth = FALSE; $auth = FALSE;
@ -23,16 +31,20 @@ $vars = get_vars('GET');
// Auth // Auth
if (isset($vars['hash']) && strlen($vars['hash']) >= 16 && if (isset($vars['hash']) && strlen($vars['hash']) >= 16 &&
is_numeric($vars['id']) && $vars['id'] > 0) { is_numeric($vars['id']) && $vars['id'] > 0)
{
$key = get_user_pref($vars['id'], 'atom_key'); $key = get_user_pref($vars['id'], 'atom_key');
if ($key) { if ($key)
{
// Check hash auth // Check hash auth
if ($data = decrypt($vars['hash'], $key)) { if ($data = decrypt($vars['hash'], $key))
{
//var_dump($data); //var_dump($data);
$data = explode('|', $data); // user_id|user_level|auth_mechanism $data = explode('|', $data); // user_id|user_level|auth_mechanism
$data_c = count($data); $data_c = count($data);
if ($data_c == 3) { if ($data_c == 3)
{
$user_id = $data[0]; $user_id = $data[0];
$user_level = $data[1]; // FIXME, need new way for check userlevel, because it can be changed $user_level = $data[1]; // FIXME, need new way for check userlevel, because it can be changed
$check_auth_mechanism = $config['auth_mechanism'] == $data[2]; $check_auth_mechanism = $config['auth_mechanism'] == $data[2];
@ -49,8 +61,26 @@ if (isset($vars['hash']) && strlen($vars['hash']) >= 16 &&
} }
//var_dump($auth); //var_dump($auth);
if (!$auth) { if (!$auth)
display_error_http(401, 'Update feed url'); {
//header("HTTP/1.1 401 Unauthorized"); // This force basic auth form (login/password), which unsupported here
header("HTTP/1.1 403 Forbidden");
if ($vars)
{
?>
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Update feed url</H2>
</BODY>
</HTML>
<?php
}
exit;
} }
// End auth // End auth
@ -59,13 +89,14 @@ $_SESSION['user_id'] = $user_id;
$_SESSION['userlevel'] = $user_level; $_SESSION['userlevel'] = $user_level;
$permissions = permissions_cache($_SESSION['user_id']); $permissions = permissions_cache($_SESSION['user_id']);
session_write_close(); session_commit();
include($config['html_dir'] . "/includes/cache-data.inc.php"); // Need for check permissions include($config['html_dir'] . "/includes/cache-data.inc.php"); // Need for check permissions
$use_rss = $vars['v'] === 'rss'; // In most cases used ATOM feed $use_rss = ($vars['v'] == 'rss' ? TRUE : FALSE); // In most cases used ATOM feed
$param = ['short' => TRUE, 'pagesize' => 25]; $param = array('short' => TRUE, 'pagesize' => 25);
if (is_numeric($vars['size'])) { if (is_numeric($vars['size']))
{
$param['pagesize'] = $vars['size']; $param['pagesize'] = $vars['size'];
} }
@ -77,7 +108,8 @@ $feed_description = "Latest eventlogs from observium on $base_url";
$feed_link = $base_url.'/eventlog/'; $feed_link = $base_url.'/eventlog/';
$events = get_events_array($param); $events = get_events_array($param);
if ($use_rss) { if ($use_rss)
{
// create rss // create rss
// See format options here: http://validator.w3.org/feed/docs/rss2.html // See format options here: http://validator.w3.org/feed/docs/rss2.html
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"></rss>'); $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"></rss>');
@ -108,21 +140,23 @@ if ($use_rss) {
$xml->addChild('updated', date(DATE_ATOM, strtotime($events['updated']))); $xml->addChild('updated', date(DATE_ATOM, strtotime($events['updated'])));
} }
foreach ($events['entries'] as $entry) { foreach ($events['entries'] as $entry)
{
$entry_device = device_by_id_cache($entry['device_id']); $entry_device = device_by_id_cache($entry['device_id']);
$entry_vars = ['page' => 'device', $entry_vars = array('page' => 'device',
'device' => $entry['device_id'], 'device' => $entry['device_id'],
'tab' => 'logs', 'tab' => 'logs',
'section' => 'eventlog', 'section' => 'eventlog',
'type' => $entry['type'], 'type' => $entry['type'],
'timestamp_from' => $entry['timestamp'], 'timestamp_from' => $entry['timestamp'],
'timestamp_to' => $entry['timestamp']]; 'timestamp_to' => $entry['timestamp']);
$entry_title = escape_html('['.$entry_device['hostname'].'] '.$entry['message']); $entry_title = escape_html('['.$entry_device['hostname'].'] '.$entry['message']);
$entry_description = escape_html('['.$entry_device['hostname']."]\n".strtoupper($entry['type']).': '.$entry['message']); $entry_description = escape_html('['.$entry_device['hostname']."]\n".strtoupper($entry['type']).': '.$entry['message']);
$entry_link = $base_url.'/'.generate_device_url($entry_device, $entry_vars); $entry_link = $base_url.'/'.generate_device_url($entry_device, $entry_vars);
$entry_id = $entry_link.'guid='.md5($entry['event_id']); $entry_id = $entry_link.'guid='.md5($entry['event_id']);
if ($use_rss) { if ($use_rss)
{
// add item element for each article // add item element for each article
$item = $xml->channel->addChild('item'); $item = $xml->channel->addChild('item');
$item->addChild('title', $entry_title); $item->addChild('title', $entry_title);

100
html/geojson.php Normal file
View File

@ -0,0 +1,100 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage web
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
ini_set('allow_url_fopen', 0);
include_once("../includes/sql-config.inc.php");
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php");
include($config['html_dir'] . "/includes/cache-data.inc.php");
if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) {
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
}
$vars = get_vars('GET');
$geo = array();
foreach ($GLOBALS['cache']['devices']['id'] as $device)
{
if (!$config['web_show_disabled'] && $device["disabled"]) { continue; }
$lat = (is_numeric($device['location_lat']) ? $device['location_lat'] : $config['geocoding']['default']['lat']);
$lon = (is_numeric($device['location_lon']) ? $device['location_lon'] : $config['geocoding']['default']['lon']);
if ($device["status"] == "0")
{
if ($device["ignore"] == "0")
{
$locations[$lat][$lon]["down_hosts"][] = $device;
}
} else {
$locations[$lat][$lon]["up_hosts"][] = $device;
}
}
foreach ($locations as $la => $lat)
{
foreach ($lat as $lo => $lon)
{
$tooltip = "";
$num_up = safe_count($lon["up_hosts"]);
$num_down = safe_count($lon["down_hosts"]);
$total_hosts = $num_up + $num_down;
$tooltip = '<p><span class="label label-success">Up '.$num_up.'</span> <span class="label label-error">Down '.$num_down.'</span></p>';
$state = 'unknown';
$location_name = "";
if ($num_down > 0)
{
$state = 'down';
$location_name = ($lon['down_hosts'][0]['location'] === '' ? OBS_VAR_UNSET : $lon['down_hosts'][0]['location']);
$location_url = generate_location_url($lon['down_hosts'][0]['location']);
}
elseif ($num_up > 0)
{
$state = 'up';
$location_name = ($lon['up_hosts'][0]['location'] === '' ? OBS_VAR_UNSET : $lon['up_hosts'][0]['location']);
$location_url = generate_location_url($lon['up_hosts'][0]['location']);
}
$tooltip = "<h3>".$location_name."</h3><hr />".$tooltip;
foreach ($lon["down_hosts"] as $down_host) {
$tooltip .= '<span class="label label-error">' . escape_html($down_host['hostname']) .'</span> ';
}
$feature = array('geometry' => array('type' => 'Point',
'coordinates' => array((float)$lo, (float)$la)),
'type' => 'Feature',
'properties' => array('name' => $location_name,
'state' => $state,
'id' => safename($location_name),
'popupContent' => $tooltip,
'url' => $location_url));
$features[] = $feature;
//echo "[$la, $lo, $num_up, $num_down, \"$tooltip\", '$location_name', '$location_url'],\n ";
}
}
$geo = array('type' => 'FeatureCollection', 'features' => $features);
header('Content-type: application/javascript');
//echo 'var geojson = ' . json_encode($geo) . ';';
//print_r($features);
echo safe_json_encode($geo);
//r($geo);
// EOF

View File

@ -12,16 +12,9 @@
* *
*/ */
include_once("../includes/observium.inc.php"); include_once("../includes/sql-config.inc.php");
if (!$config['web_iframe'] && is_iframe() &&
!http_match_referer('!/device/device=\d+/tab=port/.*?/view=realtime/!')) {
//bdump($_SERVER['HTTP_SEC_FETCH_DEST']);
//bdump($_SERVER['HTTP_REFERER']); //'HTTP_SEC_FETCH_SITE' => 'same-origin'
print_error_permission("Not allowed to run in a iframe!");
die();
}
include($config['html_dir'] . "/includes/functions.inc.php");
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
// Push $_GET into $vars to be compatible with web interface naming // Push $_GET into $vars to be compatible with web interface naming
@ -29,14 +22,16 @@ $vars = get_vars('GET');
if (is_numeric($vars['id']) && ($config['allow_unauth_graphs'] || port_permitted($vars['id']))) if (is_numeric($vars['id']) && ($config['allow_unauth_graphs'] || port_permitted($vars['id'])))
{ {
$port = get_port_by_id_cache($vars['id']); $port = get_port_by_id($vars['id']);
$device = device_by_id_cache($port['device_id']); $device = device_by_id_cache($port['device_id']);
$title = generate_device_link($device); $title = generate_device_link($device);
$title .= " :: Port ".generate_port_link($port); $title .= " :: Port ".generate_port_link($port);
$auth = TRUE; $auth = TRUE;
} else { } else {
// not authenticated
die("Unauthenticated"); echo("Unauthenticated");
die;
} }
header("Content-type: image/svg+xml"); header("Content-type: image/svg+xml");
@ -53,11 +48,16 @@ if ($vars['title']) { $ifname = escape_html($vars['title']); }
$scale_type="follow"; //Autoscale default setup : "up" = only increase scale; "follow" = increase and decrease scale according to current graphed datas $scale_type="follow"; //Autoscale default setup : "up" = only increase scale; "follow" = increase and decrease scale according to current graphed datas
$nb_plot=240; //NB plot in graph $nb_plot=240; //NB plot in graph
// Refresh time Interval if (is_numeric($vars['interval']))
$time_interval = is_numeric($vars['interval']) ? $vars['interval'] : 1; {
$time_interval = $vars['interval'];
} else {
$time_interval = 1; // Refresh time Interval
}
$fetch_link = "data.php?id=".$vars['id']; $fetch_link = "data.php?id=".$vars['id'];
if (OBS_DEBUG) { if (OBS_DEBUG)
{
$fetch_link .= '&amp;debug=yes'; $fetch_link .= '&amp;debug=yes';
} }
@ -94,8 +94,8 @@ print('<?xml version="1.0" encoding="iso-8859-1"?>' . PHP_EOL);
<line id="axis_y" x1="0" y1="100%" x2="100%" y2="100%" <?php echo($attribs['axis']) ?>/> <line id="axis_y" x1="0" y1="100%" x2="100%" y2="100%" <?php echo($attribs['axis']) ?>/>
<path id="graph_out" d="M0 <?php echo($height) ?> L 0 <?php echo($height); ?>" <?php echo($attribs['graph_out']) ?>/> <path id="graph_out" d="M0 <?php echo($height) ?> L 0 <?php echo($height); ?>" <?php echo($attribs['graph_out']) ?>/>
<path id="graph_in" d="M0 <?php echo($height) ?> L 0 <?php echo($height); ?>" <?php echo($attribs['graph_in']) ?>/> <path id="graph_in" d="M0 <?php echo($height) ?> L 0 <?php echo($height); ?>" <?php echo($attribs['graph_in']) ?>/>
<path id="grid" d="M0 <?php echo($height / 4) ?> L <?php echo($width) ?> <?php echo($height / 4) ?> M0 <?php echo($height / 4 * 2) ?> L <?php echo($width) ?> <?php echo($height / 4 * 2) ?> M0 <?php echo ($height / 4 * 3) ?> L <?php echo($width . ' ' . ($height / 4 * 3)) ?>" <?php echo($attribs['grid'])?>/> <path id="grid" d="M0 <?php echo($height/4*1) ?> L <?php echo($width) ?> <?php echo($height/4*1) ?> M0 <?php echo($height/4*2) ?> L <?php echo($width) ?> <?php echo($height/4*2) ?> M0 <?php echo ($height/4*3) ?> L <?php echo($width . ' ' . ($height/4*3)) ?>" <?php echo($attribs['grid'])?>/>
<text id="grid_txt1" x="<?php echo($width) ?>" y="<?php echo($height / 4) ?>" <?php echo($attribs['grid_txt']) ?> text-anchor="end"> </text> <text id="grid_txt1" x="<?php echo($width) ?>" y="<?php echo($height/4*1) ?>" <?php echo($attribs['grid_txt']) ?> text-anchor="end"> </text>
<text id="grid_txt2" x="<?php echo($width) ?>" y="<?php echo($height/4*2) ?>" <?php echo($attribs['grid_txt']) ?> text-anchor="end"> </text> <text id="grid_txt2" x="<?php echo($width) ?>" y="<?php echo($height/4*2) ?>" <?php echo($attribs['grid_txt']) ?> text-anchor="end"> </text>
<text id="grid_txt3" x="<?php echo($width) ?>" y="<?php echo($height/4*3) ?>" <?php echo($attribs['grid_txt']) ?> text-anchor="end"> </text> <text id="grid_txt3" x="<?php echo($width) ?>" y="<?php echo($height/4*3) ?>" <?php echo($attribs['grid_txt']) ?> text-anchor="end"> </text>
<text id="graph_in_lbl" x="5" y="8" <?php echo($attribs['in']) ?>>In</text> <text id="graph_in_lbl" x="5" y="8" <?php echo($attribs['in']) ?>>In</text>
@ -127,33 +127,31 @@ if (typeof getURL == 'undefined') {
try { try {
if (typeof callback.operationComplete == 'function') if (typeof callback.operationComplete == 'function')
callback = callback.operationComplete; callback = callback.operationComplete;
} catch (e) { } catch (e) {}
}
if (typeof callback != 'function') if (typeof callback != 'function')
throw 'No callback function for getURL'; throw 'No callback function for getURL';
var http_request = null; var http_request = null;
if (typeof XMLHttpRequest != 'undefined') { if (typeof XMLHttpRequest != 'undefined') {
http_request = new XMLHttpRequest(); http_request = new XMLHttpRequest();
} else if (typeof ActiveXObject != 'undefined') { }
else if (typeof ActiveXObject != 'undefined'){
try { try {
http_request = new ActiveXObject('Msxml2.XMLHTTP'); http_request = new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) { } catch (e) {
try { try {
http_request = new ActiveXObject('Microsoft.XMLHTTP'); http_request = new ActiveXObject('Microsoft.XMLHTTP');
} catch (e) { } catch (e) {}
}
} }
} }
if (!http_request) if (!http_request)
throw 'Both getURL and XMLHttpRequest are undefined'; throw 'Both getURL and XMLHttpRequest are undefined';
http_request.onreadystatechange = function() { http_request.onreadystatechange = function() {
if (http_request.readyState === 4) { if (http_request.readyState == 4) {
callback( { success : true, callback( { success : true,
content : http_request.responseText, content : http_request.responseText,
contentType: http_request.getResponseHeader("Content-Type") contentType : http_request.getResponseHeader("Content-Type") } );
});
} }
} }
http_request.open('GET', url, true); http_request.open('GET', url, true);
@ -182,13 +180,15 @@ function init(evt) {
fetch_data(); fetch_data();
} }
function switch_unit(event) { function switch_unit(event)
{
SVGDoc.getElementById('switch_unit').firstChild.data = 'Switch to ' + unit + '/s'; SVGDoc.getElementById('switch_unit').firstChild.data = 'Switch to ' + unit + '/s';
unit = (unit === 'bits') ? 'bytes' : 'bits'; unit = (unit == 'bits') ? 'bytes' : 'bits';
} }
function switch_scale(event) { function switch_scale(event)
scale_type = (scale_type === 'up') ? 'follow' : 'up'; {
scale_type = (scale_type == 'up') ? 'follow' : 'up';
SVGDoc.getElementById('switch_scale').firstChild.data = 'AutoScale (' + scale_type + ')'; SVGDoc.getElementById('switch_scale').firstChild.data = 'AutoScale (' + scale_type + ')';
} }
@ -199,12 +199,8 @@ function fetch_data() {
function plot_data(obj) { function plot_data(obj) {
// Show datetimelegend // Show datetimelegend
var now = new Date(); var now = new Date();
//var datetime = (now.getMonth()+1) + "/" + now.getDate() + "/" + now.getFullYear() + ' ' + var datetime = (now.getMonth()+1) + "/" + now.getDate() + "/" + now.getFullYear() + ' ' +
// LZ(now.getHours()) + ":" + LZ(now.getMinutes()) + ":" + LZ(now.getSeconds()); LZ(now.getHours()) + ":" + LZ(now.getMinutes()) + ":" + LZ(now.getSeconds());
datetime = now.toLocaleString();
//datetime = now.toISOString();
SVGDoc.getElementById('datetime').firstChild.data = datetime; SVGDoc.getElementById('datetime').firstChild.data = datetime;
if (!obj.success) if (!obj.success)
@ -235,7 +231,7 @@ function plot_data(obj) {
diff_ifout = max - last_ifout + ifout; diff_ifout = max - last_ifout + ifout;
} }
if (diff_ugmt === 0) if (diff_ugmt == 0)
diff_ugmt = 1; /* avoid division by zero */ diff_ugmt = 1; /* avoid division by zero */
last_ugmt = ugmt; last_ugmt = ugmt;
@ -271,12 +267,13 @@ function plot_data(obj) {
SVGDoc.getElementById('graph_out_txt').firstChild.data = formatSpeed(plot_out[index_plot], unit); SVGDoc.getElementById('graph_out_txt').firstChild.data = formatSpeed(plot_out[index_plot], unit);
/* determine peak for sensible scaling */ /* determine peak for sensible scaling */
if (scale_type === 'up') { if (scale_type == 'up') {
if (plot_in[index_plot] > max) if (plot_in[index_plot] > max)
max = plot_in[index_plot]; max = plot_in[index_plot];
if (plot_out[index_plot] > max) if (plot_out[index_plot] > max)
max = plot_out[index_plot]; max = plot_out[index_plot];
} else if (scale_type === 'follow') { }
else if (scale_type == 'follow') {
i = 0; i = 0;
max = 0; max = 0;
while (i < plot_in.length) { while (i < plot_in.length) {
@ -290,14 +287,14 @@ function plot_data(obj) {
var rmax; // max, rounded up var rmax; // max, rounded up
if (unit === 'bits') { if (unit == 'bits') {
/* round up max, such that /* round up max, such that
100 kbps -> 200 kbps -> 400 kbps -> 800 kbps -> 1 Mbps -> 2 Mbps -> ... */ 100 kbps -> 200 kbps -> 400 kbps -> 800 kbps -> 1 Mbps -> 2 Mbps -> ... */
rmax = 12500; rmax = 12500;
i = 0; i = 0;
while (max > rmax) { while (max > rmax) {
i++; i++;
if (i && (i % 4 === 0)) if (i && (i % 4 == 0))
rmax *= 1.25; rmax *= 1.25;
else else
rmax *= 2; rmax *= 2;
@ -309,12 +306,12 @@ function plot_data(obj) {
i = 0; i = 0;
while (max > rmax) { while (max > rmax) {
i++; i++;
if (i && (i % 4 === 0)) if (i && (i % 4 == 0))
rmax *= 1.25; rmax *= 1.25;
else else
rmax *= 2; rmax *= 2;
if (i === 8) if (i == 8)
rmax *= 1.024; rmax *= 1.024;
} }
} }
@ -328,7 +325,8 @@ function plot_data(obj) {
var path_in = "M 0 " + (<?php echo($height) ?> - (plot_in[0] * scale)); var path_in = "M 0 " + (<?php echo($height) ?> - (plot_in[0] * scale));
var path_out = "M 0 " + (<?php echo($height) ?> - (plot_out[0] * scale)); var path_out = "M 0 " + (<?php echo($height) ?> - (plot_out[0] * scale));
for (i = 1; i < plot_in.length; i++) { for (i = 1; i < plot_in.length; i++)
{
var x = step * i; var x = step * i;
var y_in = <?php echo($height) ?> - (plot_in[i] * scale); var y_in = <?php echo($height) ?> - (plot_in[i] * scale);
var y_out = <?php echo($height) ?> - (plot_out[i] * scale); var y_out = <?php echo($height) ?> - (plot_out[i] * scale);
@ -353,9 +351,9 @@ function isNumber(a) {
} }
function formatSpeed(speed, unit) { function formatSpeed(speed, unit) {
if (unit === 'bits') if (unit == 'bits')
return formatSpeedBits(speed); return formatSpeedBits(speed);
if (unit === 'bytes') if (unit == 'bytes')
return formatSpeedBytes(speed); return formatSpeedBytes(speed);
} }
@ -365,10 +363,8 @@ function formatSpeedBits(speed) {
return Math.round(speed / 125) + " Kbps"; return Math.round(speed / 125) + " Kbps";
if (speed < 125000000) if (speed < 125000000)
return Math.round(speed / 1250)/100 + " Mbps"; return Math.round(speed / 1250)/100 + " Mbps";
if (speed < 125000000000)
return Math.round(speed / 1250000)/100 + " Gbps";
// else // else
return Math.round(speed / 125000000000)/100 + " Tbps"; /* wow! */ return Math.round(speed / 1250000)/100 + " Gbps"; /* wow! */
} }
function formatSpeedBytes(speed) { function formatSpeedBytes(speed) {
@ -377,10 +373,8 @@ function formatSpeedBytes(speed) {
return Math.round(speed / 10.24)/100 + " KB/s"; return Math.round(speed / 10.24)/100 + " KB/s";
if (speed < 1073741824) if (speed < 1073741824)
return Math.round(speed / 10485.76)/100 + " MB/s"; return Math.round(speed / 10485.76)/100 + " MB/s";
if (speed < 1099511627776)
return Math.round(speed / 10737418.24)/100 + " GB/s";
// else // else
return Math.round(speed / 10995116277.76)/100 + " TB/s"; /* wow! */ return Math.round(speed / 10737418.24)/100 + " GB/s"; /* wow! */
} }
function LZ(x) { function LZ(x) {

View File

@ -6,7 +6,7 @@
* *
* @package observium * @package observium
* @subpackage graphs * @subpackage graphs
* @copyright (C) Adam Armstrong * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* *
*/ */
@ -15,9 +15,11 @@
// Define this is graph // Define this is graph
define('OBS_GRAPH', TRUE); define('OBS_GRAPH', TRUE);
$gstart = microtime(TRUE); // Needs common.php include_once("../includes/sql-config.inc.php");
include_once("../includes/observium.inc.php"); $start = utime(); // Needs common.php
include($config['html_dir'] . "/includes/functions.inc.php");
if (isset($config['allow_unauth_graphs']) && $config['allow_unauth_graphs']) { if (isset($config['allow_unauth_graphs']) && $config['allow_unauth_graphs']) {
$auth = TRUE; // hardcode auth for all with config function $auth = TRUE; // hardcode auth for all with config function
@ -34,8 +36,6 @@ if (!isset($auth) || !$auth) {
// Normal auth // Normal auth
include($config['html_dir'] . "/includes/authenticate.inc.php"); include($config['html_dir'] . "/includes/authenticate.inc.php");
$auth = $_SESSION['authenticated']; $auth = $_SESSION['authenticated'];
} elseif (!isset($_SESSION['userlevel']) && $auth) {
$_SESSION['userlevel'] = 7; // Set global read for session when $auth hardcoded
} }
// Push $_GET into $vars to be compatible with web interface naming // Push $_GET into $vars to be compatible with web interface naming
@ -44,7 +44,7 @@ $vars = get_vars('GET', $auth);
include($config['html_dir'] . "/includes/graphs/graph.inc.php"); include($config['html_dir'] . "/includes/graphs/graph.inc.php");
$runtime = elapsed_time($gstart); $runtime = utime() - $start;
print_debug("Runtime ".$runtime." secs"); print_debug("Runtime ".$runtime." secs");

BIN
html/images/16/Thumbs.db Executable file

Binary file not shown.

BIN
html/images/16/accept.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

BIN
html/images/16/add.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
html/images/16/anchor.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

View File

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

BIN
html/images/16/application_go.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

View File

Before

Width:  |  Height:  |  Size: 510 B

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

BIN
html/images/16/application_xp.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

View File

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

BIN
html/images/16/arrow_branch.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

BIN
html/images/16/arrow_divide.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

BIN
html/images/16/arrow_down.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

BIN
html/images/16/arrow_in.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

BIN
html/images/16/arrow_inout.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

BIN
html/images/16/arrow_join.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

BIN
html/images/16/arrow_left.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

BIN
html/images/16/arrow_merge.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

BIN
html/images/16/arrow_out.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

BIN
html/images/16/arrow_redo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

BIN
html/images/16/arrow_refresh.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

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