Update php-codesniffer (#11368)

* PHPCS 3.5+

* Fix newly detected style issues
This commit is contained in:
Tony Murray
2020-04-03 08:41:24 -05:00
committed by GitHub
parent 1445263290
commit 217969e140
112 changed files with 774 additions and 810 deletions
@@ -46,14 +46,14 @@ class FilePermissionsException extends \Exception implements UpgradeableExceptio
return new static();
}
// cannot write to bootstrap directory
// cannot write to bootstrap directory
if ($exception instanceof \Exception && $exception->getMessage() == 'The bootstrap/cache directory must be present and writable.') {
return new static ();
return new static();
}
// monolog cannot init log file
// monolog cannot init log file
if ($exception instanceof \UnexpectedValueException && str_contains($exception->getFile(), 'Monolog/Handler/StreamHandler.php')) {
return new static();
return new static();
}
return null;
+45 -45
View File
@@ -51,7 +51,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
{
// implement other encapsulation values
$map = sprintf("%032b", $tmnxEncapVal);
if (substr($map, -32, 20) == '00000000000000000000') { // 12-bit IEEE 802.1Q VLAN ID
if ($tmnxEncapVal == 4095) {
return '*';
@@ -66,13 +66,13 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
* @param scheme
* @return converted ifName
* see TIMETRA-TC-MIB::TmnxPortID
*/
*/
private function nokiaIfName($tmnxPortId, $scheme)
{
// Fixme implement other schemes and channels
if ($scheme == 'schemeA') {
$map = sprintf("%032b", $tmnxPortId);
if (substr($map, -32, 4) == '0101') { // LAG Port
if (substr($map, -28, 4) == '1011') { // Pseudowire Port
return "pw-" . bindec(substr($map, -10, 10));
@@ -237,7 +237,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
}
return $svcs;
}
/**
* @return Collection MplsSap objects
*/
@@ -245,7 +245,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
{
$mplsSapCache = snmpwalk_cache_multi_oid($this->getDevice(), 'sapBaseInfoTable', [], 'TIMETRA-SAP-MIB', 'nokia', '-OQUst');
$portScheme = snmp_get($this->getDevice(), 'tmnxChassisPortIdScheme.1', '-Oqv', 'TIMETRA-CHASSIS-MIB', 'nokia');
$saps = collect();
// Workaround, there are some oids not covered by actual MIB, try to filter them
@@ -274,7 +274,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
'sapAdminStatus' => $value['sapAdminStatus'],
'sapOperStatus' => $value['sapOperStatus'],
'sapLastMgmtChange' => round($value['sapLastMgmtChange'] / 100),
'sapLastStatusChange' => round($value['sapLastStatusChange'] /100),
'sapLastStatusChange' => round($value['sapLastStatusChange'] / 100),
]));
}
return $saps;
@@ -330,12 +330,12 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
$mplsTunnelArHopCache = snmpwalk_cache_multi_oid($this->getDevice(), 'vRtrMplsTunnelARHopTable', $mplsTunnelArHopCache, 'TIMETRA-MPLS-MIB', 'nokia', '-OQUsb');
// vRtrMplsTunnelARHopProtection Bits
$localAvailable = 0b10000000;
$localInUse = 0b01000000;
$localAvailable = 0b10000000;
$localInUse = 0b01000000;
$bandwidthProtected = 0b00100000;
$nodeProtected = 0b00010000;
$preemptionPending = 0b00001000;
$nodeId = 0b00000100;
$nodeProtected = 0b00010000;
$preemptionPending = 0b00001000;
$nodeId = 0b00000100;
$arhops = collect();
@@ -347,7 +347,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
$localLinkProtection = ($protection & $localAvailable) ? "true" : "false";
$linkProtectionInUse = ($protection & $localInUse) ? "true" : "false";
$bandwidthProtection = ($protection & $bandwidthProtected) ? "true" : "false";
$nextNodeProtection = ($protection & $nodeProtected) ? "true" : "false";
$nextNodeProtection = ($protection & $nodeProtected) ? "true" : "false";
if (isset($mplsTunnelARHopListIndex, $mplsTunnelARHopIndex, $lsp_path_id)) {
$arhops->push(new MplsTunnelArHop([
@@ -385,19 +385,19 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
$lsp_path_id = $paths->firstWhere('mplsLspPathTunnelCHopListIndex', $mplsTunnelCHopListIndex)->lsp_path_id;
d_echo('mplsTunnelCHopListIndex: ' . $mplsTunnelCHopListIndex . ' mplsTunnelCHopIndex: ' . $mplsTunnelCHopIndex . ' path: ' . $paths->firstWhere('mplsLspPathTunnelCHopListIndex', $mplsTunnelCHopListIndex));
# if (isset($mplsTunnelCHopListIndex, $mplsTunnelCHopIndex, $lsp_path_id)) {
$chops->push(new MplsTunnelCHop([
'mplsTunnelCHopListIndex' => $mplsTunnelCHopListIndex,
'mplsTunnelCHopIndex' => $mplsTunnelCHopIndex,
'lsp_path_id' => $lsp_path_id,
'device_id' => $this->getDeviceId(),
'mplsTunnelCHopAddrType' => $value['vRtrMplsTunnelCHopAddrType'],
'mplsTunnelCHopIpv4Addr' => $value['vRtrMplsTunnelCHopIpv4Addr'],
'mplsTunnelCHopIpv6Addr' => $value['vRtrMplsTunnelCHopIpv6Addr'],
'mplsTunnelCHopAsNumber' => $value['vRtrMplsTunnelCHopAsNumber'],
'mplsTunnelCHopStrictOrLoose' => $value['vRtrMplsTunnelCHopStrictOrLoose'],
'mplsTunnelCHopRouterId' => $value['vRtrMplsTunnelCHopRtrID'],
]));
# if (isset($mplsTunnelCHopListIndex, $mplsTunnelCHopIndex, $lsp_path_id)) {
$chops->push(new MplsTunnelCHop([
'mplsTunnelCHopListIndex' => $mplsTunnelCHopListIndex,
'mplsTunnelCHopIndex' => $mplsTunnelCHopIndex,
'lsp_path_id' => $lsp_path_id,
'device_id' => $this->getDeviceId(),
'mplsTunnelCHopAddrType' => $value['vRtrMplsTunnelCHopAddrType'],
'mplsTunnelCHopIpv4Addr' => $value['vRtrMplsTunnelCHopIpv4Addr'],
'mplsTunnelCHopIpv6Addr' => $value['vRtrMplsTunnelCHopIpv6Addr'],
'mplsTunnelCHopAsNumber' => $value['vRtrMplsTunnelCHopAsNumber'],
'mplsTunnelCHopStrictOrLoose' => $value['vRtrMplsTunnelCHopStrictOrLoose'],
'mplsTunnelCHopRouterId' => $value['vRtrMplsTunnelCHopRtrID'],
]));
# }
}
return $chops;
@@ -605,7 +605,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
'sapAdminStatus' => $value['sapAdminStatus'],
'sapOperStatus' => $value['sapOperStatus'],
'sapLastMgmtChange' => round($value['sapLastMgmtChange'] / 100),
'sapLastStatusChange' => round($value['sapLastStatusChange'] /100),
'sapLastStatusChange' => round($value['sapLastStatusChange'] / 100),
]));
}
return $saps;
@@ -660,12 +660,12 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
$mplsTunnelArHopCache = snmpwalk_cache_multi_oid($this->getDevice(), 'vRtrMplsTunnelARHopTable', $mplsTunnelArHopCache, 'TIMETRA-MPLS-MIB', 'nokia', '-OQUsb');
// vRtrMplsTunnelARHopProtection Bits
$localAvailable = 0b10000000;
$localInUse = 0b01000000;
$localAvailable = 0b10000000;
$localInUse = 0b01000000;
$bandwidthProtected = 0b00100000;
$nodeProtected = 0b00010000;
$preemptionPending = 0b00001000;
$nodeId = 0b00000100;
$nodeProtected = 0b00010000;
$preemptionPending = 0b00001000;
$nodeId = 0b00000100;
$arhops = collect();
@@ -677,7 +677,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
$localLinkProtection = ($protection & $localAvailable) ? "true" : "false";
$linkProtectionInUse = ($protection & $localInUse) ? "true" : "false";
$bandwidthProtection = ($protection & $bandwidthProtected) ? "true" : "false";
$nextNodeProtection = ($protection & $nodeProtected) ? "true" : "false";
$nextNodeProtection = ($protection & $nodeProtected) ? "true" : "false";
if (isset($mplsTunnelARHopListIndex, $mplsTunnelARHopIndex, $lsp_path_id)) {
$arhops->push(new MplsTunnelArHop([
@@ -713,19 +713,19 @@ class Timos extends OS implements MplsDiscovery, MplsPolling
list($mplsTunnelCHopListIndex, $mplsTunnelCHopIndex) = explode('.', $key);
$lsp_path_id = $paths->firstWhere('mplsLspPathTunnelCHopListIndex', $mplsTunnelCHopListIndex)->lsp_path_id;
# if (isset($mplsTunnelCHopListIndex, $mplsTunnelCHopIndex, $lsp_path_id)) {
$chops->push(new MplsTunnelCHop([
'mplsTunnelCHopListIndex' => $mplsTunnelCHopListIndex,
'mplsTunnelCHopIndex' => $mplsTunnelCHopIndex,
'lsp_path_id' => $lsp_path_id,
'device_id' => $this->getDeviceId(),
'mplsTunnelCHopAddrType' => $value['vRtrMplsTunnelCHopAddrType'],
'mplsTunnelCHopIpv4Addr' => $value['vRtrMplsTunnelCHopIpv4Addr'],
'mplsTunnelCHopIpv6Addr' => $value['vRtrMplsTunnelCHopIpv6Addr'],
'mplsTunnelCHopAsNumber' => $value['vRtrMplsTunnelCHopAsNumber'],
'mplsTunnelCHopStrictOrLoose' => $value['vRtrMplsTunnelCHopStrictOrLoose'],
'mplsTunnelCHopRouterId' => $value['vRtrMplsTunnelCHopRtrID'],
]));
# if (isset($mplsTunnelCHopListIndex, $mplsTunnelCHopIndex, $lsp_path_id)) {
$chops->push(new MplsTunnelCHop([
'mplsTunnelCHopListIndex' => $mplsTunnelCHopListIndex,
'mplsTunnelCHopIndex' => $mplsTunnelCHopIndex,
'lsp_path_id' => $lsp_path_id,
'device_id' => $this->getDeviceId(),
'mplsTunnelCHopAddrType' => $value['vRtrMplsTunnelCHopAddrType'],
'mplsTunnelCHopIpv4Addr' => $value['vRtrMplsTunnelCHopIpv4Addr'],
'mplsTunnelCHopIpv6Addr' => $value['vRtrMplsTunnelCHopIpv6Addr'],
'mplsTunnelCHopAsNumber' => $value['vRtrMplsTunnelCHopAsNumber'],
'mplsTunnelCHopStrictOrLoose' => $value['vRtrMplsTunnelCHopStrictOrLoose'],
'mplsTunnelCHopRouterId' => $value['vRtrMplsTunnelCHopRtrID'],
]));
# }
}
return $chops;
+1 -1
View File
@@ -66,7 +66,7 @@
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5",
"squizlabs/php_codesniffer": "^2.9.1",
"squizlabs/php_codesniffer": "^3.5",
"staudenmeir/dusk-updater": "^1.1"
},
"suggest": {
Generated
+12 -39
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "2338365a2a722060b58077360cfe46d9",
"content-hash": "54eb2cbe2d2a9aa1d48b61b2a0045c49",
"packages": [
{
"name": "amenadiel/jpgraph",
@@ -7260,64 +7260,37 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "2.9.2",
"version": "3.5.4",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "2acf168de78487db620ab4bc524135a13cfe6745"
"reference": "dceec07328401de6211037abbb18bda423677e26"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745",
"reference": "2acf168de78487db620ab4bc524135a13cfe6745",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26",
"reference": "dceec07328401de6211037abbb18bda423677e26",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.1.2"
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"scripts/phpcs",
"scripts/phpcbf"
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
"dev-master": "3.x-dev"
}
},
"autoload": {
"classmap": [
"CodeSniffer.php",
"CodeSniffer/CLI.php",
"CodeSniffer/Exception.php",
"CodeSniffer/File.php",
"CodeSniffer/Fixer.php",
"CodeSniffer/Report.php",
"CodeSniffer/Reporting.php",
"CodeSniffer/Sniff.php",
"CodeSniffer/Tokens.php",
"CodeSniffer/Reports/",
"CodeSniffer/Tokenizers/",
"CodeSniffer/DocGenerators/",
"CodeSniffer/Standards/AbstractPatternSniff.php",
"CodeSniffer/Standards/AbstractScopeSniff.php",
"CodeSniffer/Standards/AbstractVariableSniff.php",
"CodeSniffer/Standards/IncorrectPatternException.php",
"CodeSniffer/Standards/Generic/Sniffs/",
"CodeSniffer/Standards/MySource/Sniffs/",
"CodeSniffer/Standards/PEAR/Sniffs/",
"CodeSniffer/Standards/PSR1/Sniffs/",
"CodeSniffer/Standards/PSR2/Sniffs/",
"CodeSniffer/Standards/Squiz/Sniffs/",
"CodeSniffer/Standards/Zend/Sniffs/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
@@ -7329,12 +7302,12 @@
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "http://www.squizlabs.com/php-codesniffer",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2018-11-07T22:31:41+00:00"
"time": "2020-01-30T22:20:29+00:00"
},
{
"name": "staudenmeir/dusk-updater",
+94 -94
View File
@@ -132,14 +132,14 @@ $complete = 1;
<?php
if (!empty($msg)) {
?>
?>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="alert alert-danger"><?php echo $msg; ?></div>
</div>
</div>
<?php
<?php
}
?>
@@ -157,7 +157,7 @@ if (!empty($msg)) {
<?php
if ($stage == 0) {
?>
?>
<div class="row">
<div class="col-md-6 col-md-offset-3">
@@ -172,68 +172,68 @@ if ($stage == 0) {
<th>Status</th>
<th>Comments</th>
</tr>
<?php
<?php
$complete = true;
foreach ($modules as $extension) {
if (extension_loaded("$extension")) {
$status = 'installed';
$complete = true;
foreach ($modules as $extension) {
if (extension_loaded("$extension")) {
$status = 'installed';
$row_class = 'success';
} else {
$status = 'missing';
$row_class = 'danger';
$complete = false;
}
echo "<tr class='$row_class'><td>PHP module <strong>$extension</strong></td><td>$status</td><td></td></tr>";
}
if (is_writable(session_save_path() === '' ? '/tmp' : session_save_path())) {
$status = 'yes';
$row_class = 'success';
} else {
$status = 'missing';
$status = 'no';
$row_class = 'danger';
$complete = false;
}
echo "<tr class='$row_class'><td>PHP module <strong>$extension</strong></td><td>$status</td><td></td></tr>";
}
if (is_writable(session_save_path() === '' ? '/tmp' : session_save_path())) {
$status = 'yes';
$row_class = 'success';
} else {
$status = 'no';
$row_class = 'danger';
$complete = false;
}
echo "<tr class='$row_class'><td>Session directory writable</td><td>$status</td><td>";
if ($status == 'no') {
echo session_save_path() . " is not writable";
if (function_exists('posix_getgrgid')) {
$group_info = posix_getgrgid(filegroup(session_save_path()));
if ($group_info['gid'] !== 0) { // don't suggest adding users to the root group
$group = $group_info['name'];
$user = get_current_user();
echo ", suggested fix <strong>usermod -a -G $group $user</strong>";
echo "<tr class='$row_class'><td>Session directory writable</td><td>$status</td><td>";
if ($status == 'no') {
echo session_save_path() . " is not writable";
if (function_exists('posix_getgrgid')) {
$group_info = posix_getgrgid(filegroup(session_save_path()));
if ($group_info['gid'] !== 0) { // don't suggest adding users to the root group
$group = $group_info['name'];
$user = get_current_user();
echo ", suggested fix <strong>usermod -a -G $group $user</strong>";
}
}
}
}
echo "</td></tr>";
echo "</td></tr>";
if (is_writable(Config::get('temp_dir'))) {
$status = 'yes';
$row_class = 'success';
} else {
$status = 'no';
$row_class = 'danger';
$complete = false;
}
if (is_writable(Config::get('temp_dir'))) {
$status = 'yes';
$row_class = 'success';
} else {
$status = 'no';
$row_class = 'danger';
$complete = false;
}
echo "<tr class='$row_class'><td>Temporary directory writable</td><td>$status</td><td>";
if ($status == 'no') {
echo Config::get('temp_dir') . ' is not writable';
if (function_exists('posix_getgrgid')) {
$group_info = posix_getgrgid(filegroup(session_save_path()));
if ($group_info['gid'] !== 0) { // don't suggest adding users to the root group
$group = $group_info['name'];
$user = get_current_user();
echo ", suggested fix <strong>chown $user:$group $php_temp_dir</strong>";
echo "<tr class='$row_class'><td>Temporary directory writable</td><td>$status</td><td>";
if ($status == 'no') {
echo Config::get('temp_dir') . ' is not writable';
if (function_exists('posix_getgrgid')) {
$group_info = posix_getgrgid(filegroup(session_save_path()));
if ($group_info['gid'] !== 0) { // don't suggest adding users to the root group
$group = $group_info['name'];
$user = get_current_user();
echo ", suggested fix <strong>chown $user:$group $php_temp_dir</strong>";
}
}
}
}
echo "</td></tr>";
?>
echo "</td></tr>";
?>
</table>
</div>
</div>
@@ -252,9 +252,9 @@ echo "</td></tr>";
</div>
</div>
<?php
<?php
} elseif ($stage == 1) {
?>
?>
<div class="row">
<div class="col-md-3">
@@ -306,9 +306,9 @@ echo "</td></tr>";
</div>
</div>
<?php
<?php
} elseif ($stage == "2") {
?>
?>
<div class="row">
<div class="col-md-3">
</div>
@@ -368,17 +368,17 @@ echo "</td></tr>";
xhr.send();
$('#install-progress').addClass('active')
</script>
<?php
<?php
} elseif ($stage == "5") {
?>
?>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<?php
<?php
// Create the config file we will write or display
$config_file = <<<"EOD"
$config_file = <<<"EOD"
## Have a look in defaults.inc.php for examples of settings you can set here. DO NOT EDIT defaults.inc.php!
### Database config
@@ -421,23 +421,23 @@ $config_file = <<<"EOD"
#\$config\['update'\] = 0; # uncomment to completely disable updates
EOD;
if (!file_exists("{$librenms_dir}/config.php")) {
$conf = fopen("config.php", 'w');
if ($conf != false) {
if (fwrite($conf, "<?php\n") === false) {
if (!file_exists("{$librenms_dir}/config.php")) {
$conf = fopen("config.php", 'w');
if ($conf != false) {
if (fwrite($conf, "<?php\n") === false) {
echo("<div class='alert alert-danger'>We couldn't create the config.php file, please create this manually before continuing by copying the below into a config.php in the root directory of your install (typically /opt/librenms/)</div>");
echo("<pre>&lt;?php\n".stripslashes($config_file)."</pre>");
} else {
$config_file = stripslashes($config_file);
fwrite($conf, $config_file);
echo("<div class='alert alert-success'>The config file has been created</div>");
}
} else {
echo("<div class='alert alert-danger'>We couldn't create the config.php file, please create this manually before continuing by copying the below into a config.php in the root directory of your install (typically /opt/librenms/)</div>");
echo("<pre>&lt;?php\n".stripslashes($config_file)."</pre>");
} else {
$config_file = stripslashes($config_file);
fwrite($conf, $config_file);
echo("<div class='alert alert-success'>The config file has been created</div>");
}
} else {
echo("<div class='alert alert-danger'>We couldn't create the config.php file, please create this manually before continuing by copying the below into a config.php in the root directory of your install (typically /opt/librenms/)</div>");
echo("<pre>&lt;?php\n".stripslashes($config_file)."</pre>");
}
}
?>
?>
<form class="form-horizontal" role="form" method="post">
<?php echo csrf_field() ?>
<input type="hidden" name="stage" value="6">
@@ -448,16 +448,16 @@ if (!file_exists("{$librenms_dir}/config.php")) {
<input type="hidden" name="dbsocket" value="<?php echo $dbsocket; ?>">
<button type="submit" class="btn btn-success pull-right">Finish install</button>
</form>
<?php
<?php
?>
?>
</div>
<div class="col-md-3">
</div>
</div>
<?php
<?php
} elseif ($stage == "3") {
?>
?>
<div class="row">
<div class="col-md-3">
</div>
@@ -494,31 +494,31 @@ if (!file_exists("{$librenms_dir}/config.php")) {
<div class="col-md-3">
</div>
</div>
<?php
<?php
} elseif ($stage == "4") {
$proceed = 1;
?>
?>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<?php
if (LegacyAuth::get()->canManageUsers()) {
if (!LegacyAuth::get()->userExists($add_user)) {
if (LegacyAuth::get()->addUser($add_user, $add_pass, '10', $add_email)) {
echo("<div class='alert alert-success'>User has been added successfully</div>");
$proceed = 0;
<?php
if (LegacyAuth::get()->canManageUsers()) {
if (!LegacyAuth::get()->userExists($add_user)) {
if (LegacyAuth::get()->addUser($add_user, $add_pass, '10', $add_email)) {
echo("<div class='alert alert-success'>User has been added successfully</div>");
$proceed = 0;
} else {
echo("<div class='alert alert-danger'>User hasn't been added, please try again</div>");
}
} else {
echo("<div class='alert alert-danger'>User hasn't been added, please try again</div>");
echo("<div class='alert alert-danger'>User $add_user already exists!</div>");
}
} else {
echo("<div class='alert alert-danger'>User $add_user already exists!</div>");
echo("<div class='alert alert-danger'>Auth module isn't loaded</div>");
}
} else {
echo("<div class='alert alert-danger'>Auth module isn't loaded</div>");
}
?>
?>
<form class="form-horizontal" role="form" method="post">
<?php echo csrf_field() ?>
<input type="hidden" name="stage" value="5">
@@ -538,9 +538,9 @@ if (LegacyAuth::get()->canManageUsers()) {
<div class="col-md-3">
</div>
</div>
<?php
<?php
} elseif ($stage == "6") {
?>
?>
<div class="row">
<div class="col-md-offset-3 col-md-6">
<div class="alert alert-danger">
@@ -559,7 +559,7 @@ if (LegacyAuth::get()->canManageUsers()) {
</div>
<div class="col-md-3">
</div>
<?php
<?php
}
?>
+1 -1
View File
@@ -115,7 +115,7 @@ if (Config::get('enable_bgp')) {
if (!exist($bgpPeersCache[$vrfName]) ||
!exist($bgpPeersCache[$vrfName][$entry['bgpPeerIdentifier']]) ||
$bgpPeersCache[$vrfName][$entry['bgpPeerIdentifier']][$entry['afi']] != $afi ||
$bgpPeersCache[$vrfName][$entry['bgpPeerIdentifier']][$entry['safi']] != $safi ) {
$bgpPeersCache[$vrfName][$entry['bgpPeerIdentifier']][$entry['safi']] != $safi) {
dbDelete(
'bgpPeers_cbgp',
'`device_id`=? AND `bgpPeerIdentifier`=? AND context_name=? AND afi=? AND safi=?',
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2017 Simone Fini <[email protected]>
* Copyright (c) 2017 Simone Fini <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -1,6 +1,6 @@
<?php
// Code borrowed and modified from 'powerconnect-cpu.inc.php'
// Code borrowed and modified from 'powerconnect-cpu.inc.php'
if ($device['os'] == 'dnos' || $device['os'] == 'ftos') {
echo 'DNOS-MEMORY-POOL: ';
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
* LibreNMS
* LibreNMS
*
* Copyright (c) 2017 Martin Zatloukal <[email protected]>
* This program is free software: you can redistribute it and/or modify it
@@ -9,8 +9,7 @@ if ($device['os'] == 'ironware' || $device['os_type'] == 'ironware') {
if (is_numeric($percent)) {
discover_mempool($valid_mempool, $device, 0, 'ironware-dyn', 'Dynamic Memory', '1', null, null);
} //end_if
} //end_if
else {
} else {
echo 'NetIron: ';
d_echo('caching');
+1 -2
View File
@@ -26,8 +26,7 @@ if ($device['os'] == 'junos') {
}
} //end if
} //end foreach
} //end if
else {
} else {
$srx_mempools_array = snmpwalk_cache_multi_oid($device, 'jnxJsSPUMonitoringMemoryUsage', $srx_mempools_array, 'JUNIPER-SRX5000-SPU-MONITORING-MIB', 'junos');
if (is_array($srx_mempools_array)) {
+2 -2
View File
@@ -41,7 +41,7 @@ $delete_row = [];
//store timestamp so all update / creation will be synced on same timestamp
$update_timestamp = dbFetchRows('select now() as now')[0]['now'];
//Load current DB entries:
//Load current DB entries:
$dbRoute = dbFetchRows('select * from `route` where `device_id` = ?', array($device['device_id']));
foreach ($dbRoute as $dbRow) {
$current = $mixed[$dbRow['context_name']][$dbRow['inetCidrRouteDestType']][$dbRow['inetCidrRouteDest']][$dbRow['inetCidrRoutePfxLen']][$dbRow['inetCidrRoutePolicy']][$dbRow['inetCidrRouteNextHopType']][$dbRow['inetCidrRouteNextHop']];
@@ -217,7 +217,7 @@ if (isset($ipForwardNb['0']['ipCidrRouteNumber']) && $ipForwardNb['0']['ipCidrRo
}
}
// We can now check if we have MPLS VPN routing table available :
// We can now check if we have MPLS VPN routing table available :
// MPLS-L3VPN-STD-MIB::mplsL3VpnVrfRteTable
// Route numbers : MPLS-L3VPN-STD-MIB::mplsL3VpnVrfPerfCurrNumRoutes
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -11,7 +11,7 @@
*/
echo 'Comware ';
$multiplier = 1;
$divisor = 100000;
$divisor_alarm = 1000000;
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2017 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2017 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2017 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2017 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+11 -11
View File
@@ -49,18 +49,18 @@ function meta_graph_local($host, $plugin, $plugin_instance, $type, $type_instanc
$opts['rrd_opts'] = array('-v', 'Events');
$files = array();
/* $opts['colors'] = array(
'ham' => '00e000',
'spam' => '0000ff',
'malware' => '990000',
/* $opts['colors'] = array(
'ham' => '00e000',
'spam' => '0000ff',
'malware' => '990000',
'sent' => '00e000',
'deferred' => 'a0e000',
'reject' => 'ff0000',
'bounced' => 'a00050'
);
'sent' => '00e000',
'deferred' => 'a0e000',
'reject' => 'ff0000',
'bounced' => 'a00050'
);
$type_instances = array('ham', 'spam', 'malware', 'sent', 'deferred', 'reject', 'bounced'); */
$type_instances = array('ham', 'spam', 'malware', 'sent', 'deferred', 'reject', 'bounced'); */
foreach ($type_instances as $inst) {
$file = '';
foreach (\LibreNMS\Config::get('datadirs') as $datadir) {
@@ -76,6 +76,6 @@ function meta_graph_local($host, $plugin, $plugin_instance, $type, $type_instanc
$sources[] = array('name'=>$inst, 'file'=>$file);
}
// return collectd_draw_meta_stack($opts, $sources);
// return collectd_draw_meta_stack($opts, $sources);
return collectd_draw_meta_line($opts, $sources);
}
+93 -93
View File
@@ -343,7 +343,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:rsp_avg:LAST:%5.1lf%s Last',
'GPRINT:rsp_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
"LINE1:qry_avg#$FullBlue:Queries ",
// 'GPRINT:qry_min:MIN:%5.1lf %s ',
// 'GPRINT:qry_min:MIN:%5.1lf %s ',
'GPRINT:qry_avg:AVERAGE:%5.1lf%s ',
'GPRINT:qry_max:MAX:%5.1lf%s',
'GPRINT:qry_avg:LAST:%5.1lf%s Last',
@@ -458,7 +458,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:ppm_avg:AVERAGE:%5.2lf',
'GPRINT:ppm_max:MAX:%5.2lf',
'GPRINT:ppm_avg:LAST:%5.2lf');
$GraphDefs['frequency_offset'] = array( // NTPd
$GraphDefs['frequency_offset'] = array( // NTPd
'DEF:ppm_avg={file}:ppm:AVERAGE',
'DEF:ppm_min={file}:ppm:MIN',
'DEF:ppm_max={file}:ppm:MAX',
@@ -470,7 +470,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:ppm_avg:AVERAGE:%5.2lf ',
'GPRINT:ppm_max:MAX:%5.2lf ',
'GPRINT:ppm_avg:LAST:%5.2lf');
$GraphDefs['gauge'] = array(
$GraphDefs['gauge'] = array(
#'-v', 'Exec value',
'DEF:temp_avg={file}:value:AVERAGE',
'DEF:temp_min={file}:value:MIN',
@@ -482,7 +482,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:temp_avg:AVERAGE:%6.2lf',
'GPRINT:temp_max:MAX:%6.2lf',
'GPRINT:temp_avg:LAST:%6.2lf\l');
$GraphDefs['hddtemp'] = array(
$GraphDefs['hddtemp'] = array(
#'-v', '°C',
'DEF:temp_avg={file}:value:AVERAGE',
'DEF:temp_min={file}:value:MIN',
@@ -494,7 +494,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:temp_avg:AVERAGE:%4.1lf',
'GPRINT:temp_max:MAX:%4.1lf',
'GPRINT:temp_avg:LAST:%4.1lf\l');
$GraphDefs['humidity'] = array(
$GraphDefs['humidity'] = array(
#'-v', 'Percent',
'DEF:temp_avg={file}:value:AVERAGE',
'DEF:temp_min={file}:value:MIN',
@@ -506,7 +506,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:temp_avg:AVERAGE:%4.1lf%% ',
'GPRINT:temp_max:MAX:%4.1lf%%',
'GPRINT:temp_avg:LAST:%4.1lf%%\l');
$GraphDefs['if_errors'] = array(
$GraphDefs['if_errors'] = array(
#'-v', 'Errors/s',
'--units=si',
'DEF:tx_min={file}:tx:MIN',
@@ -532,12 +532,12 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:tx_avg:LAST:%5.1lf%s Last',
'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
"LINE1:rx_avg#$FullBlue:RX",
// 'GPRINT:rx_min:MIN:%5.1lf %s ',
// 'GPRINT:rx_min:MIN:%5.1lf %s ',
'GPRINT:rx_avg:AVERAGE:%5.1lf%s ',
'GPRINT:rx_max:MAX:%5.1lf%s',
'GPRINT:rx_avg:LAST:%5.1lf%s Last',
'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l');
$GraphDefs['if_collisions'] = array(
$GraphDefs['if_collisions'] = array(
#'-v', 'Collisions/s', '--units=si',
'DEF:min_raw={file}:value:MIN',
'DEF:avg_raw={file}:value:AVERAGE',
@@ -552,7 +552,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%s ',
'GPRINT:max:MAX:%5.1lf%s',
'GPRINT:avg:LAST:%5.1lf%s\l');
$GraphDefs['if_dropped'] = array(
$GraphDefs['if_dropped'] = array(
#'-v', 'Packets/s',
'--units=si',
'DEF:tx_min={file}:tx:MIN',
@@ -578,12 +578,12 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:tx_avg:LAST:%5.1lf%s Last',
'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
"LINE1:rx_avg#$FullBlue:RX",
// 'GPRINT:rx_min:MIN:%5.1lf %s ',
// 'GPRINT:rx_min:MIN:%5.1lf %s ',
'GPRINT:rx_avg:AVERAGE:%5.1lf%s ',
'GPRINT:rx_max:MAX:%5.1lf%s',
'GPRINT:rx_avg:LAST:%5.1lf%s Last',
'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l');
$GraphDefs['if_packets'] = array(
$GraphDefs['if_packets'] = array(
#'-v', 'Packets/s',
'--units=si',
'DEF:tx_min={file}:tx:MIN',
@@ -609,12 +609,12 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:tx_avg:LAST:%5.1lf%s Last',
'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
"LINE1:rx_avg#$FullBlue:RX",
// 'GPRINT:rx_min:MIN:%5.1lf %s ',
// 'GPRINT:rx_min:MIN:%5.1lf %s ',
'GPRINT:rx_avg:AVERAGE:%5.1lf%s ',
'GPRINT:rx_max:MAX:%5.1lf%s',
'GPRINT:rx_avg:LAST:%5.1lf%s Last',
'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l');
$GraphDefs['if_rx_errors'] = array(
$GraphDefs['if_rx_errors'] = array(
'-v', 'Errors/s', '--units=si',
'DEF:min={file}:value:MIN',
'DEF:avg={file}:value:AVERAGE',
@@ -630,7 +630,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:max:MAX:%3.1lf%s',
'GPRINT:avg:LAST:%3.1lf%s Last',
'GPRINT:avg_sum:LAST:(ca. %2.0lf%s Total)\l');
$GraphDefs['ipt_bytes'] = array(
$GraphDefs['ipt_bytes'] = array(
#'-v', 'Bits/s',
'DEF:min_raw={file}:value:MIN',
'DEF:avg_raw={file}:value:AVERAGE',
@@ -646,12 +646,12 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
"AREA:max#$HalfBlue",
"AREA:min#$Canvas",
"LINE1:avg#$FullBlue:Bits/s",
// 'GPRINT:min:MIN:%5.1lf %s ',
// 'GPRINT:min:MIN:%5.1lf %s ',
'GPRINT:avg:AVERAGE:%5.1lf%s ',
'GPRINT:max:MAX:%5.1lf%s',
'GPRINT:avg:LAST:%5.1lf%s Last',
'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
$GraphDefs['ipt_packets'] = array(
$GraphDefs['ipt_packets'] = array(
#'-v', 'Packets/s',
'DEF:min_raw={file}:value:MIN',
'DEF:avg_raw={file}:value:AVERAGE',
@@ -666,7 +666,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%s ',
'GPRINT:max:MAX:%5.1lf%s',
'GPRINT:avg:LAST:%5.1lf%s\l');
$GraphDefs['irq'] = array(
$GraphDefs['irq'] = array(
#'-v', 'Issues/s',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -679,7 +679,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%6.2lf',
'GPRINT:max:MAX:%6.2lf',
'GPRINT:avg:LAST:%6.2lf\l');
$GraphDefs['load'] = array(
$GraphDefs['load'] = array(
#'-v', 'System load',
'DEF:s_avg={file}:shortterm:AVERAGE',
'DEF:s_min={file}:shortterm:MIN',
@@ -707,7 +707,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:l_avg:AVERAGE:%5.2lf',
'GPRINT:l_max:MAX:%5.2lf',
'GPRINT:l_avg:LAST:%5.2lf\\j');
$GraphDefs['load_percent'] = array(
$GraphDefs['load_percent'] = array(
'DEF:avg={file}:percent:AVERAGE',
'DEF:min={file}:percent:MIN',
'DEF:max={file}:percent:MAX',
@@ -718,7 +718,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%s%% ',
'GPRINT:max:MAX:%5.1lf%s%%',
'GPRINT:avg:LAST:%5.1lf%s%%\l');
$GraphDefs['mails'] = array(
$GraphDefs['mails'] = array(
'DEF:rawgood={file}:good:AVERAGE',
'DEF:rawspam={file}:spam:AVERAGE',
'CDEF:good=rawgood,UN,0,rawgood,IF',
@@ -735,7 +735,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:spam:MAX:%4.1lf',
'GPRINT:spam:LAST:%4.1lf',
'HRULE:0#000000');
$GraphDefs['memory'] = array(
$GraphDefs['memory'] = array(
'-b', '1024',
#'-v', 'Bytes',
'DEF:avg={file}:value:AVERAGE',
@@ -748,7 +748,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%sbyte ',
'GPRINT:max:MAX:%5.1lf%sbyte',
'GPRINT:avg:LAST:%5.1lf%sbyte\l');
$GraphDefs['old_memory'] = array(
$GraphDefs['old_memory'] = array(
'DEF:used_avg={file}:used:AVERAGE',
'DEF:free_avg={file}:free:AVERAGE',
'DEF:buffers_avg={file}:buffers:AVERAGE',
@@ -790,7 +790,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:used_avg:AVERAGE:%5.1lf%s ',
'GPRINT:used_max:MAX:%5.1lf%s',
'GPRINT:used_avg:LAST:%5.1lf%s Last');
$GraphDefs['mysql_commands'] = array(
$GraphDefs['mysql_commands'] = array(
#'-v', 'Issues/s',
"DEF:val_avg={file}:value:AVERAGE",
"DEF:val_min={file}:value:MIN",
@@ -802,7 +802,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:val_avg:AVERAGE:%5.2lf',
'GPRINT:val_max:MAX:%5.2lf',
'GPRINT:val_avg:LAST:%5.2lf');
$GraphDefs['mysql_handler'] = array(
$GraphDefs['mysql_handler'] = array(
#'-v', 'Issues/s',
"DEF:val_avg={file}:value:AVERAGE",
"DEF:val_min={file}:value:MIN",
@@ -814,7 +814,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:val_avg:AVERAGE:%5.2lf',
'GPRINT:val_max:MAX:%5.2lf',
'GPRINT:val_avg:LAST:%5.2lf');
$GraphDefs['mysql_octets'] = array(
$GraphDefs['mysql_octets'] = array(
#'-v', 'Bits/s',
'DEF:dout_min={file}:tx:MIN',
'DEF:dout_avg={file}:tx:AVERAGE',
@@ -854,7 +854,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:inc_bit_max:MAX:%5.1lf%s',
'GPRINT:inc_bit_min:MIN:%5.1lf%s\l',
'GPRINT:inc_avg_sum:LAST: (ca. %5.1lf%sB Total)\l');
$GraphDefs['mysql_qcache'] = array(
$GraphDefs['mysql_qcache'] = array(
#'-v', 'Queries/s',
"DEF:hits_min={file}:hits:MIN",
"DEF:hits_avg={file}:hits:AVERAGE",
@@ -904,7 +904,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:queries_avg:AVERAGE:%4.0lf%s ',
'GPRINT:queries_max:MAX:%4.0lf%s ',
'GPRINT:queries_avg:LAST:%4.0lf%s\l');
$GraphDefs['mysql_threads'] = array(
$GraphDefs['mysql_threads'] = array(
#'-v', 'Threads',
"DEF:running_min={file}:running:MIN",
"DEF:running_avg={file}:running:AVERAGE",
@@ -944,7 +944,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:created_avg:AVERAGE:%5.0lf',
'GPRINT:created_max:MAX:%5.0lf',
'GPRINT:created_avg:LAST:%5.0lf\l');
$GraphDefs['nfs_procedure'] = array(
$GraphDefs['nfs_procedure'] = array(
#'-v', 'Issues/s',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -956,7 +956,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%6.2lf',
'GPRINT:max:MAX:%6.2lf',
'GPRINT:avg:LAST:%6.2lf\l');
$GraphDefs['nfs3_procedures'] = array(
$GraphDefs['nfs3_procedures'] = array(
"DEF:null_avg={file}:null:AVERAGE",
"DEF:getattr_avg={file}:getattr:AVERAGE",
"DEF:setattr_avg={file}:setattr:AVERAGE",
@@ -1051,7 +1051,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:read_max:MAX:%5.1lf',
'GPRINT:read_avg:AVERAGE:%5.1lf',
'GPRINT:read_avg:LAST:%5.1lf\l');
$GraphDefs['opcode'] = array(
$GraphDefs['opcode'] = array(
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
'DEF:max={file}:value:MAX',
@@ -1062,7 +1062,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%9.3lf Average,',
'GPRINT:max:MAX:%9.3lf',
'GPRINT:avg:LAST:%9.3lf\l');
$GraphDefs['partition'] = array(
$GraphDefs['partition'] = array(
"DEF:rbyte_avg={file}:rbytes:AVERAGE",
"DEF:rbyte_min={file}:rbytes:MIN",
"DEF:rbyte_max={file}:rbytes:MAX",
@@ -1082,7 +1082,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:rbyte_avg:AVERAGE:%5.1lf%s ',
'GPRINT:rbyte_max:MAX:%5.1lf%s',
'GPRINT:rbyte_avg:LAST:%5.1lf%s\l');
$GraphDefs['percent'] = array(
$GraphDefs['percent'] = array(
#'-v', 'Percent',
'DEF:avg={file}:percent:AVERAGE',
'DEF:min={file}:percent:MIN',
@@ -1094,7 +1094,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%% ',
'GPRINT:max:MAX:%5.1lf%%',
'GPRINT:avg:LAST:%5.1lf%%\l');
$GraphDefs['ping'] = array(
$GraphDefs['ping'] = array(
'DEF:ping_avg={file}:ping:AVERAGE',
'DEF:ping_min={file}:ping:MIN',
'DEF:ping_max={file}:ping:MAX',
@@ -1105,7 +1105,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:ping_avg:AVERAGE:%4.1lf ms ',
'GPRINT:ping_max:MAX:%4.1lf ms',
'GPRINT:ping_avg:LAST:%4.1lf ms Last');
$GraphDefs['power'] = array(
$GraphDefs['power'] = array(
#'-v', 'Watt',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -1117,7 +1117,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%sW ',
'GPRINT:max:MAX:%5.1lf%sW',
'GPRINT:avg:LAST:%5.1lf%sW\l');
$GraphDefs['processes'] = array(
$GraphDefs['processes'] = array(
"DEF:running_avg={file}:running:AVERAGE",
"DEF:running_min={file}:running:MIN",
"DEF:running_max={file}:running:MAX",
@@ -1178,7 +1178,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:sleeping_avg:AVERAGE:%5.1lf Average,',
'GPRINT:sleeping_max:MAX:%5.1lf',
'GPRINT:sleeping_avg:LAST:%5.1lf\l');
$GraphDefs['ps_count'] = array(
$GraphDefs['ps_count'] = array(
#'-v', 'Processes',
'DEF:procs_avg={file}:processes:AVERAGE',
'DEF:procs_min={file}:processes:MIN',
@@ -1198,7 +1198,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:procs_avg:AVERAGE:%5.1lf',
'GPRINT:procs_max:MAX:%5.1lf',
'GPRINT:procs_avg:LAST:%5.1lf\l');
$GraphDefs['ps_cputime'] = array(
$GraphDefs['ps_cputime'] = array(
#'-v', 'Jiffies',
'DEF:user_avg_raw={file}:user:AVERAGE',
'DEF:user_min_raw={file}:user:MIN',
@@ -1225,7 +1225,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:syst_avg:AVERAGE:%5.1lf%s ',
'GPRINT:syst_max:MAX:%5.1lf%s',
'GPRINT:syst_avg:LAST:%5.1lf%s\l');
$GraphDefs['ps_pagefaults'] = array(
$GraphDefs['ps_pagefaults'] = array(
#'-v', 'Pagefaults/s',
'DEF:minor_avg={file}:minflt:AVERAGE',
'DEF:minor_min={file}:minflt:MIN',
@@ -1246,7 +1246,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:major_avg:AVERAGE:%5.1lf%s ',
'GPRINT:major_max:MAX:%5.1lf%s',
'GPRINT:major_avg:LAST:%5.1lf%s\l');
$GraphDefs['ps_rss'] = array(
$GraphDefs['ps_rss'] = array(
#'-v', 'Bytes',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -1257,7 +1257,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%s ',
'GPRINT:max:MAX:%5.1lf%s',
'GPRINT:avg:LAST:%5.1lf%s\l');
$GraphDefs['ps_state'] = array(
$GraphDefs['ps_state'] = array(
#'-v', 'Processes',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -1269,7 +1269,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%6.2lf',
'GPRINT:max:MAX:%6.2lf',
'GPRINT:avg:LAST:%6.2lf\l');
$GraphDefs['qtype'] = array(
$GraphDefs['qtype'] = array(
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
'DEF:max={file}:value:MAX',
@@ -1280,7 +1280,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%9.3lf Average,',
'GPRINT:max:MAX:%9.3lf',
'GPRINT:avg:LAST:%9.3lf\l');
$GraphDefs['rcode'] = array(
$GraphDefs['rcode'] = array(
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
'DEF:max={file}:value:MAX',
@@ -1291,7 +1291,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%9.3lf Average,',
'GPRINT:max:MAX:%9.3lf',
'GPRINT:avg:LAST:%9.3lf\l');
$GraphDefs['swap'] = array(
$GraphDefs['swap'] = array(
#'-v', 'Bytes',
'-b', '1024',
'DEF:avg={file}:value:AVERAGE',
@@ -1305,7 +1305,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%6.2lf%sByte ',
'GPRINT:max:MAX:%6.2lf%sByte',
'GPRINT:avg:LAST:%6.2lf%sByte\l');
$GraphDefs['old_swap'] = array(
$GraphDefs['old_swap'] = array(
'DEF:used_avg={file}:used:AVERAGE',
'DEF:used_min={file}:used:MIN',
'DEF:used_max={file}:used:MAX',
@@ -1348,7 +1348,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:used_avg:AVERAGE:%5.1lf%s ',
'GPRINT:used_max:MAX:%5.1lf%s',
'GPRINT:used_avg:LAST:%5.1lf%s\l');
$GraphDefs['tcp_connections'] = array(
$GraphDefs['tcp_connections'] = array(
#'-v', 'Connections',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -1360,7 +1360,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%4.1lf',
'GPRINT:max:MAX:%4.1lf',
'GPRINT:avg:LAST:%4.1lf\l');
$GraphDefs['temperature'] = array(
$GraphDefs['temperature'] = array(
#'-v', 'Celsius',
'DEF:temp_avg={file}:value:AVERAGE',
'DEF:temp_min={file}:value:MIN',
@@ -1373,7 +1373,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:temp_avg:AVERAGE:%4.1lf',
'GPRINT:temp_max:MAX:%4.1lf',
'GPRINT:temp_avg:LAST:%4.1lf\l');
$GraphDefs['signal'] = array(
$GraphDefs['signal'] = array(
'DEF:signal_avg={file}:value:AVERAGE',
'DEF:signal_min={file}:value:MIN',
'DEF:signal_max={file}:value:MAX',
@@ -1385,7 +1385,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:signal_avg:AVERAGE:%4.1lf',
'GPRINT:signal_max:MAX:%4.1lf',
'GPRINT:signal_avg:LAST:%4.1lf\l');
$GraphDefs['timeleft'] = array(
$GraphDefs['timeleft'] = array(
#'-v', 'Minutes',
'DEF:avg={file}:timeleft:AVERAGE',
'DEF:min={file}:timeleft:MIN',
@@ -1397,7 +1397,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%s ',
'GPRINT:max:MAX:%5.1lf%s',
'GPRINT:avg:LAST:%5.1lf%s\l');
$GraphDefs['time_offset'] = array( # NTPd
$GraphDefs['time_offset'] = array( # NTPd
'DEF:s_avg={file}:seconds:AVERAGE',
'DEF:s_min={file}:seconds:MIN',
'DEF:s_max={file}:seconds:MAX',
@@ -1409,7 +1409,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:s_avg:AVERAGE:%5.2lf%s',
'GPRINT:s_max:MAX:%5.2lf%s',
'GPRINT:s_avg:LAST:%5.2lf%s');
$GraphDefs['if_octets'] = array(
$GraphDefs['if_octets'] = array(
#'-v', 'Bits/s',
'--units=si',
'DEF:out_min_raw={file}:tx:MIN',
@@ -1441,12 +1441,12 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:out_avg:LAST:%5.1lf%s Last',
'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
"LINE1:inc_avg#$FullBlue:Incoming",
// 'GPRINT:inc_min:MIN:%5.1lf %s ',
// 'GPRINT:inc_min:MIN:%5.1lf %s ',
'GPRINT:inc_avg:AVERAGE:%5.1lf%s ',
'GPRINT:inc_max:MAX:%5.1lf%s',
'GPRINT:inc_avg:LAST:%5.1lf%s Last',
'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
$GraphDefs['cpufreq'] = array(
$GraphDefs['cpufreq'] = array(
'DEF:cpufreq_avg={file}:value:AVERAGE',
'DEF:cpufreq_min={file}:value:MIN',
'DEF:cpufreq_max={file}:value:MAX',
@@ -1457,7 +1457,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:cpufreq_avg:AVERAGE:%5.1lf%s ',
'GPRINT:cpufreq_max:MAX:%5.1lf%s',
'GPRINT:cpufreq_avg:LAST:%5.1lf%s\l');
$GraphDefs['multimeter'] = array(
$GraphDefs['multimeter'] = array(
'DEF:multimeter_avg={file}:value:AVERAGE',
'DEF:multimeter_min={file}:value:MIN',
'DEF:multimeter_max={file}:value:MAX',
@@ -1468,7 +1468,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:multimeter_avg:AVERAGE:%4.1lf Average,',
'GPRINT:multimeter_max:MAX:%4.1lf',
'GPRINT:multimeter_avg:LAST:%4.1lf\l');
$GraphDefs['users'] = array(
$GraphDefs['users'] = array(
#'-v', 'Users',
'DEF:users_avg={file}:users:AVERAGE',
'DEF:users_min={file}:users:MIN',
@@ -1481,7 +1481,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:users_avg:AVERAGE:%5.1lf',
'GPRINT:users_max:MAX:%5.1lf',
'GPRINT:users_avg:LAST:%5.1lf\l');
$GraphDefs['voltage'] = array(
$GraphDefs['voltage'] = array(
#'-v', 'Voltage',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -1493,7 +1493,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%sV ',
'GPRINT:max:MAX:%5.1lf%sV',
'GPRINT:avg:LAST:%5.1lf%sV\l');
$GraphDefs['vmpage_action'] = array(
$GraphDefs['vmpage_action'] = array(
#'-v', 'Actions',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -1505,8 +1505,8 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%sV ',
'GPRINT:max:MAX:%5.1lf%sV',
'GPRINT:avg:LAST:%5.1lf%sV\l');
$GraphDefs['vmpage_faults'] = $GraphDefs['ps_pagefaults'];
$GraphDefs['vmpage_io'] = array(
$GraphDefs['vmpage_faults'] = $GraphDefs['ps_pagefaults'];
$GraphDefs['vmpage_io'] = array(
#'-v', 'Bytes/s',
'DEF:out_min={file}:out:MIN',
'DEF:out_avg={file}:out:AVERAGE',
@@ -1535,7 +1535,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:inc_max:MAX:%5.1lf%s',
'GPRINT:inc_avg:LAST:%5.1lf%s Last',
'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
$GraphDefs['vmpage_number'] = array(
$GraphDefs['vmpage_number'] = array(
#'-v', 'Count',
'DEF:avg={file}:value:AVERAGE',
'DEF:min={file}:value:MIN',
@@ -1546,7 +1546,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:avg:AVERAGE:%5.1lf%s ',
'GPRINT:max:MAX:%5.1lf%s',
'GPRINT:avg:LAST:%5.1lf%s\l');
$GraphDefs['vs_threads'] = array(
$GraphDefs['vs_threads'] = array(
"DEF:total_avg={file}:total:AVERAGE",
"DEF:total_min={file}:total:MIN",
"DEF:total_max={file}:total:MAX",
@@ -1579,7 +1579,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:onhold_avg:AVERAGE:%5.1lf Avg.,',
'GPRINT:onhold_max:MAX:%5.1lf',
'GPRINT:onhold_avg:LAST:%5.1lf\l');
$GraphDefs['vs_memory'] = array(
$GraphDefs['vs_memory'] = array(
'DEF:vm_avg={file}:vm:AVERAGE',
'DEF:vm_min={file}:vm:MIN',
'DEF:vm_max={file}:vm:MAX',
@@ -1612,7 +1612,7 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:anon_avg:AVERAGE:%5.1lf%s Avg.,',
'GPRINT:anon_max:MAX:%5.1lf%s Avg.,',
'GPRINT:anon_avg:LAST:%5.1lf%s\l');
$GraphDefs['vs_processes'] = array(
$GraphDefs['vs_processes'] = array(
#'-v', 'Processes',
'DEF:proc_avg={file}:value:AVERAGE',
'DEF:proc_min={file}:value:MIN',
@@ -1624,43 +1624,43 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false)
'GPRINT:proc_avg:AVERAGE:%4.1lf Avg.,',
'GPRINT:proc_max:MAX:%4.1lf',
'GPRINT:proc_avg:LAST:%4.1lf\l');
$GraphDefs['if_multicast'] = $GraphDefs['ipt_packets'];
$GraphDefs['if_tx_errors'] = $GraphDefs['if_rx_errors'];
$GraphDefs['if_multicast'] = $GraphDefs['ipt_packets'];
$GraphDefs['if_tx_errors'] = $GraphDefs['if_rx_errors'];
$MetaGraphDefs['files_count'] = 'meta_graph_files_count';
$MetaGraphDefs['files_size'] = 'meta_graph_files_size';
$MetaGraphDefs['cpu'] = 'meta_graph_cpu';
$MetaGraphDefs['if_rx_errors'] = 'meta_graph_if_rx_errors';
$MetaGraphDefs['if_tx_errors'] = 'meta_graph_if_rx_errors';
$MetaGraphDefs['memory'] = 'meta_graph_memory';
$MetaGraphDefs['vs_memory'] = 'meta_graph_vs_memory';
$MetaGraphDefs['vs_threads'] = 'meta_graph_vs_threads';
$MetaGraphDefs['nfs_procedure'] = 'meta_graph_nfs_procedure';
$MetaGraphDefs['ps_state'] = 'meta_graph_ps_state';
$MetaGraphDefs['swap'] = 'meta_graph_swap';
$MetaGraphDefs['apache_scoreboard'] = 'meta_graph_apache_scoreboard';
$MetaGraphDefs['mysql_commands'] = 'meta_graph_mysql_commands';
$MetaGraphDefs['mysql_handler'] = 'meta_graph_mysql_commands';
$MetaGraphDefs['tcp_connections'] = 'meta_graph_tcp_connections';
$MetaGraphDefs['files_count'] = 'meta_graph_files_count';
$MetaGraphDefs['files_size'] = 'meta_graph_files_size';
$MetaGraphDefs['cpu'] = 'meta_graph_cpu';
$MetaGraphDefs['if_rx_errors'] = 'meta_graph_if_rx_errors';
$MetaGraphDefs['if_tx_errors'] = 'meta_graph_if_rx_errors';
$MetaGraphDefs['memory'] = 'meta_graph_memory';
$MetaGraphDefs['vs_memory'] = 'meta_graph_vs_memory';
$MetaGraphDefs['vs_threads'] = 'meta_graph_vs_threads';
$MetaGraphDefs['nfs_procedure'] = 'meta_graph_nfs_procedure';
$MetaGraphDefs['ps_state'] = 'meta_graph_ps_state';
$MetaGraphDefs['swap'] = 'meta_graph_swap';
$MetaGraphDefs['apache_scoreboard'] = 'meta_graph_apache_scoreboard';
$MetaGraphDefs['mysql_commands'] = 'meta_graph_mysql_commands';
$MetaGraphDefs['mysql_handler'] = 'meta_graph_mysql_commands';
$MetaGraphDefs['tcp_connections'] = 'meta_graph_tcp_connections';
if (function_exists('load_graph_definitions_local')) {
load_graph_definitions_local($logarithmic, $tinylegend);
}
if ($logarithmic) {
foreach ($GraphDefs as &$GraphDef) {
array_unshift($GraphDef, '-o');
if (function_exists('load_graph_definitions_local')) {
load_graph_definitions_local($logarithmic, $tinylegend);
}
}
if ($tinylegend) {
foreach ($GraphDefs as &$GraphDef) {
for ($i = count($GraphDef)-1; $i >=0; $i--) {
if (strncmp('GPRINT:', $GraphDef[$i], 7) == 0) {
unset($GraphDef[$i]);
if ($logarithmic) {
foreach ($GraphDefs as &$GraphDef) {
array_unshift($GraphDef, '-o');
}
}
if ($tinylegend) {
foreach ($GraphDefs as &$GraphDef) {
for ($i = count($GraphDef)-1; $i >=0; $i--) {
if (strncmp('GPRINT:', $GraphDef[$i], 7) == 0) {
unset($GraphDef[$i]);
}
}
}
}
}
}
function meta_graph_files_count($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array())
+1 -2
View File
@@ -345,8 +345,7 @@ function collectd_flush($identifier)
}
fclose($socket);
} //end if
else {
} else {
error_log(sprintf('graph.php: Failed to open unix-socket to collectd: %d: %s', $u_errno, $u_errmsg));
}
return true;
@@ -51,7 +51,7 @@ if (rrdtool_check_rrd_exists($rrd_filename)) {
'filename' => $rrd_filename,
'descr' => 'Caused Rec',
'ds' => 'qcr',
);
);
} else {
d_echo('RRD "'.$rrd_filename.'" not found');
}
@@ -51,7 +51,7 @@ require 'includes/html/graphs/generic_v3_multiline.inc.php';
/*
This would create a graph with reads above and write belows;
I can't find out how to adapt the legend. If you wish to swap graphs,
I can't find out how to adapt the legend. If you wish to swap graphs,
uncomment all the above untill <?php and uncomment below this note
$rrd_filename = rrd_name($device['hostname'], array('app', 'nfs-server-default', $app['app_id']));
@@ -39,8 +39,7 @@ foreach ($rrd_list as $rrd) {
$colours = (isset($rrd['colour']) ? $rrd['colour'] : 'default');
$strlen = ((strlen($rrd['descr']) < $descr_len) ? ($descr_len - strlen($rrd['descr'])) : '0');
$descr = (isset($rrd['descr']) ? rrdtool_escape($rrd['descr'], ($desc_len + $strlen)) : 'Unknown');
for ($z = 0; $z < $strlen;
$z++) {
for ($z = 0; $z < $strlen; $z++) {
$descr .= ' ';
}
@@ -73,8 +72,7 @@ if (!$nototal) {
$strlen = ((strlen($total_text) < $descr_len) ? ($descr_len - strlen($total_text)) : '0');
$descr = (isset($total_text) ? rrdtool_escape($total_text, ($desc_len + $strlen)) : 'Total');
$colour = \LibreNMS\Config::get("graph_colours.$colours.$x");
for ($z = 0; $z < $strlen;
$z++) {
for ($z = 0; $z < $strlen; $z++) {
$descr .= ' ';
}
@@ -18,27 +18,27 @@ if (rrdtool_check_rrd_exists($rrd_filename)) {
'filename' => $rrd_filename,
'descr' => 'Reallocated_Sector_Ct',
'ds' => 'id5',
);
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Reported_Uncorrect',
'ds' => 'id187',
);
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Command_Timeout',
'ds' => 'id188',
);
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Current_Pending_Sector',
'ds' => 'id197',
);
);
$rrd_list[]=array(
'filename' => $rrd_filename,
'descr' => 'Offline_Uncorrectable',
'ds' => 'id198',
);
);
}
@@ -1,6 +1,6 @@
<?php
/*
* LibreNMS module to Graph Cisco IPSLA UDP Jitter metrics
* LibreNMS module to Graph Cisco IPSLA UDP Jitter metrics
*
* Copyright (c) 2016 Aaron Daniels <[email protected]>
*
+2 -2
View File
@@ -13,7 +13,7 @@
*/
if (\Auth::user()->hasGlobalAdmin()) {
?>
?>
<div class="modal fade bs-example-modal-sm" id="schedule-maintenance" tabindex="-1" role="dialog" aria-labelledby="Create" aria-hidden="true">
<div class="modal-dialog">
@@ -392,5 +392,5 @@ $(function () {
$("[name='recurring']").bootstrapSwitch();
</script>
<?php
<?php
}
+1 -1
View File
@@ -75,4 +75,4 @@ if (Auth::user()->hasGlobalAdmin()) {
</script>
<?php
}
?>
?>
@@ -14,7 +14,7 @@
use LibreNMS\Config;
if (Auth::user()->hasGlobalAdmin()) {
?>
?>
<!--Modal for adding or updating an alert transport -->
<div class="modal fade" id="edit-alert-transport" tabindex="-1" role="dialog"
aria-labelledby="Edit-transport" aria-hidden="true">
@@ -39,22 +39,22 @@ if (Auth::user()->hasGlobalAdmin()) {
<label for='transport-choice' class='col-sm-3 col-md-2 control-label'>Transport type: </label>
<div class="col-sm-3">
<select name='transport-choice' id='transport-choice' class='form-control'>
<?php
<?php
// Create list of transport
$transport_dir = Config::get('install_dir').'/LibreNMS/Alert/Transport';
$transports_list = array();
foreach (scandir($transport_dir) as $transport) {
$transport = strstr($transport, '.', true);
if (empty($transport)) {
continue;
$transport_dir = Config::get('install_dir').'/LibreNMS/Alert/Transport';
$transports_list = array();
foreach (scandir($transport_dir) as $transport) {
$transport = strstr($transport, '.', true);
if (empty($transport)) {
continue;
}
$transports_list[] = $transport;
}
$transports_list[] = $transport;
}
foreach ($transports_list as $transport) {
echo '<option value="'.strtolower($transport).'-form">'.$transport.'</option>';
}
?>
foreach ($transports_list as $transport) {
echo '<option value="'.strtolower($transport).'-form">'.$transport.'</option>';
}
?>
</select>
</div>
</div>
@@ -65,80 +65,80 @@ foreach ($transports_list as $transport) {
</div>
</div>
</form>
<?php
<?php
$switches = []; // store names of bootstrap switches
foreach ($transports_list as $transport) {
$class = 'LibreNMS\\Alert\\Transport\\'.$transport;
$switches = []; // store names of bootstrap switches
foreach ($transports_list as $transport) {
$class = 'LibreNMS\\Alert\\Transport\\'.$transport;
if (!method_exists($class, 'configTemplate')) {
// Skip since support has not been added
continue;
}
echo '<form method="post" role="form" id="'.strtolower($transport).'-form" class="form-horizontal transport">';
echo csrf_field();
echo '<input type="hidden" name="transport-type" id="transport-type" value="'.strtolower($transport).'">';
$tmp = call_user_func($class.'::configTemplate');
foreach ($tmp['config'] as $item) {
if ($item['type'] !== 'hidden') {
echo '<div class="form-group" title="' . $item['descr'] . '">';
echo '<label for="' . $item['name'] . '" class="col-sm-3 col-md-2 control-label">' . $item['title'] . ': </label>';
if ($item['type'] == 'text' || $item['type'] == 'password') {
echo '<div class="col-sm-9 col-md-10">';
echo '<input type="' . $item['type'] . '" id="' . $item['name'] . '" name="' . $item['name'] . '" class="form-control" ';
if ($item['required']) {
echo 'required>';
} else {
echo '>';
}
echo '</div>';
} elseif ($item['type'] == 'checkbox') {
echo '<div class="col-sm-2">';
echo '<input type="checkbox" name="' . $item['name'] . '" id="' . $item['name'] . '">';
echo '</div>';
$switches[$item['name']] = $item['default'];
} elseif ($item['type'] == 'select') {
echo '<div class="col-sm-3">';
echo '<select name="' . $item['name'] . '" id="' . $item['name'] . '" class="form-control">';
foreach ($item['options'] as $descr => $opt) {
echo '<option value="' . $opt . '">' . $descr . '</option>';
}
echo '</select>';
echo '</div>';
} elseif ($item['type'] === 'textarea') {
echo '<div class="col-sm-9 col-md-10">';
echo '<textarea name="' . $item['name'] . '" id="' . $item['name'] . '" class="form-control" placeholder="' . $item['descr'] . '">';
echo '</textarea>';
echo '</div>';
} elseif ($item['type'] === 'oauth') {
$class = isset($item['class']) ? $item['class'] : 'btn-success';
$callback = urlencode(url()->current() . '/?oauthtransport=' . $transport);
$url = $item['url'] . $callback;
echo '<a class="btn btn-oauth ' . $class . '"';
echo '" href="' . $url . '" data-base-url="' . $url . '">';
if (isset($item['icon'])) {
echo '<img src="' . asset('images/transports/' . $item['icon']) . '" width="24" height="24"> ';
}
echo $item['descr'];
echo '</a>';
}
echo '</div>';
if (!method_exists($class, 'configTemplate')) {
// Skip since support has not been added
continue;
}
echo '<form method="post" role="form" id="'.strtolower($transport).'-form" class="form-horizontal transport">';
echo csrf_field();
echo '<input type="hidden" name="transport-type" id="transport-type" value="'.strtolower($transport).'">';
$tmp = call_user_func($class.'::configTemplate');
foreach ($tmp['config'] as $item) {
if ($item['type'] !== 'hidden') {
echo '<div class="form-group" title="' . $item['descr'] . '">';
echo '<label for="' . $item['name'] . '" class="col-sm-3 col-md-2 control-label">' . $item['title'] . ': </label>';
if ($item['type'] == 'text' || $item['type'] == 'password') {
echo '<div class="col-sm-9 col-md-10">';
echo '<input type="' . $item['type'] . '" id="' . $item['name'] . '" name="' . $item['name'] . '" class="form-control" ';
if ($item['required']) {
echo 'required>';
} else {
echo '>';
}
echo '</div>';
} elseif ($item['type'] == 'checkbox') {
echo '<div class="col-sm-2">';
echo '<input type="checkbox" name="' . $item['name'] . '" id="' . $item['name'] . '">';
echo '</div>';
$switches[$item['name']] = $item['default'];
} elseif ($item['type'] == 'select') {
echo '<div class="col-sm-3">';
echo '<select name="' . $item['name'] . '" id="' . $item['name'] . '" class="form-control">';
foreach ($item['options'] as $descr => $opt) {
echo '<option value="' . $opt . '">' . $descr . '</option>';
}
echo '</select>';
echo '</div>';
} elseif ($item['type'] === 'textarea') {
echo '<div class="col-sm-9 col-md-10">';
echo '<textarea name="' . $item['name'] . '" id="' . $item['name'] . '" class="form-control" placeholder="' . $item['descr'] . '">';
echo '</textarea>';
echo '</div>';
} elseif ($item['type'] === 'oauth') {
$class = isset($item['class']) ? $item['class'] : 'btn-success';
$callback = urlencode(url()->current() . '/?oauthtransport=' . $transport);
$url = $item['url'] . $callback;
echo '<a class="btn btn-oauth ' . $class . '"';
echo '" href="' . $url . '" data-base-url="' . $url . '">';
if (isset($item['icon'])) {
echo '<img src="' . asset('images/transports/' . $item['icon']) . '" width="24" height="24"> ';
}
echo $item['descr'];
echo '</a>';
}
echo '</div>';
}
}
echo '<div class="form-group">';
echo '<div class="col-sm-12 text-center">';
echo '<button type="button" class="btn btn-success btn-save" name="save-transport">';
echo 'Save Transport';
echo '</button>';
echo '</div>';
echo '</div>';
echo '</form>';
}
echo '<div class="form-group">';
echo '<div class="col-sm-12 text-center">';
echo '<button type="button" class="btn btn-success btn-save" name="save-transport">';
echo 'Save Transport';
echo '</button>';
echo '</div>';
echo '</div>';
echo '</form>';
}
?>
?>
</div>
</div>
</div>
+14 -14
View File
@@ -24,7 +24,7 @@ if (Auth::user()->hasGlobalAdmin()) {
$bill_data['bill_notes'] = $port['port_descr_speed'];
$port_device_id = $port['device_id'];
}
?>
?>
<div class="modal fade bs-example-modal-sm" id="create-bill" tabindex="-1" role="dialog" aria-labelledby="Create" aria-hidden="true">
<div class="modal-dialog">
@@ -49,7 +49,7 @@ if (Auth::user()->hasGlobalAdmin()) {
$selected = $device['device_id'] == $port_device_id ? " selected" : "";
echo "<option value='${device['device_id']}' $selected>" . format_hostname($device) . "</option>\n";
}
?>
?>
</select>
</div>
</div>
@@ -72,17 +72,17 @@ if (Auth::user()->hasGlobalAdmin()) {
</div>
</div>
<?php
if (Config::get('billing.95th_default_agg') == 1) {
$bill_data['dir_95th'] = 'agg';
} else {
$bill_data['dir_95th'] = 'in';
}
$bill_data['bill_type'] = 'cdr';
$quota = array('select_gb' => ' selected');
$cdr = array('select_mbps' => ' selected');
include 'includes/html/pages/bill/addoreditbill.inc.php';
?>
<?php
if (Config::get('billing.95th_default_agg') == 1) {
$bill_data['dir_95th'] = 'agg';
} else {
$bill_data['dir_95th'] = 'in';
}
$bill_data['bill_type'] = 'cdr';
$quota = array('select_gb' => ' selected');
$cdr = array('select_mbps' => ' selected');
include 'includes/html/pages/bill/addoreditbill.inc.php';
?>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-4">
<button type="submit" class="btn btn-primary"><i class="fa fa-check"></i> Add Bill</button>
@@ -95,5 +95,5 @@ include 'includes/html/pages/bill/addoreditbill.inc.php';
</div>
</div>
<?php
<?php
}
+2 -2
View File
@@ -24,7 +24,7 @@ if (Auth::user()->hasGlobalAdmin()) {
}
}
}
?>
?>
<div class="modal fade bs-example-modal-sm" id="create-service" tabindex="-1" role="dialog" aria-labelledby="Create" aria-hidden="true">
<div class="modal-dialog">
@@ -165,5 +165,5 @@ $('#service-submit').click('', function(e) {
});
</script>
<?php
<?php
}
@@ -13,7 +13,7 @@
*/
if (Auth::user()->hasGlobalAdmin()) {
?>
?>
<div class="modal fade bs-example-modal-sm" id="delete-maintenance" tabindex="-1" role="dialog" aria-labelledby="delete" aria-hidden="true">
<div class="modal-dialog">
@@ -63,5 +63,5 @@ $('#sched-maintenance-removal').click('', function(e) {
});
</script>
<?php
<?php
}
+9 -9
View File
@@ -46,7 +46,7 @@ if (!Auth::user()->hasGlobalAdmin()) {
<div class='col-sm-6'>
</div>
</div>";
?>
?>
<div class='form-group'>
<label for='new_password' class='col-sm-2 control-label'>Password</label>
<div class='col-sm-4'>
@@ -56,14 +56,14 @@ if (!Auth::user()->hasGlobalAdmin()) {
</div>
</div>
<?php
if ($_POST['action'] == 'add' && !$_POST['new_password']) {
echo '<span class=red>Please enter a password!</span><br />';
}
<?php
if ($_POST['action'] == 'add' && !$_POST['new_password']) {
echo '<span class=red>Please enter a password!</span><br />';
}
echo "
echo "
<div class='form-group'>";
echo "<label for='new_realname' class='col-sm-2 control-label'>Realname</label>
echo "<label for='new_realname' class='col-sm-2 control-label'>Realname</label>
<div class='col-sm-4'>
<input name='new_realname' class='form-control input-sm'>
</div>
@@ -98,7 +98,7 @@ if (!Auth::user()->hasGlobalAdmin()) {
<div class='col-sm-6'>
</div>
</div>";
echo "<div class='form-group'>
echo "<div class='form-group'>
<div class='col-sm-6'>
</div>
@@ -106,7 +106,7 @@ if (!Auth::user()->hasGlobalAdmin()) {
</div>
</div>";
echo '</form>';
echo '</form>';
} else {
echo '<span class="red">Auth module does not allow user management!</span><br />';
}//end if
+2 -2
View File
@@ -18,7 +18,7 @@ if (Auth::user()->hasGlobalAdmin()) {
include_once 'includes/html/modal/alert_schedule.inc.php';
include_once 'includes/html/modal/remove_alert_schedule.inc.php';
?>
?>
<div class="row">
<div class="col-sm-12">
@@ -96,5 +96,5 @@ var grid = $("#alert-schedule").bootgrid({
</script>
<?php
<?php
}//end if
+22 -22
View File
@@ -21,7 +21,7 @@ if (Auth::user()->hasGlobalAdmin()) {
$_POST['token'] = bin2hex(openssl_random_pseudo_bytes(16));
}
?>
?>
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="Delete" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
@@ -59,12 +59,12 @@ if (Auth::user()->hasGlobalAdmin()) {
<label for="user_id" class="col-sm-2 control-label">User: </label>
<div class="col-sm-4">
<select class="form-control" id="user_id" name="user_id">
<?php
foreach ($userlist = User::all() as $user) {
echo '<option value="' . $user->user_id . '">' . $user->username . ' (' . $user->auth_type . ')</option>';
}
<?php
foreach ($userlist = User::all() as $user) {
echo '<option value="' . $user->user_id . '">' . $user->username . ' (' . $user->auth_type . ')</option>';
}
?>
?>
</select>
</div>
</div>
@@ -108,22 +108,22 @@ foreach ($userlist = User::all() as $user) {
</div>
</div>
</div>
<?php
echo '
<?php
echo '
<div class="row">
<div class="col-md-12">
<span id="thanks"></span>
</div>
</div>
';
if (Session::get('api_token') === true) {
echo "<script>
if (Session::get('api_token') === true) {
echo "<script>
$('#thanks').html('<div class=\"alert alert-info\">The API token has been added.</div>');</script>
";
Session::forget('api_token');
}
Session::forget('api_token');
}
echo '
echo '
<h3>API Access</h3>
<hr>
<div class="row">
@@ -143,13 +143,13 @@ echo '
</tr>
';
foreach (ApiToken::all() as $api) {
$user_details = $userlist->where('user_id', $api->user_id)->first();
foreach (ApiToken::all() as $api) {
$user_details = $userlist->where('user_id', $api->user_id)->first();
$api_disabled = $api->disabled == 1 ? 'checked' : '';
$color = $user_details->auth_type == LegacyAuth::getType() ? '' : 'bgcolor="lightgrey"';
$api_disabled = $api->disabled == 1 ? 'checked' : '';
$color = $user_details->auth_type == LegacyAuth::getType() ? '' : 'bgcolor="lightgrey"';
echo '
echo '
<tr id="'.$api->id.'" ' . $color . '>
<td>'.$user_details->username.'</td>
<td>'.$user_details->auth_type.'</td>
@@ -160,15 +160,15 @@ foreach (ApiToken::all() as $api) {
<td><button type="button" class="btn btn-danger btn-xs" id="'.$api->id.'" data-token_id="'.$api->id.'" data-toggle="modal" data-target="#confirm-delete">Delete</button></td>
</tr>
';
}
}
echo '
echo '
</table>
<center>
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-token">Create API access token</button>
</center>
';
?>
?>
<script>
$("[name='token-status']").bootstrapSwitch('offColor','success');
$('input[name="token-status"]').on('switchChange.bootstrapSwitch', function(event, state) {
@@ -244,7 +244,7 @@ foreach (ApiToken::all() as $api) {
});
</script>
<?php
<?php
} else {
include 'includes/html/error-no-perm.inc.php';
}//end if
+87 -87
View File
@@ -85,11 +85,11 @@ if (bill_permitted($bill_id)) {
echo '</div></div>';
}//end print_port_list
?>
?>
<h2><?php echo "Bill: ${bill_data['bill_name']}"; ?></h2>
<?php
<?php
print_optionbar_start();
echo "<strong>Bill</strong> &raquo; ";
$menu_options = array(
@@ -98,56 +98,56 @@ if (bill_permitted($bill_id)) {
'transfer' => 'Transfer Graphs',
'history' => 'Historical Graphs'
);
if (Auth::user()->hasGlobalAdmin()) {
$menu_options['edit'] = 'Edit';
$menu_options['delete'] = 'Delete';
$menu_options['reset'] = 'Reset';
}
if (Auth::user()->hasGlobalAdmin()) {
$menu_options['edit'] = 'Edit';
$menu_options['delete'] = 'Delete';
$menu_options['reset'] = 'Reset';
}
$sep = '';
foreach ($menu_options as $option => $text) {
echo $sep;
if ($vars['view'] == $option) {
echo "<span class='pagemenu-selected'>";
}
foreach ($menu_options as $option => $text) {
echo $sep;
if ($vars['view'] == $option) {
echo "<span class='pagemenu-selected'>";
}
echo generate_link($text, $vars, array('view' => $option));
if ($vars['view'] == $option) {
echo '</span>';
}
echo generate_link($text, $vars, array('view' => $option));
if ($vars['view'] == $option) {
echo '</span>';
}
$sep = ' | ';
}
$sep = ' | ';
}
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><i class="fa fa-arrow-left fa-lg icon-theme" aria-hidden="true"></i> Back to Bills</a></div>';
print_optionbar_end();
if ($vars['view'] == 'edit' && Auth::user()->hasGlobalAdmin()) {
include 'includes/html/pages/bill/edit.inc.php';
} elseif ($vars['view'] == 'delete' && Auth::user()->hasGlobalAdmin()) {
include 'includes/html/pages/bill/delete.inc.php';
} elseif ($vars['view'] == 'reset' && Auth::user()->hasGlobalAdmin()) {
include 'includes/html/pages/bill/reset.inc.php';
} elseif ($vars['view'] == 'history') {
include 'includes/html/pages/bill/history.inc.php';
} elseif ($vars['view'] == 'transfer') {
include 'includes/html/pages/bill/transfer.inc.php';
} elseif ($vars['view'] == 'quick' || $vars['view'] == 'accurate') {
?>
if ($vars['view'] == 'edit' && Auth::user()->hasGlobalAdmin()) {
include 'includes/html/pages/bill/edit.inc.php';
} elseif ($vars['view'] == 'delete' && Auth::user()->hasGlobalAdmin()) {
include 'includes/html/pages/bill/delete.inc.php';
} elseif ($vars['view'] == 'reset' && Auth::user()->hasGlobalAdmin()) {
include 'includes/html/pages/bill/reset.inc.php';
} elseif ($vars['view'] == 'history') {
include 'includes/html/pages/bill/history.inc.php';
} elseif ($vars['view'] == 'transfer') {
include 'includes/html/pages/bill/transfer.inc.php';
} elseif ($vars['view'] == 'quick' || $vars['view'] == 'accurate') {
?>
<?php if ($bill_data['bill_type'] == 'quota') { ?>
<?php if ($bill_data['bill_type'] == 'quota') { ?>
<h3>Quota Bill</h3>
<?php } elseif ($bill_data['bill_type'] == 'cdr') { ?>
<?php } elseif ($bill_data['bill_type'] == 'cdr') { ?>
<h3>
CDR / 95th Bill
</h3>
<?php } ?>
<?php } ?>
<strong>Billing Period from <?php echo $fromtext ?> to <?php echo $totext ?></strong>
<br /><br />
<div class="row">
<div class="col-lg-6 col-lg-push-6">
<?php print_port_list($ports) ?>
<?php print_port_list($ports) ?>
</div>
<div class="col-lg-6 col-lg-pull-6">
<div class="panel panel-default">
@@ -158,14 +158,14 @@ if ($vars['view'] == 'edit' && Auth::user()->hasGlobalAdmin()) {
</div>
<table class="table">
<tr>
<?php if ($bill_data['bill_type'] == 'quota') {
<?php if ($bill_data['bill_type'] == 'quota') {
// The Customer is billed based on a pre-paid quota with overage in xB
$percent = round((($total_data) / $bill_data['bill_quota'] * 100), 2);
$unit = 'MB';
$total_data = round($total_data, 2);
$background = get_percentage_colours($percent);
$type = '&amp;ave=yes';
?>
?>
<td>
<?php echo format_bytes_billing($total_data) ?> of <?php echo format_bytes_billing($bill_data['bill_quota']).' ('.$percent.'%)' ?>
- Average rate <?php echo formatRates($rate_average) ?>
@@ -174,12 +174,12 @@ if ($vars['view'] == 'edit' && Auth::user()->hasGlobalAdmin()) {
</tr>
<tr>
<td colspan="2">
<?php
<?php
echo 'Predicted usage: ' . format_bytes_billing(getPredictedUsage($bill_data['bill_day'], $bill_data['total_data']));
?>
?>
</td>
<?php
} elseif ($bill_data['bill_type'] == 'cdr') {
<?php
} elseif ($bill_data['bill_type'] == 'cdr') {
// The customer is billed based on a CDR with 95th%ile overage
$unit = 'kbps';
$cdr = $bill_data['bill_cdr'];
@@ -187,7 +187,7 @@ if ($vars['view'] == 'edit' && Auth::user()->hasGlobalAdmin()) {
$percent = round((($rate_95th) / $cdr * 100), 2);
$background = get_percentage_colours($percent);
$type = '&amp;95th=yes';
?>
?>
<td>
<?php echo format_si($rate_95th).'bps' ?> of <?php echo format_si($cdr).'bps ('.$percent.'%)' ?> (95th%ile)
</td>
@@ -197,86 +197,86 @@ if ($vars['view'] == 'edit' && Auth::user()->hasGlobalAdmin()) {
</tr>
<tr>
<td colspan="2">
<?php
echo 'Predicted usage: ' . format_si(getPredictedUsage($bill_data['bill_day'], $bill_data['rate_95th'])).'bps';
?>
<?php
echo 'Predicted usage: ' . format_si(getPredictedUsage($bill_data['bill_day'], $bill_data['rate_95th'])).'bps';
?>
</td>
<?php }//end if
?>
<?php }//end if
?>
</tr>
</table>
</div>
</div>
</div>
<?php
<?php
$lastmonth = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))');
$yesterday = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))');
$rightnow = date('U');
$lastmonth = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))');
$yesterday = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))');
$rightnow = date('U');
if ($vars['view'] == 'accurate') {
$bi = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
$bi .= '&amp;from='.$unixfrom.'&amp;to='.$unixto;
$bi .= '&amp;x=1190&amp;y=250';
$bi .= "$type'>";
if ($vars['view'] == 'accurate') {
$bi = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
$bi .= '&amp;from='.$unixfrom.'&amp;to='.$unixto;
$bi .= '&amp;x=1190&amp;y=250';
$bi .= "$type'>";
$li = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
$li .= '&amp;from='.$unix_prev_from.'&amp;to='.$unix_prev_to;
$li .= '&amp;x=1190&amp;y=250';
$li .= "$type'>";
$li = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
$li .= '&amp;from='.$unix_prev_from.'&amp;to='.$unix_prev_to;
$li .= '&amp;x=1190&amp;y=250';
$li .= "$type'>";
$di = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
$di .= '&amp;from=' . \LibreNMS\Config::get('time.day') . '&amp;to=' . \LibreNMS\Config::get('time.now');
$di .= '&amp;x=1190&amp;y=250';
$di .= "$type'>";
$di = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
$di .= '&amp;from=' . \LibreNMS\Config::get('time.day') . '&amp;to=' . \LibreNMS\Config::get('time.now');
$di .= '&amp;x=1190&amp;y=250';
$di .= "$type'>";
$mi = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
$mi .= '&amp;from='.$lastmonth.'&amp;to='.$rightnow;
$mi .= '&amp;x=1190&amp;y=250';
$mi .= "$type'>";
} else {
$bi = "<img src='graph.php?type=bill_bits&amp;id=".$bill_id;
$bi .= '&amp;from='.$unixfrom.'&amp;to='.$unixto;
$bi .= "&amp;width=1000&amp;height=200&amp;total=1&amp;dir=".$dir_95th."'>";
$mi = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
$mi .= '&amp;from='.$lastmonth.'&amp;to='.$rightnow;
$mi .= '&amp;x=1190&amp;y=250';
$mi .= "$type'>";
} else {
$bi = "<img src='graph.php?type=bill_bits&amp;id=".$bill_id;
$bi .= '&amp;from='.$unixfrom.'&amp;to='.$unixto;
$bi .= "&amp;width=1000&amp;height=200&amp;total=1&amp;dir=".$dir_95th."'>";
$li = "<img src='graph.php?type=bill_bits&amp;id=".$bill_id;
$li .= '&amp;from='.$unix_prev_from.'&amp;to='.$unix_prev_to;
$li .= "&amp;width=1000&amp;height=200&amp;total=1&amp;dir=".$dir_95th."'>";
$li = "<img src='graph.php?type=bill_bits&amp;id=".$bill_id;
$li .= '&amp;from='.$unix_prev_from.'&amp;to='.$unix_prev_to;
$li .= "&amp;width=1000&amp;height=200&amp;total=1&amp;dir=".$dir_95th."'>";
$di = "<img src='graph.php?type=bill_bits&amp;id=".$bill_id;
$di .= '&amp;from=' . \LibreNMS\Config::get('time.day') . '&amp;to=' . \LibreNMS\Config::get('time.now');
$di .= "&amp;width=1000&amp;height=200&amp;total=1&amp;dir=".$dir_95th."'>";
$di = "<img src='graph.php?type=bill_bits&amp;id=".$bill_id;
$di .= '&amp;from=' . \LibreNMS\Config::get('time.day') . '&amp;to=' . \LibreNMS\Config::get('time.now');
$di .= "&amp;width=1000&amp;height=200&amp;total=1&amp;dir=".$dir_95th."'>";
$mi = "<img src='graph.php?type=bill_bits&amp;id=".$bill_id;
$mi .= '&amp;from='.$lastmonth.'&amp;to='.$rightnow;
$mi .= "&amp;width=1000&amp;height=200&amp;total=1&amp;dir=".$dir_95th."'>";
}//end if
$mi = "<img src='graph.php?type=bill_bits&amp;id=".$bill_id;
$mi .= '&amp;from='.$lastmonth.'&amp;to='.$rightnow;
$mi .= "&amp;width=1000&amp;height=200&amp;total=1&amp;dir=".$dir_95th."'>";
}//end if
?>
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Billing View</h3>
</div>
<?php echo $bi ?>
<?php echo $bi ?>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">24 Hour View</h3>
</div>
<?php echo $di ?>
<?php echo $di ?>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Monthly View</h3>
</div>
<?php echo $mi ?>
<?php echo $mi ?>
</div>
<?php
} //end if
<?php
} //end if
} else {
include 'includes/html/error-no-perm.inc.php';
}//end if
+11 -11
View File
@@ -60,7 +60,7 @@ if ($bill_data['bill_type'] == 'cdr') {
);
}
}//end if
?>
?>
<div class="row">
<div class="col-lg-6 col-md-12">
<div class="panel panel-default">
@@ -104,14 +104,14 @@ if ($bill_data['bill_type'] == 'cdr') {
);
if (is_array($ports)) {
?>
?>
<div class="list-group">
<?php foreach ($ports as $port) {
$port = cleanPort($port);
<?php foreach ($ports as $port) {
$port = cleanPort($port);
$emptyCheck = true;
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
?>
?>
<div class="list-group-item">
<form action="" class="form-inline" method="post" name="delete<?php echo $port['port_id'] ?>" style="display: none;">
<?php echo csrf_field() ?>
@@ -127,16 +127,16 @@ if ($bill_data['bill_type'] == 'cdr') {
<i class="fa fa-random"></i>
<?php echo generate_port_link($port, $port['ifName'] . '' . $portalias); ?>
</div>
<?php }
if (!$emptyCheck) { ?>
<?php }
if (!$emptyCheck) { ?>
<div class="alert alert-info">There are no ports assigned to this bill</alert>
<?php } ?>
<?php } ?>
</div>
<?php
<?php
}
?>
?>
</div>
<h4>Add Port</h4>
@@ -157,7 +157,7 @@ if (!$emptyCheck) { ?>
echo "<option value='${device['device_id']}'>${device['hostname']}</option>\n";
}
?>
?>
</select>
</div>
</div>
+2 -2
View File
@@ -187,11 +187,11 @@ include 'includes/html/modal/new_bill.inc.php';
<?php
if ($vars['view'] == 'add') {
?>
?>
$(function() {
$('#create-bill').modal('show');
});
<?php
<?php
}
?>
</script>
+5 -5
View File
@@ -20,13 +20,13 @@ if (Auth::user()->isDemo()) {
} else {
$device = device_by_id_cache($_REQUEST['id']);
print_error("Are you sure you want to delete device " . $device['hostname'] . "?");
?>
?>
<br />
<center>
<font color="red"></font><i class="fa fa-exclamation-triangle fa-3x"></i></font>
<br>
<form name="form1" method="post" action="" class="form-horizontal" role="form">
<?php echo csrf_field() ?>
<?php echo csrf_field() ?>
<div class="form-group">
<input type="hidden" name="id" value="<?php echo $_REQUEST['id'] ?>" />
<input type="hidden" name="confirm" value="1" />
@@ -35,13 +35,13 @@ if (Auth::user()->isDemo()) {
</div>
</form>
</center>
<?php
<?php
}
echo('
</div>
</div>');
} else {
?>
?>
<form name="form1" method="post" action="" class="form-horizontal" role="form">
<?php echo csrf_field() ?>
@@ -79,6 +79,6 @@ if (Auth::user()->isDemo()) {
<td><input type="checkbox" name="remove_rrd" value="yes"></td>
</tr>-->
</form>
<?php
<?php
}
}
+2 -2
View File
@@ -38,14 +38,14 @@ foreach ($components as $peer) {
$status = 'Ok';
$error = '';
}
?>
?>
<tr <?php echo $error; ?>>
<td><?php echo $string; ?></td>
<td><?php echo $peer['stratum']; ?></td>
<td><?php echo $peer['peerref']; ?></td>
<td><?php echo $status; ?></td>
</tr>
<?php
<?php
}
?>
</table>
+11 -11
View File
@@ -105,9 +105,9 @@ $disable_notify = get_dev_attrib($device, 'disable_notify');
<div class="col-md-1 col-md-offset-2">
<?php
if (\LibreNMS\Config::get('enable_clear_discovery') == 1 && !$device['snmp_disable']) {
?>
?>
<button type="submit" id="rediscover" data-device_id="<?php echo($device['device_id']); ?>" class="btn btn-primary" name="rediscover"><i class="fa fa-retweet"></i> Rediscover device</button>
<?php
<?php
}
?>
</div>
@@ -235,24 +235,24 @@ $disable_notify = get_dev_attrib($device, 'disable_notify');
</div>
<?php
if (\LibreNMS\Config::get('distributed_poller') === true) {
?>
?>
<div class="form-group">
<label for="poller_group" class="col-sm-2 control-label">Poller Group</label>
<div class="col-sm-6">
<select name="poller_group" id="poller_group" class="form-control input-sm">
<option value="0">General<?=\LibreNMS\Config::get('distributed_poller_group') == 0 ? ' (default Poller)': ''?></option>
<?php
foreach (dbFetchRows('SELECT `id`,`group_name` FROM `poller_groups` ORDER BY `group_name`') as $group) {
echo ('<option value="'.$group['id'].'"'.
<?php
foreach (dbFetchRows('SELECT `id`,`group_name` FROM `poller_groups` ORDER BY `group_name`') as $group) {
echo ('<option value="'.$group['id'].'"'.
($device_model->poller_group == $group['id'] ? " selected": "").'>'.$group['group_name']);
echo (\LibreNMS\Config::get('distributed_poller_group') == $group['id'] ? ' (default Poller)': '');
echo ('</option>');
}
?>
echo (\LibreNMS\Config::get('distributed_poller_group') == $group['id'] ? ' (default Poller)': '');
echo ('</option>');
}
?>
</select>
</div>
</div>
<?php
<?php
}//endif
?>
<div class="form-group">
@@ -59,5 +59,5 @@ if ($components[$vars['gtmpoolid']]['type'] == 'f5-gtm-pool') {
</div>
</div>
</div>
<?php
<?php
}
@@ -78,5 +78,5 @@ if ($components[$vars['wideid']]['type'] == 'f5-gtm-wide') {
</div>
</div>
</div>
<?php
<?php
}
@@ -212,5 +212,5 @@ if ($components[$vars['poolid']]['type'] == 'f5-ltm-pool') {
</div>
</div>
</div>
<?php
<?php
}
@@ -78,5 +78,5 @@ if ($components[$vars['vsid']]['type'] == 'f5-ltm-vs') {
</div>
</div>
</div>
<?php
<?php
}
@@ -204,5 +204,5 @@ if ($components[$vars['poolid']]['type'] == 'f5-ltm-pool') {
</div>
</div>
</div>
<?php
<?php
}
+2 -2
View File
@@ -17,7 +17,7 @@ if (!isset($vars['section'])) {
$vars['section'] = "mib";
}
if (is_mib_poller_enabled($device)) {
?>
?>
<h4><i class="fa fa-file-text-o"></i> Device MIB associations</h4>
<div class="table-responsive">
@@ -87,7 +87,7 @@ if (is_mib_poller_enabled($device)) {
}
});
</script>
<?php
<?php
} else {
print_mib_poller_disabled();
}
@@ -31,11 +31,11 @@ if (count($components) > 0) {
<?php
// Display an additional row to show the error
if ($array['status'] == 2) {
?>
?>
<tr class="<?php echo $class ?>">
<td>Error: <?php echo nl2br($array['error'])?></td>
</tr>
<?php
<?php
}
}
?>
@@ -38,5 +38,5 @@ if (ObjectCache::serviceCounts(['total'], $device['device_id'])['total'] > 0) {
</div>
</div>
</div>
<?php
<?php
}
@@ -31,7 +31,7 @@ $data = get_dev_attrib($device, $port_id_notes);
echo '
<button type="submit" name="btn-update-notes" id="btn-update-notes" class="btn btn-primary">Submit</button>
';
?>
?>
</div>
</div>
</form>
+19 -19
View File
@@ -123,7 +123,7 @@ if ($vars['view'] == 'minigraphs') {
if ($vars['view'] == 'details') {
$port_details = 1;
}
?>
?>
<div style='margin: 0px;'><table class='table'>
<tr>
<th width="350"><A href="<?php echo generate_url($vars, array('sort' => "port")); ?>">Port</a></th>
@@ -134,7 +134,7 @@ if ($vars['view'] == 'minigraphs') {
<th width="100">Mac Address</th>
<th width="375"></th>
</tr>
<?php
<?php
$i = '1';
@@ -144,25 +144,25 @@ if ($vars['view'] == 'minigraphs') {
// As we've dragged the whole database, lets pre-populate our caches :)
// FIXME - we should probably split the fetching of link/stack/etc into functions and cache them here too to cut down on single row queries.
foreach ($ports as $key => $port) {
$port_cache[$port['port_id']] = $port;
$port_index_cache[$port['device_id']][$port['ifIndex']] = $port;
$ports[$key]["ifOctets_rate"] = $port["ifInOctets_rate"] + $port["ifOutOctets_rate"];
}
foreach ($ports as $key => $port) {
$port_cache[$port['port_id']] = $port;
$port_index_cache[$port['device_id']][$port['ifIndex']] = $port;
$ports[$key]["ifOctets_rate"] = $port["ifInOctets_rate"] + $port["ifOutOctets_rate"];
}
switch ($vars["sort"]) {
case 'traffic':
$ports = array_sort_by_column($ports, 'ifOctets_rate', SORT_DESC);
break;
default:
$ports = array_sort_by_column($ports, 'ifIndex', SORT_ASC);
break;
}
switch ($vars["sort"]) {
case 'traffic':
$ports = array_sort_by_column($ports, 'ifOctets_rate', SORT_DESC);
break;
default:
$ports = array_sort_by_column($ports, 'ifIndex', SORT_ASC);
break;
}
foreach ($ports as $port) {
include 'includes/html/print-interface.inc.php';
$i++;
}
foreach ($ports as $port) {
include 'includes/html/print-interface.inc.php';
$i++;
}
echo '</table></div>';
}//end if
@@ -24,27 +24,27 @@ foreach ($components as $oid => $overlay) {
$overlay_status = "<span class='pull-right'>".$overlay['error']." - <span class='red'>Alert</span></span>";
$gli = "list-group-item-danger";
}
?>
?>
<a class="list-group-item <?php echo $gli?>" data-toggle="collapse" data-target="#<?php echo $overlay['index']?>" data-parent="#overlays"><?php echo $overlay['label']?> - <?php echo $overlay['transport']?> <?php echo $overlay_status?></a>
<div id="<?php echo $overlay['index']?>" class="sublinks collapse">
<?php
foreach ($components as $aid => $adjacency) {
if (($adjacency['otvtype'] == 'adjacency') && ($adjacency['index'] == $overlay['index'])) {
if ($adjacency['status'] == 0) {
$adj_status = "<span class='green pull-right'>Normal</span>";
$gli = "";
} else {
$adj_status = "<span class='pull-right'>".$adjacency['error']." - <span class='red'>Alert</span></span>";
$gli = "list-group-item-danger";
}
?>
<?php
foreach ($components as $aid => $adjacency) {
if (($adjacency['otvtype'] == 'adjacency') && ($adjacency['index'] == $overlay['index'])) {
if ($adjacency['status'] == 0) {
$adj_status = "<span class='green pull-right'>Normal</span>";
$gli = "";
} else {
$adj_status = "<span class='pull-right'>".$adjacency['error']." - <span class='red'>Alert</span></span>";
$gli = "list-group-item-danger";
}
?>
<a class="list-group-item <?php echo $gli?> small"><i class="fa fa-chevron-right" aria-hidden="true"></i> <?php echo $adjacency['label']?> - <?php echo $adjacency['endpoint']?> <?php echo $adj_status?></a>
<?php
}
}
?>
<?php
}
}
?>
</div>
<?php
<?php
}
}
?>
@@ -85,6 +85,6 @@ $graph_array['to'] = \LibreNMS\Config::get('time.now');
$graph_array['type'] = 'device_cisco-otv-mac';
require 'includes/html/print-graphrow.inc.php';
?>
?>
</div>
</div>
@@ -11,7 +11,7 @@
$graph_array['type'] = 'device_sla_jitter-latency';
$graph_array['id'] = $vars['id'];
require 'includes/html/print-graphrow.inc.php';
?>
?>
</div>
<div class="panel-heading">
+1 -1
View File
@@ -11,5 +11,5 @@
$graph_array['type'] = 'device_sla';
$graph_array['id'] = $vars['id'];
require 'includes/html/print-graphrow.inc.php';
?>
?>
</div>
+2 -2
View File
@@ -371,7 +371,7 @@ if ($format == "graph") {
<?php
if (!isset($vars['searchbar']) && $vars['searchbar'] != "hide") {
?>
?>
$(".devices-headers-table-menu").append(
"<div class='pull-left'>" +
"<form method='post' action='' class='form-inline devices-search-header' role='form'>" +
@@ -392,7 +392,7 @@ if ($format == "graph") {
"</form>" +
"</div>"
);
<?php
<?php
}
?>
+7 -7
View File
@@ -42,19 +42,19 @@ $pagetitle[] = 'Eventlog';
'<?php echo csrf_field() ?>' +
<?php
if (!isset($vars['fromdevice'])) {
?>
?>
'<div class="form-group">' +
'<label><strong>Device&nbsp;&nbsp;</strong></label>' +
'<select name="device" id="device" class="form-control">' +
'<option value="">All Devices</option>' +
<?php
if ($device instanceof Device) {
echo "'<option value=$device->device_id>" . $device->displayName() . "</option>' +";
}
?>
<?php
if ($device instanceof Device) {
echo "'<option value=$device->device_id>" . $device->displayName() . "</option>' +";
}
?>
'</select>' +
'</div>&nbsp;&nbsp;&nbsp;&nbsp;' +
<?php
<?php
} else {
echo "'&nbsp;&nbsp;<input type=\"hidden\" name=\"device\" id=\"device\" value=\"" . $vars['device'] . "\">' + ";
}
+1 -1
View File
@@ -76,7 +76,7 @@ foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $data) {
if ($_POST['device_string']) {
echo $_POST['device_string'];
};
?>
?>
"\" placeholder=\"Description\" class=\"form-control input-sm\"/>"+
"</div>"+
"<button type=\"submit\" class=\"btn btn-default input-sm\">Search</button>"+
+2 -2
View File
@@ -14,7 +14,7 @@
*/
if (\LibreNMS\Config::get("poller_modules.mib")) {
?>
?>
<h4>MIB associations for all devices</h4>
<div class="table-responsive">
@@ -48,7 +48,7 @@ if (\LibreNMS\Config::get("poller_modules.mib")) {
}
});
</script>
<?php
<?php
} else {
print_mib_poller_disabled();
}
+2 -2
View File
@@ -14,7 +14,7 @@
*/
if (\LibreNMS\Config::get("poller_modules.mib")) {
?>
?>
<h4><i class="fa fa-file-text-o"></i> All MIB definitions</h4>
<div class="table-responsive">
@@ -54,7 +54,7 @@ if (\LibreNMS\Config::get("poller_modules.mib")) {
}
});
</script>
<?php
<?php
} else {
print_mib_poller_disabled();
}
+55 -55
View File
@@ -76,27 +76,27 @@ if ($notifications['count'] > 0 && !isset($vars['archive'])) {
</div>
<?php if (!isset($vars['archive'])) { ?>
<div class="container">
<?php
foreach ($notifications['sticky'] as $notif) {
if (is_numeric($notif['source'])) {
$notif['source'] = dbFetchCell('select username from users where user_id =?', array($notif['source']));
}
echo '<div class="well"><div class="row"> <div class="col-md-12">';
<?php
foreach ($notifications['sticky'] as $notif) {
if (is_numeric($notif['source'])) {
$notif['source'] = dbFetchCell('select username from users where user_id =?', array($notif['source']));
}
echo '<div class="well"><div class="row"> <div class="col-md-12">';
$class = $notif['severity'] == 2 ? 'text-danger' : 'text-warning';
echo "<h4 class='$class' id='${notif['notifications_id']}'>";
echo "<strong><i class='fa fa-bell-o'></i>&nbsp;${notif['title']}</strong>";
echo "<span class='pull-right'>";
$class = $notif['severity'] == 2 ? 'text-danger' : 'text-warning';
echo "<h4 class='$class' id='${notif['notifications_id']}'>";
echo "<strong><i class='fa fa-bell-o'></i>&nbsp;${notif['title']}</strong>";
echo "<span class='pull-right'>";
if ($notif['user_id'] != Auth::id()) {
$sticky_user = User::find($notif['user_id']);
echo "<code>Sticky by {$sticky_user->username}</code>";
} else {
echo '<button class="btn btn-primary fa fa-bell-slash-o unstick-notif" data-toggle="tooltip" data-placement="bottom" title="Remove Sticky" style="margin-top:-10px;"></button>';
}
if ($notif['user_id'] != Auth::id()) {
$sticky_user = User::find($notif['user_id']);
echo "<code>Sticky by {$sticky_user->username}</code>";
} else {
echo '<button class="btn btn-primary fa fa-bell-slash-o unstick-notif" data-toggle="tooltip" data-placement="bottom" title="Remove Sticky" style="margin-top:-10px;"></button>';
}
echo '</span></h4>';
?>
echo '</span></h4>';
?>
</div>
</div>
<div class="row">
@@ -108,30 +108,30 @@ foreach ($notifications['sticky'] as $notif) {
</div>
</div>
</div>
<?php } ?>
<?php if ($notifications['sticky_count'] != 0) { ?>
<?php } ?>
<?php if ($notifications['sticky_count'] != 0) { ?>
<hr/>
<?php } ?>
<?php
foreach ($notifications['unread'] as $notif) {
if (is_numeric($notif['source'])) {
$source_user = User::find($notif['source']);
$notif['source'] = $source_user->username;
}
echo '<div class="well"><div class="row"> <div class="col-md-12">';
d_echo($notif);
$class = 'text-success';
if ($notif['severity'] == 1) {
$class='text-warning';
} elseif ($notif['severity'] == 2) {
$class = 'text-danger';
}
echo "<h4 class='$class' id='${notif['notifications_id']}'>${notif['title']}<span class='pull-right'>";
<?php } ?>
<?php
foreach ($notifications['unread'] as $notif) {
if (is_numeric($notif['source'])) {
$source_user = User::find($notif['source']);
$notif['source'] = $source_user->username;
}
echo '<div class="well"><div class="row"> <div class="col-md-12">';
d_echo($notif);
$class = 'text-success';
if ($notif['severity'] == 1) {
$class='text-warning';
} elseif ($notif['severity'] == 2) {
$class = 'text-danger';
}
echo "<h4 class='$class' id='${notif['notifications_id']}'>${notif['title']}<span class='pull-right'>";
if (Auth::user()->hasGlobalAdmin()) {
echo '<button class="btn btn-primary fa fa-bell-o stick-notif" data-toggle="tooltip" data-placement="bottom" title="Mark as Sticky" style="margin-top:-10px;"></button>';
}
?>
if (Auth::user()->hasGlobalAdmin()) {
echo '<button class="btn btn-primary fa fa-bell-o stick-notif" data-toggle="tooltip" data-placement="bottom" title="Mark as Sticky" style="margin-top:-10px;"></button>';
}
?>
<button class="btn btn-primary fa fa-eye read-notif" data-toggle="tooltip" data-placement="bottom" title="Mark as Read" style="margin-top:-10px;"></button>
</span>
@@ -147,7 +147,7 @@ foreach ($notifications['unread'] as $notif) {
</div>
</div>
</div>
<?php } ?>
<?php } ?>
<div class="row">
<div class="col-md-12">
<h3><a class="btn btn-default" href="notifications/archive/">Show Archive</a></h3>
@@ -161,20 +161,20 @@ foreach ($notifications['unread'] as $notif) {
<h2>Archive</h2>
</div>
</div>
<?php
foreach ($notifications['read'] as $notif) {
echo '<div class="well"><div class="row"> <div class="col-md-12"><h4';
if ($notif['severity'] == 1) {
echo ' class="text-warning"';
} elseif ($notif['severity'] == 2) {
echo ' class="text-danger"';
}
echo " id='${notif['notifications_id']}'>${notif['title']}";
<?php
foreach ($notifications['read'] as $notif) {
echo '<div class="well"><div class="row"> <div class="col-md-12"><h4';
if ($notif['severity'] == 1) {
echo ' class="text-warning"';
} elseif ($notif['severity'] == 2) {
echo ' class="text-danger"';
}
echo " id='${notif['notifications_id']}'>${notif['title']}";
if (Auth::user()->isAdmin()) {
echo '<span class="pull-right"><button class="btn btn-primary fa fa-bell-o stick-notif" data-toggle="tooltip" data-placement="bottom" title="Mark as Sticky" style="margin-top:-10px;"></button></span>';
}
?>
if (Auth::user()->isAdmin()) {
echo '<span class="pull-right"><button class="btn btn-primary fa fa-bell-o stick-notif" data-toggle="tooltip" data-placement="bottom" title="Mark as Sticky" style="margin-top:-10px;"></button></span>';
}
?>
</h4>
</div>
</div>
@@ -187,7 +187,7 @@ foreach ($notifications['read'] as $notif) {
</div>
</div>
</div>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<script>
+24 -24
View File
@@ -33,47 +33,47 @@ $.ajax({
}
}//end if
?>
?>
<div class="panel panel-default panel-condensed">
<div class="panel-heading">
<strong>System plugins</strong>
</div>
<?php
if ($new_plugins > 0) {
echo '<div class="panel-body">
<?php
if ($new_plugins > 0) {
echo '<div class="panel-body">
<div class="alert alert-warning">
We have found '.$new_plugins.' new plugins that need to be configured and enabled
</div>
</div>';
}
if ($removed_plugins > 0) {
echo '<div class="panel-body">
}
if ($removed_plugins > 0) {
echo '<div class="panel-body">
<div class="alert alert-warning">
We have found '.$removed_plugins.' removed plugins
</div>
</div>';
}
?>
}
?>
<table class="table table-condensed">
<tr>
<th>Name</th>
<th>Action</th>
</tr>
<?php
foreach (dbFetchRows('SELECT * FROM plugins') as $plugins) {
if ($plugins['plugin_active'] == 1) {
$plugin_colour = 'bg-success';
$plugin_button = 'danger';
$plugin_label = 'Disable';
} else {
$plugin_colour = 'bg-danger';
$plugin_button = 'success';
$plugin_label = 'Enable';
}
<?php
foreach (dbFetchRows('SELECT * FROM plugins') as $plugins) {
if ($plugins['plugin_active'] == 1) {
$plugin_colour = 'bg-success';
$plugin_button = 'danger';
$plugin_label = 'Disable';
} else {
$plugin_colour = 'bg-danger';
$plugin_button = 'success';
$plugin_label = 'Enable';
}
echo '<tr class="'.$plugin_colour.'">
echo '<tr class="'.$plugin_colour.'">
<td>
'.$plugins['plugin_name'].'
</td>
@@ -86,12 +86,12 @@ foreach (dbFetchRows('SELECT * FROM plugins') as $plugins) {
</form>
</td>
</tr>';
}//end foreach
?>
}//end foreach
?>
</table>
</div>
<?php
<?php
} else {
include 'includes/html/error-no-perm.inc.php';
}//end if
@@ -8,7 +8,7 @@ $COMPONENTS = $COMPONENT->getComponents(null, $options);
foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
$LINK = generate_url(array('page' => 'device', 'device' => $DEVICE_ID, 'tab' => 'routing', 'proto' => 'cisco-otv'));
?>
?>
<div class="panel panel-default" id="overlays-<?php echo $DEVICE_ID?>">
<div class="panel-heading">
<h3 class="panel-title"><a href="<?php echo $LINK?>"><?php echo gethostbyid($DEVICE_ID)?> - Overlay's & Adjacencies</a></h3>
@@ -40,16 +40,16 @@ foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
}
?>
<a class="list-group-item <?php echo $GLI?> small"><i class="fa fa-chevron-right" aria-hidden="true"></i> <?php echo $ADJACENCY['label']?> - <?php echo $ADJACENCY['endpoint']?> <?php echo $ADJ_STATUS?></a>
<?php
<?php
}
}
?>
</div>
<?php
<?php
}
}
?>
</div>
</div>
<?php
<?php
}
+3 -3
View File
@@ -155,14 +155,14 @@ foreach ($ordered as $name => $entry) {
}
}
if (sizeof($arch) > 0 && sizeof($vers) > 0) {
?>
?>
<tr>
<td><a href="<?php echo(generate_url(array('page'=>'packages','name'=>$name))); ?>"><?php echo $name; ?></a></td>
<td><?php echo implode('<br/>', $vers); ?></td>
<td><?php echo implode('<br/>', $arch); ?></td>
<td><?php echo implode('<br/>', $devs); ?></td>
</tr>
<?php
<?php
}
}
if ((int) ($count / $results) > 0 && $count != $results) {
@@ -170,7 +170,7 @@ if ((int) ($count / $results) > 0 && $count != $results) {
<tr>
<td colspan="6" align="center"><?php echo generate_pagination($count, $results, $page_number); ?></td>
</tr>
<?php
<?php
}
?>
+7 -7
View File
@@ -45,16 +45,16 @@ $pagetitle[] = 'Syslog';
'<div class="form-group">' +
<?php
if (!isset($vars['fromdevice'])) {
?>
?>
'<select name="device" id="device" class="form-control">' +
'<option value="">All Devices&nbsp;&nbsp;</option>' +
<?php
if ($device_id) {
echo "'<option value=$device_id>" . format_hostname(device_by_id_cache($device_id)) . "</option>' +";
}
?>
<?php
if ($device_id) {
echo "'<option value=$device_id>" . format_hostname(device_by_id_cache($device_id)) . "</option>' +";
}
?>
'</select>' +
<?php
<?php
} else {
echo "'&nbsp;&nbsp;<input type=\"hidden\" name=\"device\" id=\"device\" value=\"" . $device_id . "\">' + ";
}
+2 -2
View File
@@ -72,7 +72,7 @@ $query = "SELECT DATE_FORMAT(time_logged, '" . \LibreNMS\Config::get('alert_grap
}
$graph_data = _json_encode($data);
?>
?>
var groups = new vis.DataSet();
<?php
@@ -103,7 +103,7 @@ foreach ($groups as $group) {
$last_date = end($data);
$milisec_diff = abs(strtotime($first_date["x"]) - strtotime($last_date["x"])) * 1000;
echo $milisec_diff;
?>,
?>,
orientation:'top'
};
var graph2d = new vis.Graph2d(container, items, groups, options);
+12 -12
View File
@@ -338,19 +338,19 @@ $edges = json_encode($links);
array_multisort(array_column($devices_by_id, 'label'), SORT_ASC, $devices_by_id);
if (count($devices_by_id) > 1 && count($links) > 0) {
?>
?>
<form name="printmapform" method="get" action="" class="form-horizontal" role="form">
<?php if (empty($device['hostname'])) { ?>
<?php if (empty($device['hostname'])) { ?>
<div class="pull-right">
<select name="highlight_node" id="highlight_node" class="input-sm" onChange="highlightNode()";>
<option value="0">None</option>
<?php foreach ($devices_by_id as $dev) { ?>
<?php foreach ($devices_by_id as $dev) { ?>
<option value="<?=$dev['id']?>"><?=$dev['label']?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<?php } ?>
<?php } ?>
<div id="visualization"></div>
</form>
<script src="js/vis.min.js"></script>
@@ -359,16 +359,16 @@ var height = $(window).height() - 100;
$('#visualization').height(height + 'px');
// create an array with nodes
var nodes =
<?php
echo $nodes;
?>
<?php
echo $nodes;
?>
;
// create an array with edges
var edges =
<?php
echo $edges;
?>
<?php
echo $edges;
?>
;
// create a network
@@ -394,7 +394,7 @@ function highlightNode(e) {
$('#highlight_node option[value="<?=$highlight_node?>"]').prop('selected', true);
</script>
<?php
<?php
} else {
print_message("No map to display, this may be because you aren't running autodiscovery or no devices are linked by mac address.");
}
@@ -254,7 +254,7 @@ foreach ($lines as $line) {
case 'proc4ops':
// note : proc2 is dropped for kernels 3.10.0+ (centos 7+)
// note : proc4ops has changed a few times, and getting the keys is difficult
// I only use the version which reports 59 value's (centos 6)
// I only use the version which reports 59 value's (centos 6)
// the first value of the proc* is the amount of fields that will follow;
// we check this, and if its incorrect, do not polute the chart with wrong values
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
// Code below was borrowed from 'powerconnect-cpu.inc.php'
// Code below was borrowed from 'powerconnect-cpu.inc.php'
if (preg_match('/.6027.1.3.[0-9]+$/', $device['sysObjectID'])) {
$mempool['total'] = snmp_get($device, 'chSysProcessorMemSize.1', '-OvQU', 'F10-S-SERIES-CHASSIS-MIB');
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
* LibreNMS
* LibreNMS
*
* Copyright (c) 2017 Martin Zatloukal <[email protected]>
* This program is free software: you can redistribute it and/or modify it
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
// Code below was borrowed from 'powerconnect-cpu.inc.php'
// Code below was borrowed from 'powerconnect-cpu.inc.php'
if (preg_match('/.6027.1.3.[0-9]+$/', $device['sysObjectID'])) {
$mempool['total'] = snmp_get($device, 'chSysProcessorMemSize.1', '-OvQU', 'F10-S-SERIES-CHASSIS-MIB');
@@ -16,9 +16,7 @@ if (str_contains($device['sysDescr'], array('NetIron', 'MLX', 'CER')) === false)
}
$mempool['used'] = ($mempool['total'] - $mempool['free']);
d_echo($mempool);
} //end_if
else {
} else {
echo 'NetIron: ';
d_echo('caching');
$mempool_cache['ironware-dyn'] = array();
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -32,7 +32,7 @@ if (!$hardware && !$version) {
$serial = $data['.1.3.6.1.4.1.207.8.17.1.3.1.8.1'];
}
//Gets OS outputting "Alliedware Plus" instead of just Alliedware.
//Gets OS outputting "Alliedware Plus" instead of just Alliedware.
if ($hardware && $version) {
$version = 'Plus ' .$version;
}
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -4,7 +4,7 @@ if (!empty($matches[2])) {
$version .= " (" . trim($matches[2]) . ")";
}
// List of OIDs for HW recognition, add any potential HW OID here.
// List of OIDs for HW recognition, add any potential HW OID here.
$hwOidList = [
'.1.3.6.1.4.1.13464.1.2.1.1.2.15.0', //GBNPlatformOAM-MIB::productName.0
];
+1 -1
View File
@@ -4,7 +4,7 @@ if (!empty($matches[2])) {
$version .= " (" . trim($matches[2]) . ")";
}
// List of OIDs for HW recognition, add any potential HW OID here.
// List of OIDs for HW recognition, add any potential HW OID here.
$hwOidList = [
'.1.3.6.1.4.1.27975.37.1.5.1.4.1.1',
'FS-MIB::swProdName.0',
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -2
View File
@@ -43,7 +43,6 @@ if (strpos($sysdescr_value, 'IBM Networking Operating System') !== false) {
$hardware = str_replace('IBM Flex System Fabric', '', $sysdescr_value);
$version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
$serial = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.11.1', '-Ovq'), '" ');
} //end if
elseif (strpos($sysdescr_value, 'IBM Networking OS 1/10Gb Uplink Ethernet Switch Module') !== false) {
} elseif (strpos($sysdescr_value, 'IBM Networking OS 1/10Gb Uplink Ethernet Switch Module') !== false) {
$hardware = "IBM BladeCenter 1/10Gb Uplink Ethernet Switch Module";
}//end if
+1 -1
View File
@@ -10,7 +10,7 @@
*/
///////////////////////////////////////////////////
// Include the standard IOS polling file.
// Include the standard IOS polling file.
// Most of the IOSXE os polling code is identical
///////////////////////////////////////////////////
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2017 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2017 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -2,7 +2,7 @@
/*
* LibreNMS
*
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/*
* LibreNMS
* LibreNMS
*
* Copyright (c) 2015 Christophe Martinet Chrisgfx <martinet.christophe@gmail.com>
* This program is free software: you can redistribute it and/or modify it

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