Apply fixes from StyleCI (#15698)

Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
Jellyfrog 2024-01-05 05:39:12 +01:00 committed by GitHub
parent 58becd9ea2
commit 071ca9bc2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
615 changed files with 4562 additions and 4554 deletions

View File

@ -121,7 +121,7 @@ class AlertRules
$details = gzcompress(json_encode($details), 9);
dbUpdate(['details' => $details], 'alert_log', 'id = ?', [$alert_log['id']]);
} else {
$extra = gzcompress(json_encode(['contacts' => AlertUtil::getContacts($qry), 'rule'=>$qry]), 9);
$extra = gzcompress(json_encode(['contacts' => AlertUtil::getContacts($qry), 'rule' => $qry]), 9);
if (dbInsert(['state' => AlertState::ACTIVE, 'device_id' => $device_id, 'rule_id' => $rule['id'], 'details' => $extra], 'alert_log')) {
if (is_null($current_state)) {
dbInsert(['state' => AlertState::ACTIVE, 'device_id' => $device_id, 'rule_id' => $rule['id'], 'open' => 1, 'alerted' => 0], 'alerts');

View File

@ -87,11 +87,11 @@ abstract class Transport implements TransportInterface
public static function getColorForState($state)
{
$colors = [
AlertState::CLEAR => Config::get('alert_colour.ok'),
AlertState::ACTIVE => Config::get('alert_colour.bad'),
AlertState::CLEAR => Config::get('alert_colour.ok'),
AlertState::ACTIVE => Config::get('alert_colour.bad'),
AlertState::ACKNOWLEDGED => Config::get('alert_colour.acknowledged'),
AlertState::WORSE => Config::get('alert_colour.worse'),
AlertState::BETTER => Config::get('alert_colour.better'),
AlertState::WORSE => Config::get('alert_colour.worse'),
AlertState::BETTER => Config::get('alert_colour.better'),
];
return isset($colors[$state]) ? $colors[$state] : '#337AB7';

View File

@ -53,19 +53,19 @@ class Clickatell extends Transport
'config' => [
[
'title' => 'Token',
'name' => 'clickatell-token',
'name' => 'clickatell-token',
'descr' => 'Clickatell Token',
'type' => 'password',
'type' => 'password',
],
[
'title' => 'Mobile Numbers',
'name' => 'clickatell-numbers',
'name' => 'clickatell-numbers',
'descr' => 'Enter mobile numbers, can be new line or comma separated',
'type' => 'textarea',
'type' => 'textarea',
],
],
'validation' => [
'clickatell-token' => 'required|string',
'clickatell-token' => 'required|string',
'clickatell-numbers' => 'required|string',
],
];

View File

@ -72,7 +72,7 @@ class Gitlab extends Transport
'title' => 'Project ID',
'name' => 'gitlab-id',
'descr' => 'GitLab Project ID',
'type'=> 'text',
'type' => 'text',
],
[
'title' => 'Personal Access Token',

View File

@ -62,21 +62,21 @@ class Hue extends Transport
public static function configTemplate(): array
{
return [
'config'=>[
'config' => [
[
'title'=> 'Host',
'title' => 'Host',
'name' => 'hue-host',
'descr' => 'Hue Host',
'type' => 'text',
],
[
'title'=> 'Hue User',
'title' => 'Hue User',
'name' => 'hue-user',
'descr' => 'Phillips Hue Host',
'type' => 'text',
],
[
'title'=> 'Duration',
'title' => 'Duration',
'name' => 'hue-duration',
'descr' => 'Phillips Hue Duration',
'type' => 'select',

View File

@ -62,7 +62,7 @@ class Irc extends Transport
'title' => 'IRC',
'name' => 'irc',
'descr' => 'Enable IRC alerts',
'type' => 'checkbox',
'type' => 'checkbox',
'default' => true,
],
],

View File

@ -61,7 +61,7 @@ class Mail extends Transport
'title' => 'Contact Type',
'name' => 'mail-contact',
'descr' => 'Method for selecting contacts',
'type' => 'select',
'type' => 'select',
'options' => [
'Specified Email' => 'email',
'Device sysContact' => 'sysContact',
@ -74,13 +74,13 @@ class Mail extends Transport
'title' => 'Email',
'name' => 'email',
'descr' => 'Email address of contact',
'type' => 'text',
'type' => 'text',
],
[
'title' => 'Role',
'name' => 'role',
'descr' => 'Role of users to mail',
'type' => 'select',
'type' => 'select',
'options' => $roles,
],
[

View File

@ -43,15 +43,15 @@ class Pagerduty extends Transport
$safe_message = strip_tags($alert_data['msg']) ?: 'Test';
$message = array_filter(explode("\n", $safe_message), 'strlen');
$data = [
'routing_key' => $this->config['service_key'],
'routing_key' => $this->config['service_key'],
'event_action' => $event_action,
'dedup_key' => (string) $alert_data['alert_id'],
'payload' => [
'custom_details' => ['message' => $message],
'group' => (string) \DeviceCache::get($alert_data['device_id'])->groups->pluck('name'),
'source' => $alert_data['hostname'],
'dedup_key' => (string) $alert_data['alert_id'],
'payload' => [
'custom_details' => ['message' => $message],
'group' => (string) \DeviceCache::get($alert_data['device_id'])->groups->pluck('name'),
'source' => $alert_data['hostname'],
'severity' => $alert_data['severity'],
'summary' => ($alert_data['name'] ? $alert_data['name'] . ' on ' . $alert_data['hostname'] : $alert_data['title']),
'summary' => ($alert_data['name'] ? $alert_data['name'] . ' on ' . $alert_data['hostname'] : $alert_data['title']),
],
];
@ -88,8 +88,8 @@ class Pagerduty extends Transport
],
[
'title' => 'Routing Key',
'type' => 'text',
'name' => 'service_key',
'type' => 'text',
'name' => 'service_key',
],
[
'title' => 'Custom API URL',

View File

@ -93,9 +93,9 @@ class Playsms extends Transport
],
],
'validation' => [
'playsms-url' => 'required|url',
'playsms-user' => 'required|string',
'playsms-token' => 'required|string',
'playsms-url' => 'required|url',
'playsms-user' => 'required|string',
'playsms-token' => 'required|string',
'playsms-mobiles' => 'required',
],
];

View File

@ -97,21 +97,21 @@ class Pushover extends Transport
'config' => [
[
'title' => 'Api Key',
'name' => 'appkey',
'name' => 'appkey',
'descr' => 'Api Key',
'type' => 'password',
'type' => 'password',
],
[
'title' => 'User Key',
'name' => 'userkey',
'name' => 'userkey',
'descr' => 'User Key',
'type' => 'password',
'type' => 'password',
],
[
'title' => 'Pushover Options',
'name' => 'options',
'name' => 'options',
'descr' => 'Pushover options',
'type' => 'textarea',
'type' => 'textarea',
],
],
'validation' => [

View File

@ -96,10 +96,10 @@ class Smseagle extends Transport
],
],
'validation' => [
'smseagle-url' => 'required|url',
'smseagle-token' => 'required_without:smseagle-user,smseagle-pass|string',
'smseagle-user' => 'required_without:smseagle-token|string',
'smseagle-pass' => 'required_without:smseagle-token|string',
'smseagle-url' => 'required|url',
'smseagle-token' => 'required_without:smseagle-user,smseagle-pass|string',
'smseagle-user' => 'required_without:smseagle-token|string',
'smseagle-pass' => 'required_without:smseagle-token|string',
'smseagle-mobiles' => 'required',
],
];

View File

@ -81,10 +81,10 @@ class Smsfeedback extends Transport
],
],
'validation' => [
'smsfeedback-user' => 'required|string',
'smsfeedback-pass' => 'required|string',
'smsfeedback-user' => 'required|string',
'smsfeedback-pass' => 'required|string',
'smsfeedback-mobiles' => 'required',
'smsfeedback-sender' => 'required|string',
'smsfeedback-sender' => 'required|string',
],
];
}

View File

@ -72,8 +72,8 @@ class Twilio extends Transport
],
],
'validation' => [
'twilio-sid' => 'required|string',
'twilio-token' => 'required|string',
'twilio-sid' => 'required|string',
'twilio-token' => 'required|string',
'twilio-to' => 'required',
'twilio-sender' => 'required',
],

View File

@ -95,7 +95,7 @@ class Ukfastpss extends Transport
'title' => 'Secure',
'name' => 'secure',
'descr' => 'Specifies whether created request should be secure',
'type' => 'checkbox',
'type' => 'checkbox',
'default' => true,
],
],

View File

@ -207,8 +207,8 @@ class LdapAuthorizationAuthorizer extends AuthorizerBase
return [
'username' => $username,
'realname' => $realname,
'user_id' => $user_id,
'email' => $email,
'user_id' => $user_id,
'email' => $email,
];
}
}

View File

@ -138,6 +138,7 @@ class SSOAuthorizer extends MysqlAuthorizer
}
}
}
// No match, proxy is untrusted
return false;
} catch (InvalidIpException $e) {
@ -145,6 +146,7 @@ class SSOAuthorizer extends MysqlAuthorizer
return false;
}
}
// Not enabled, trust everything
return true;
}

View File

@ -47,7 +47,7 @@ class ApiException extends \Exception
public function render($request): JsonResponse
{
return response()->json([
'status' => 'error',
'status' => 'error',
'message' => $this->getMessage(),
], $this->getCode(), [], JSON_PRETTY_PRINT);
}

View File

@ -554,7 +554,7 @@ class IRCBot
}
if ($this->ssl && $this->config['irc_disable_ssl_check']) {
$ssl_context_params = ['ssl'=>['allow_self_signed'=> true, 'verify_peer' => false, 'verify_peer_name' => false]];
$ssl_context_params = ['ssl' => ['allow_self_signed' => true, 'verify_peer' => false, 'verify_peer_name' => false]];
$ssl_context = stream_context_create($ssl_context_params);
$this->socket['irc'] = stream_socket_client($server . ':' . $this->port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $ssl_context);
} else {
@ -1058,21 +1058,21 @@ class IRCBot
$string = preg_replace('#</u>#i', chr(31), $string);
$colors = [
'white' => '00',
'black' => '01',
'blue' => '02',
'green' => '03',
'red' => '04',
'brown' => '05',
'purple' => '06',
'orange' => '07',
'yellow' => '08',
'white' => '00',
'black' => '01',
'blue' => '02',
'green' => '03',
'red' => '04',
'brown' => '05',
'purple' => '06',
'orange' => '07',
'yellow' => '08',
'lightgreen' => '09',
'cyan' => '10',
'cyan' => '10',
'lightcyan' => '11',
'lightblue' => '12',
'pink' => '13',
'grey' => '14',
'pink' => '13',
'grey' => '14',
'lightgrey' => '15',
];

View File

@ -173,6 +173,7 @@ class Isis implements Module
if (count($data) !== $adjacencies->where('isisISAdjState', 'up')->count()) {
echo 'New Adjacencies, running discovery';
// don't enable, might be a bad heuristic
return $this->fillNew($adjacencies, $this->discoverIsIsMib($os));
}

View File

@ -101,10 +101,10 @@ class PrinterSupplies implements Module
echo $tonerperc . " %\n";
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('toner', 'GAUGE', 0, 20000),
'rrd_name' => ['toner', $toner['supply_type'], $toner['supply_index']],
'rrd_def' => RrdDefinition::make()->addDataset('toner', 'GAUGE', 0, 20000),
'rrd_name' => ['toner', $toner['supply_type'], $toner['supply_index']],
'rrd_oldname' => ['toner', $toner['supply_descr']],
'index' => $toner['supply_index'],
'index' => $toner['supply_index'],
];
$datastore->put($device, 'toner', $tags, $tonerperc);

View File

@ -81,15 +81,15 @@ class Allied extends OS implements OSDiscovery
$hardware = $c;
$serial = snmp_get($this->getDeviceArray(), 'arBoardSerialNumber.1', '-OsvQU', 'AT-INTERFACES-MIB');
// sysDescr.0 = STRING: "CentreCOM 9924Ts, version 3.2.1-04, built 08-Sep-2009"
// sysDescr.0 = STRING: "CentreCOM 9924Ts, version 3.2.1-04, built 08-Sep-2009"
} elseif ($a == 'CentreCOM' && $c == 'version') {
$version = $d;
$features = $f;
$hardware = snmp_get($this->getDeviceArray(), 'arBoardName.1', '-OsvQU', 'AT-INTERFACES-MIB');
$serial = snmp_get($this->getDeviceArray(), 'arBoardSerialNumber.1', '-OsvQU', 'AT-INTERFACES-MIB');
//AT-GS950/24 Gigabit Ethernet WebSmart Switch
//Also requires system description as no OIDs provide $hardware
//AT-GS950/24 Gigabit Ethernet WebSmart Switch
//Also requires system description as no OIDs provide $hardware
} elseif ($d == 'WebSmart' && $e == 'Switch') {
$version = snmp_get($this->getDeviceArray(), 'swhub.167.81.1.3.0', '-OsvQU', 'AtiL2-MIB');
$version = $d . ' ' . $version;

View File

@ -61,7 +61,7 @@ class Ciscowlc extends Cisco implements
->addDataset('NUMCLIENTS', 'GAUGE', 0, 12500000000);
$fields = [
'NUMAPS' => $numAccessPoints,
'NUMAPS' => $numAccessPoints,
'NUMCLIENTS' => $numClients,
];

View File

@ -97,7 +97,7 @@ class Comware extends OS implements MempoolsDiscovery, ProcessorDiscovery
$mempools->push((new Mempool([
'mempool_index' => $index,
'mempool_type' => 'comware',
'mempool_class' =>'system',
'mempool_class' => 'system',
'mempool_descr' => $entity_name[$index],
'mempool_precision' => 1,
'mempool_perc_oid' => ".1.3.6.1.4.1.25506.2.6.1.1.1.1.8.$index",

View File

@ -68,11 +68,11 @@ class Riverbed extends OS implements OSPolling
->addDataset('total', 'GAUGE', 0);
$fields = [
'half_open' => $conn_half_open,
'half_open' => $conn_half_open,
'half_closed' => $conn_half_closed,
'established' => $conn_established,
'active' => $conn_active,
'total' => $conn_total,
'active' => $conn_active,
'total' => $conn_total,
];
$tags = compact('rrd_def');

View File

@ -68,7 +68,7 @@ trait YamlMempoolsDiscovery
$mempool = (new Mempool([
'mempool_index' => isset($yaml['index']) ? YamlDiscovery::replaceValues('index', $index, $count, $yaml, $snmp_data) : $index,
'mempool_type' => $yaml['type'] ?? $this->getName(),
'mempool_class' =>$yaml['class'] ?? 'system',
'mempool_class' => $yaml['class'] ?? 'system',
'mempool_precision' => $yaml['precision'] ?? 1,
'mempool_descr' => isset($yaml['descr']) ? ucwords(YamlDiscovery::replaceValues('descr', $index, $count, $yaml, $snmp_data)) : 'Memory',
'mempool_used_oid' => $this->getOid('used', $index, $yaml),

View File

@ -203,7 +203,7 @@ class ConnectivityHelper
private function savePingStats(FpingResponse $ping_response): void
{
$perf = $ping_response->toModel();
$perf->debug = ['poller_name'=>Config::get('distributed_poller_name')];
$perf->debug = ['poller_name' => Config::get('distributed_poller_name')];
if (! $ping_response->success() && Config::get('debug.run_trace', false)) {
$perf->debug = array_merge($perf->debug, $this->traceroute());
}

View File

@ -44,6 +44,7 @@ class RRDRecursiveFilterIterator extends \RecursiveFilterIterator
// We want to search into directories
return true;
}
// Matches files with .rrd in the filename.
// We are only searching rrd folder, but there could be other files and we don't want to cause a stink.
return strpos($filename, '.rrd') !== false;

View File

@ -33,21 +33,21 @@ class Rewrite
public static function normalizeIfType($type)
{
$rewrite_iftype = [
'frameRelay' => 'Frame Relay',
'ethernetCsmacd' => 'Ethernet',
'softwareLoopback' => 'Loopback',
'tunnel' => 'Tunnel',
'propVirtual' => 'Virtual Int',
'ppp' => 'PPP',
'ds1' => 'DS1',
'pos' => 'POS',
'sonet' => 'SONET',
'slip' => 'SLIP',
'mpls' => 'MPLS Layer',
'l2vlan' => 'VLAN Subif',
'atm' => 'ATM',
'aal5' => 'ATM AAL5',
'atmSubInterface' => 'ATM Subif',
'frameRelay' => 'Frame Relay',
'ethernetCsmacd' => 'Ethernet',
'softwareLoopback' => 'Loopback',
'tunnel' => 'Tunnel',
'propVirtual' => 'Virtual Int',
'ppp' => 'PPP',
'ds1' => 'DS1',
'pos' => 'POS',
'sonet' => 'SONET',
'slip' => 'SLIP',
'mpls' => 'MPLS Layer',
'l2vlan' => 'VLAN Subif',
'atm' => 'ATM',
'aal5' => 'ATM AAL5',
'atmSubInterface' => 'ATM Subif',
'propPointToPointSerial' => 'PtP Serial',
];
@ -84,25 +84,25 @@ class Rewrite
public static function normalizeIfName($name)
{
$rewrite_ifname = [
'ether' => 'Ether',
'gig' => 'Gig',
'fast' => 'Fast',
'ten' => 'Ten',
'-802.1q vlan subif' => '',
'-802.1q' => '',
'bvi' => 'BVI',
'vlan' => 'Vlan',
'tunnel' => 'Tunnel',
'serial' => 'Serial',
'-aal5 layer' => ' aal5',
'null' => 'Null',
'atm' => 'ATM',
'port-channel' => 'Port-Channel',
'dial' => 'Dial',
'ether' => 'Ether',
'gig' => 'Gig',
'fast' => 'Fast',
'ten' => 'Ten',
'-802.1q vlan subif' => '',
'-802.1q' => '',
'bvi' => 'BVI',
'vlan' => 'Vlan',
'tunnel' => 'Tunnel',
'serial' => 'Serial',
'-aal5 layer' => ' aal5',
'null' => 'Null',
'atm' => 'ATM',
'port-channel' => 'Port-Channel',
'dial' => 'Dial',
'hp procurve switch software loopback interface' => 'Loopback Interface',
'control plane interface' => 'Control Plane',
'loop' => 'Loop',
'bundle-ether' => 'Bundle-Ether',
'control plane interface' => 'Control Plane',
'loop' => 'Loop',
'bundle-ether' => 'Bundle-Ether',
];
return str_ireplace(array_keys($rewrite_ifname), array_values($rewrite_ifname), $name);
@ -111,25 +111,25 @@ class Rewrite
public static function shortenIfName($name)
{
$rewrite_shortif = [
'tengigabitethernet' => 'Te',
'tengigabitethernet' => 'Te',
'ten-gigabitethernet' => 'Te',
'tengige' => 'Te',
'gigabitethernet' => 'Gi',
'fastethernet' => 'Fa',
'ethernet' => 'Et',
'serial' => 'Se',
'pos' => 'Pos',
'port-channel' => 'Po',
'atm' => 'Atm',
'null' => 'Null',
'loopback' => 'Lo',
'dialer' => 'Di',
'vlan' => 'Vlan',
'tunnel' => 'Tunnel',
'serviceinstance' => 'SI',
'dwdm' => 'DWDM',
'bundle-ether' => 'BE',
'bridge-aggregation' => 'BA',
'tengige' => 'Te',
'gigabitethernet' => 'Gi',
'fastethernet' => 'Fa',
'ethernet' => 'Et',
'serial' => 'Se',
'pos' => 'Pos',
'port-channel' => 'Po',
'atm' => 'Atm',
'null' => 'Null',
'loopback' => 'Lo',
'dialer' => 'Di',
'vlan' => 'Vlan',
'tunnel' => 'Tunnel',
'serviceinstance' => 'SI',
'dwdm' => 'DWDM',
'bundle-ether' => 'BE',
'bridge-aggregation' => 'BA',
];
return str_ireplace(array_keys($rewrite_shortif), array_values($rewrite_shortif), $name);
@ -213,167 +213,167 @@ class Rewrite
public static function vmwareGuest($guest_id)
{
$guests = [
'asianux3_64Guest' => 'Asianux Server 3 (64 bit)',
'asianux3Guest' => 'Asianux Server 3',
'asianux4_64Guest' => 'Asianux Server 4 (64 bit)',
'asianux4Guest' => 'Asianux Server 4',
'asianux5_64Guest' => 'Asianux Server 5 (64 bit)',
'asianux7_64Guest' => 'Asianux Server 7 (64 bit)',
'asianux8_64Guest' => 'Asianux Server 8 (64 bit)',
'centos6_64Guest' => 'CentOS 6 (64-bit)',
'centos64Guest' => 'CentOS 4/5 (64-bit)',
'centos6Guest' => 'CentOS 6',
'centos7_64Guest' => 'CentOS 7 (64-bit)',
'centos7Guest' => 'CentOS 7',
'centos8_64Guest' => 'CentOS 8 (64-bit)',
'centosGuest' => 'CentOS 4/5',
'coreos64Guest' => 'CoreOS Linux (64 bit)',
'darwin10_64Guest' => 'Mac OS 10.6 (64 bit)',
'darwin10Guest' => 'Mac OS 10.6',
'darwin11_64Guest' => 'Mac OS 10.7 (64 bit)',
'darwin11Guest' => 'Mac OS 10.7',
'darwin12_64Guest' => 'Mac OS 10.8 (64 bit)',
'darwin13_64Guest' => 'Mac OS 10.9 (64 bit)',
'darwin14_64Guest' => 'Mac OS 10.10 (64 bit)',
'darwin15_64Guest' => 'Mac OS 10.11 (64 bit)',
'darwin16_64Guest' => 'Mac OS 10.12 (64 bit)',
'darwin17_64Guest' => 'macOS 10.13 (64 bit)',
'darwin18_64Guest' => 'macOS 10.14 (64 bit)',
'darwin64Guest' => 'Mac OS 10.5 (64 bit)',
'darwinGuest' => 'Mac OS 10.5',
'debian10_64Guest' => 'Debian GNU/Linux 10 (64 bit)',
'debian10Guest' => 'Debian GNU/Linux 10',
'debian4_64Guest' => 'Debian GNU/Linux 4 (64 bit)',
'debian4Guest' => 'Debian GNU/Linux 4',
'debian5_64Guest' => 'Debian GNU/Linux 5 (64 bit)',
'debian5Guest' => 'Debian GNU/Linux 5',
'debian6_64Guest' => 'Debian GNU/Linux 6 (64 bit)',
'debian6Guest' => 'Debian GNU/Linux 6',
'debian7_64Guest' => 'Debian GNU/Linux 7 (64 bit)',
'debian7Guest' => 'Debian GNU/Linux 7',
'debian8_64Guest' => 'Debian GNU/Linux 8 (64 bit)',
'debian8Guest' => 'Debian GNU/Linux 8',
'debian9_64Guest' => 'Debian GNU/Linux 9 (64 bit)',
'debian9Guest' => 'Debian GNU/Linux 9',
'dosGuest' => 'MS-DOS.',
'eComStation2Guest' => 'eComStation 2.0',
'eComStationGuest' => 'eComStation 1.x',
'fedora64Guest' => 'Fedora Linux (64 bit)',
'fedoraGuest' => 'Fedora Linux',
'freebsd11_64Guest' => 'FreeBSD 11 x64',
'freebsd11Guest' => 'FreeBSD 11',
'freebsd12_64Guest' => 'FreeBSD 12 x64',
'freebsd12Guest' => 'FreeBSD 12',
'freebsd64Guest' => 'FreeBSD x64',
'freebsdGuest' => 'FreeBSD',
'genericLinuxGuest' => 'Other Linux',
'mandrakeGuest' => 'Mandrake Linux',
'mandriva64Guest' => 'Mandriva Linux (64 bit)',
'mandrivaGuest' => 'Mandriva Linux',
'netware4Guest' => 'Novell NetWare 4',
'netware5Guest' => 'Novell NetWare 5.1',
'netware6Guest' => 'Novell NetWare 6.x',
'nld9Guest' => 'Novell Linux Desktop 9',
'oesGuest' => 'Open Enterprise Server',
'openServer5Guest' => 'SCO OpenServer 5',
'openServer6Guest' => 'SCO OpenServer 6',
'opensuse64Guest' => 'OpenSUSE Linux (64 bit)',
'opensuseGuest' => 'OpenSUSE Linux',
'oracleLinux6_64Guest' => 'Oracle 6 (64-bit)',
'oracleLinux64Guest' => 'Oracle Linux 4/5 (64-bit)',
'oracleLinux6Guest' => 'Oracle 6',
'oracleLinux7_64Guest' => 'Oracle 7 (64-bit)',
'oracleLinux7Guest' => 'Oracle 7',
'oracleLinux8_64Guest' => 'Oracle 8 (64-bit)',
'oracleLinuxGuest' => 'Oracle Linux 4/5',
'os2Guest' => 'OS/2',
'other24xLinux64Guest' => 'Linux 2.4x Kernel (64 bit) (experimental)',
'other24xLinuxGuest' => 'Linux 2.4x Kernel',
'other26xLinux64Guest' => 'Linux 2.6x Kernel (64 bit) (experimental)',
'other26xLinuxGuest' => 'Linux 2.6x Kernel',
'other3xLinux64Guest' => 'Linux 3.x Kernel (64 bit)',
'other3xLinuxGuest' => 'Linux 3.x Kernel',
'other4xLinux64Guest' => 'Linux 4.x Kernel (64 bit)',
'other4xLinuxGuest' => 'Linux 4.x Kernel',
'otherGuest' => 'Other Operating System',
'otherGuest64' => 'Other Operating System (64 bit) (experimental)',
'otherLinux64Guest' => 'Linux (64 bit) (experimental)',
'otherLinuxGuest' => 'Linux 2.2x Kernel',
'redhatGuest' => 'Red Hat Linux 2.1',
'rhel2Guest' => 'Red Hat Enterprise Linux 2',
'rhel3_64Guest' => 'Red Hat Enterprise Linux 3 (64 bit)',
'rhel3Guest' => 'Red Hat Enterprise Linux 3',
'rhel4_64Guest' => 'Red Hat Enterprise Linux 4 (64 bit)',
'rhel4Guest' => 'Red Hat Enterprise Linux 4',
'rhel5_64Guest' => 'Red Hat Enterprise Linux 5 (64 bit) (experimental)',
'rhel5Guest' => 'Red Hat Enterprise Linux 5',
'rhel6_64Guest' => 'Red Hat Enterprise Linux 6 (64 bit)',
'rhel6Guest' => 'Red Hat Enterprise Linux 6',
'rhel7_64Guest' => 'Red Hat Enterprise Linux 7 (64 bit)',
'rhel7Guest' => 'Red Hat Enterprise Linux 7',
'rhel8_64Guest' => 'Red Hat Enterprise Linux 8 (64 bit)',
'sjdsGuest' => 'Sun Java Desktop System',
'sles10_64Guest' => 'Suse Linux Enterprise Server 10 (64 bit) (experimental)',
'sles10Guest' => 'Suse linux Enterprise Server 10',
'sles11_64Guest' => 'Suse Linux Enterprise Server 11 (64 bit)',
'sles11Guest' => 'Suse linux Enterprise Server 11',
'sles12_64Guest' => 'Suse Linux Enterprise Server 12 (64 bit)',
'sles12Guest' => 'Suse linux Enterprise Server 12',
'sles15_64Guest' => 'Suse Linux Enterprise Server 15 (64 bit)',
'sles64Guest' => 'Suse Linux Enterprise Server 9 (64 bit)',
'slesGuest' => 'Suse Linux Enterprise Server 9',
'solaris10_64Guest' => 'Solaris 10 (64 bit) (experimental)',
'solaris10Guest' => 'Solaris 10 (32 bit) (experimental)',
'solaris11_64Guest' => 'Solaris 11 (64 bit)',
'solaris6Guest' => 'Solaris 6',
'solaris7Guest' => 'Solaris 7',
'solaris8Guest' => 'Solaris 8',
'solaris9Guest' => 'Solaris 9',
'suse64Guest' => 'Suse Linux (64 bit)',
'suseGuest' => 'Suse Linux',
'turboLinux64Guest' => 'Turbolinux (64 bit)',
'turboLinuxGuest' => 'Turbolinux',
'ubuntu64Guest' => 'Ubuntu Linux (64 bit)',
'ubuntuGuest' => 'Ubuntu Linux',
'unixWare7Guest' => 'SCO UnixWare 7',
'vmkernel5Guest' => 'VMware ESX 5',
'vmkernel65Guest' => 'VMware ESX 6.5',
'vmkernel6Guest' => 'VMware ESX 6',
'vmkernelGuest' => 'VMware ESX 4',
'vmwarePhoton64Guest' => 'VMware Photon (64 bit)',
'win2000AdvServGuest' => 'Windows 2000 Advanced Server',
'win2000ProGuest' => 'Windows 2000 Professional',
'win2000ServGuest' => 'Windows 2000 Server',
'win31Guest' => 'Windows 3.1',
'win95Guest' => 'Windows 95',
'win98Guest' => 'Windows 98',
'windows7_64Guest' => 'Windows 7 (64 bit)',
'windows7Guest' => 'Windows 7',
'windows7Server64Guest' => 'Windows Server 2008 R2 (64 bit)',
'windows8_64Guest' => 'Windows 8 (64 bit)',
'windows8Guest' => 'Windows 8',
'windows8Server64Guest' => 'Windows 8 Server (64 bit)',
'windows9_64Guest' => 'Windows 10 (64 bit)',
'windows9Guest' => 'Windows 10',
'windows9Server64Guest' => 'Windows 10 Server (64 bit)',
'windowsHyperVGuest' => 'Windows Hyper-V',
'winLonghorn64Guest' => 'Windows Longhorn (64 bit) (experimental)',
'winLonghornGuest' => 'Windows Longhorn (experimental)',
'winMeGuest' => 'Windows Millenium Edition',
'winNetBusinessGuest' => 'Windows Small Business Server 2003',
'asianux3_64Guest' => 'Asianux Server 3 (64 bit)',
'asianux3Guest' => 'Asianux Server 3',
'asianux4_64Guest' => 'Asianux Server 4 (64 bit)',
'asianux4Guest' => 'Asianux Server 4',
'asianux5_64Guest' => 'Asianux Server 5 (64 bit)',
'asianux7_64Guest' => 'Asianux Server 7 (64 bit)',
'asianux8_64Guest' => 'Asianux Server 8 (64 bit)',
'centos6_64Guest' => 'CentOS 6 (64-bit)',
'centos64Guest' => 'CentOS 4/5 (64-bit)',
'centos6Guest' => 'CentOS 6',
'centos7_64Guest' => 'CentOS 7 (64-bit)',
'centos7Guest' => 'CentOS 7',
'centos8_64Guest' => 'CentOS 8 (64-bit)',
'centosGuest' => 'CentOS 4/5',
'coreos64Guest' => 'CoreOS Linux (64 bit)',
'darwin10_64Guest' => 'Mac OS 10.6 (64 bit)',
'darwin10Guest' => 'Mac OS 10.6',
'darwin11_64Guest' => 'Mac OS 10.7 (64 bit)',
'darwin11Guest' => 'Mac OS 10.7',
'darwin12_64Guest' => 'Mac OS 10.8 (64 bit)',
'darwin13_64Guest' => 'Mac OS 10.9 (64 bit)',
'darwin14_64Guest' => 'Mac OS 10.10 (64 bit)',
'darwin15_64Guest' => 'Mac OS 10.11 (64 bit)',
'darwin16_64Guest' => 'Mac OS 10.12 (64 bit)',
'darwin17_64Guest' => 'macOS 10.13 (64 bit)',
'darwin18_64Guest' => 'macOS 10.14 (64 bit)',
'darwin64Guest' => 'Mac OS 10.5 (64 bit)',
'darwinGuest' => 'Mac OS 10.5',
'debian10_64Guest' => 'Debian GNU/Linux 10 (64 bit)',
'debian10Guest' => 'Debian GNU/Linux 10',
'debian4_64Guest' => 'Debian GNU/Linux 4 (64 bit)',
'debian4Guest' => 'Debian GNU/Linux 4',
'debian5_64Guest' => 'Debian GNU/Linux 5 (64 bit)',
'debian5Guest' => 'Debian GNU/Linux 5',
'debian6_64Guest' => 'Debian GNU/Linux 6 (64 bit)',
'debian6Guest' => 'Debian GNU/Linux 6',
'debian7_64Guest' => 'Debian GNU/Linux 7 (64 bit)',
'debian7Guest' => 'Debian GNU/Linux 7',
'debian8_64Guest' => 'Debian GNU/Linux 8 (64 bit)',
'debian8Guest' => 'Debian GNU/Linux 8',
'debian9_64Guest' => 'Debian GNU/Linux 9 (64 bit)',
'debian9Guest' => 'Debian GNU/Linux 9',
'dosGuest' => 'MS-DOS.',
'eComStation2Guest' => 'eComStation 2.0',
'eComStationGuest' => 'eComStation 1.x',
'fedora64Guest' => 'Fedora Linux (64 bit)',
'fedoraGuest' => 'Fedora Linux',
'freebsd11_64Guest' => 'FreeBSD 11 x64',
'freebsd11Guest' => 'FreeBSD 11',
'freebsd12_64Guest' => 'FreeBSD 12 x64',
'freebsd12Guest' => 'FreeBSD 12',
'freebsd64Guest' => 'FreeBSD x64',
'freebsdGuest' => 'FreeBSD',
'genericLinuxGuest' => 'Other Linux',
'mandrakeGuest' => 'Mandrake Linux',
'mandriva64Guest' => 'Mandriva Linux (64 bit)',
'mandrivaGuest' => 'Mandriva Linux',
'netware4Guest' => 'Novell NetWare 4',
'netware5Guest' => 'Novell NetWare 5.1',
'netware6Guest' => 'Novell NetWare 6.x',
'nld9Guest' => 'Novell Linux Desktop 9',
'oesGuest' => 'Open Enterprise Server',
'openServer5Guest' => 'SCO OpenServer 5',
'openServer6Guest' => 'SCO OpenServer 6',
'opensuse64Guest' => 'OpenSUSE Linux (64 bit)',
'opensuseGuest' => 'OpenSUSE Linux',
'oracleLinux6_64Guest' => 'Oracle 6 (64-bit)',
'oracleLinux64Guest' => 'Oracle Linux 4/5 (64-bit)',
'oracleLinux6Guest' => 'Oracle 6',
'oracleLinux7_64Guest' => 'Oracle 7 (64-bit)',
'oracleLinux7Guest' => 'Oracle 7',
'oracleLinux8_64Guest' => 'Oracle 8 (64-bit)',
'oracleLinuxGuest' => 'Oracle Linux 4/5',
'os2Guest' => 'OS/2',
'other24xLinux64Guest' => 'Linux 2.4x Kernel (64 bit) (experimental)',
'other24xLinuxGuest' => 'Linux 2.4x Kernel',
'other26xLinux64Guest' => 'Linux 2.6x Kernel (64 bit) (experimental)',
'other26xLinuxGuest' => 'Linux 2.6x Kernel',
'other3xLinux64Guest' => 'Linux 3.x Kernel (64 bit)',
'other3xLinuxGuest' => 'Linux 3.x Kernel',
'other4xLinux64Guest' => 'Linux 4.x Kernel (64 bit)',
'other4xLinuxGuest' => 'Linux 4.x Kernel',
'otherGuest' => 'Other Operating System',
'otherGuest64' => 'Other Operating System (64 bit) (experimental)',
'otherLinux64Guest' => 'Linux (64 bit) (experimental)',
'otherLinuxGuest' => 'Linux 2.2x Kernel',
'redhatGuest' => 'Red Hat Linux 2.1',
'rhel2Guest' => 'Red Hat Enterprise Linux 2',
'rhel3_64Guest' => 'Red Hat Enterprise Linux 3 (64 bit)',
'rhel3Guest' => 'Red Hat Enterprise Linux 3',
'rhel4_64Guest' => 'Red Hat Enterprise Linux 4 (64 bit)',
'rhel4Guest' => 'Red Hat Enterprise Linux 4',
'rhel5_64Guest' => 'Red Hat Enterprise Linux 5 (64 bit) (experimental)',
'rhel5Guest' => 'Red Hat Enterprise Linux 5',
'rhel6_64Guest' => 'Red Hat Enterprise Linux 6 (64 bit)',
'rhel6Guest' => 'Red Hat Enterprise Linux 6',
'rhel7_64Guest' => 'Red Hat Enterprise Linux 7 (64 bit)',
'rhel7Guest' => 'Red Hat Enterprise Linux 7',
'rhel8_64Guest' => 'Red Hat Enterprise Linux 8 (64 bit)',
'sjdsGuest' => 'Sun Java Desktop System',
'sles10_64Guest' => 'Suse Linux Enterprise Server 10 (64 bit) (experimental)',
'sles10Guest' => 'Suse linux Enterprise Server 10',
'sles11_64Guest' => 'Suse Linux Enterprise Server 11 (64 bit)',
'sles11Guest' => 'Suse linux Enterprise Server 11',
'sles12_64Guest' => 'Suse Linux Enterprise Server 12 (64 bit)',
'sles12Guest' => 'Suse linux Enterprise Server 12',
'sles15_64Guest' => 'Suse Linux Enterprise Server 15 (64 bit)',
'sles64Guest' => 'Suse Linux Enterprise Server 9 (64 bit)',
'slesGuest' => 'Suse Linux Enterprise Server 9',
'solaris10_64Guest' => 'Solaris 10 (64 bit) (experimental)',
'solaris10Guest' => 'Solaris 10 (32 bit) (experimental)',
'solaris11_64Guest' => 'Solaris 11 (64 bit)',
'solaris6Guest' => 'Solaris 6',
'solaris7Guest' => 'Solaris 7',
'solaris8Guest' => 'Solaris 8',
'solaris9Guest' => 'Solaris 9',
'suse64Guest' => 'Suse Linux (64 bit)',
'suseGuest' => 'Suse Linux',
'turboLinux64Guest' => 'Turbolinux (64 bit)',
'turboLinuxGuest' => 'Turbolinux',
'ubuntu64Guest' => 'Ubuntu Linux (64 bit)',
'ubuntuGuest' => 'Ubuntu Linux',
'unixWare7Guest' => 'SCO UnixWare 7',
'vmkernel5Guest' => 'VMware ESX 5',
'vmkernel65Guest' => 'VMware ESX 6.5',
'vmkernel6Guest' => 'VMware ESX 6',
'vmkernelGuest' => 'VMware ESX 4',
'vmwarePhoton64Guest' => 'VMware Photon (64 bit)',
'win2000AdvServGuest' => 'Windows 2000 Advanced Server',
'win2000ProGuest' => 'Windows 2000 Professional',
'win2000ServGuest' => 'Windows 2000 Server',
'win31Guest' => 'Windows 3.1',
'win95Guest' => 'Windows 95',
'win98Guest' => 'Windows 98',
'windows7_64Guest' => 'Windows 7 (64 bit)',
'windows7Guest' => 'Windows 7',
'windows7Server64Guest' => 'Windows Server 2008 R2 (64 bit)',
'windows8_64Guest' => 'Windows 8 (64 bit)',
'windows8Guest' => 'Windows 8',
'windows8Server64Guest' => 'Windows 8 Server (64 bit)',
'windows9_64Guest' => 'Windows 10 (64 bit)',
'windows9Guest' => 'Windows 10',
'windows9Server64Guest' => 'Windows 10 Server (64 bit)',
'windowsHyperVGuest' => 'Windows Hyper-V',
'winLonghorn64Guest' => 'Windows Longhorn (64 bit) (experimental)',
'winLonghornGuest' => 'Windows Longhorn (experimental)',
'winMeGuest' => 'Windows Millenium Edition',
'winNetBusinessGuest' => 'Windows Small Business Server 2003',
'winNetDatacenter64Guest' => 'Windows Server 2003, Datacenter Edition (64 bit) (experimental)',
'winNetDatacenterGuest' => 'Windows Server 2003, Datacenter Edition',
'winNetDatacenterGuest' => 'Windows Server 2003, Datacenter Edition',
'winNetEnterprise64Guest' => 'Windows Server 2003, Enterprise Edition (64 bit)',
'winNetEnterpriseGuest' => 'Windows Server 2003, Enterprise Edition',
'winNetStandard64Guest' => 'Windows Server 2003, Standard Edition (64 bit)',
'winNetStandardGuest' => 'Windows Server 2003, Standard Edition',
'winNetWebGuest' => 'Windows Server 2003, Web Edition',
'winNTGuest' => 'Windows NT 4',
'winVista64Guest' => 'Windows Vista (64 bit)',
'winVistaGuest' => 'Windows Vista',
'winXPHomeGuest' => 'Windows XP Home Edition',
'winXPPro64Guest' => 'Windows XP Professional Edition (64 bit)',
'winXPProGuest' => 'Windows XP Professional',
'winNetEnterpriseGuest' => 'Windows Server 2003, Enterprise Edition',
'winNetStandard64Guest' => 'Windows Server 2003, Standard Edition (64 bit)',
'winNetStandardGuest' => 'Windows Server 2003, Standard Edition',
'winNetWebGuest' => 'Windows Server 2003, Web Edition',
'winNTGuest' => 'Windows NT 4',
'winVista64Guest' => 'Windows Vista (64 bit)',
'winVistaGuest' => 'Windows Vista',
'winXPHomeGuest' => 'Windows XP Home Edition',
'winXPPro64Guest' => 'Windows XP Professional Edition (64 bit)',
'winXPProGuest' => 'Windows XP Professional',
];
return $guests[$guest_id] ?? $guest_id;

View File

@ -99,53 +99,53 @@ class Stats
$version = Version::get();
return [
'alert_rules' => $this->selectTotal(DB::table('alert_rules')->where('disabled', 0), ['severity']),
'alert_templates' => $this->selectTotal('alert_templates'),
'api_tokens' => $this->selectTotal(DB::table('api_tokens')->where('disabled', 0)),
'applications' => $this->selectTotal('applications', ['app_type']),
'bgppeer_state' => $this->selectTotal('bgpPeers', ['bgpPeerState']),
'bgppeer_status' => $this->selectTotal('bgpPeers', ['bgpPeerAdminStatus']),
'bills' => $this->selectTotal('bills', ['bill_type']),
'cef' => $this->selectTotal('cef_switching'),
'cisco_asa' => $this->selectTotal(DB::table('ciscoASA')->where('disabled', 0), ['oid']),
'mempool' => $this->selectTotal('mempools', ['mempool_descr']),
'dbschema' => $this->selectStatic(DB::table('migrations')->count()),
'snmp_version' => $this->selectTotal('devices', ['snmpver']),
'os' => $this->selectTotal('devices', ['os']),
'type' => $this->selectTotal('devices', ['type']),
'hardware' => $this->selectTotal('devices', ['hardware']),
'ipsec' => $this->selectTotal('ipsec_tunnels'),
'ipv4_addresses' => $this->selectTotal('ipv4_addresses'),
'ipv4_macaddress' => $this->selectTotal('ipv4_mac'),
'ipv4_networks' => $this->selectTotal('ipv4_networks'),
'ipv6_addresses' => $this->selectTotal('ipv6_addresses'),
'ipv6_networks' => $this->selectTotal('ipv6_networks'),
'xdp' => $this->selectTotal('links', ['protocol']),
'ospf' => $this->selectTotal('ospf_instances', ['ospfVersionNumber']),
'ospf_links' => $this->selectTotal('ospf_ports', ['ospfIfType']),
'arch' => $this->selectTotal('packages', ['arch']),
'pollers' => $this->selectTotal('pollers'),
'port_type' => $this->selectTotal('ports', ['ifType']),
'port_ifspeed' => DB::table('ports')->select([DB::raw('COUNT(*) AS `total`'), DB::raw('ROUND(`ifSpeed`/1000/1000) as ifSpeed')])->groupBy(['ifSpeed'])->get(),
'port_vlans' => $this->selectTotal('ports_vlans', ['state']),
'processes' => $this->selectTotal('processes'),
'processors' => $this->selectTotal('processors', ['processor_type']),
'pseudowires' => $this->selectTotal('pseudowires'),
'sensors' => $this->selectTotal('sensors', ['sensor_class']),
'sla' => $this->selectTotal('slas', ['rtt_type']),
'wireless' => $this->selectTotal('wireless_sensors', ['sensor_class']),
'storage' => $this->selectTotal('storage', ['storage_type']),
'toner' => $this->selectTotal('printer_supplies', ['supply_type']),
'vlans' => $this->selectTotal('vlans', ['vlan_type']),
'vminfo' => $this->selectTotal('vminfo', ['vm_type']),
'vmware' => $this->selectTotal('vminfo'),
'vrfs' => $this->selectTotal('vrfs'),
'alert_rules' => $this->selectTotal(DB::table('alert_rules')->where('disabled', 0), ['severity']),
'alert_templates' => $this->selectTotal('alert_templates'),
'api_tokens' => $this->selectTotal(DB::table('api_tokens')->where('disabled', 0)),
'applications' => $this->selectTotal('applications', ['app_type']),
'bgppeer_state' => $this->selectTotal('bgpPeers', ['bgpPeerState']),
'bgppeer_status' => $this->selectTotal('bgpPeers', ['bgpPeerAdminStatus']),
'bills' => $this->selectTotal('bills', ['bill_type']),
'cef' => $this->selectTotal('cef_switching'),
'cisco_asa' => $this->selectTotal(DB::table('ciscoASA')->where('disabled', 0), ['oid']),
'mempool' => $this->selectTotal('mempools', ['mempool_descr']),
'dbschema' => $this->selectStatic(DB::table('migrations')->count()),
'snmp_version' => $this->selectTotal('devices', ['snmpver']),
'os' => $this->selectTotal('devices', ['os']),
'type' => $this->selectTotal('devices', ['type']),
'hardware' => $this->selectTotal('devices', ['hardware']),
'ipsec' => $this->selectTotal('ipsec_tunnels'),
'ipv4_addresses' => $this->selectTotal('ipv4_addresses'),
'ipv4_macaddress' => $this->selectTotal('ipv4_mac'),
'ipv4_networks' => $this->selectTotal('ipv4_networks'),
'ipv6_addresses' => $this->selectTotal('ipv6_addresses'),
'ipv6_networks' => $this->selectTotal('ipv6_networks'),
'xdp' => $this->selectTotal('links', ['protocol']),
'ospf' => $this->selectTotal('ospf_instances', ['ospfVersionNumber']),
'ospf_links' => $this->selectTotal('ospf_ports', ['ospfIfType']),
'arch' => $this->selectTotal('packages', ['arch']),
'pollers' => $this->selectTotal('pollers'),
'port_type' => $this->selectTotal('ports', ['ifType']),
'port_ifspeed' => DB::table('ports')->select([DB::raw('COUNT(*) AS `total`'), DB::raw('ROUND(`ifSpeed`/1000/1000) as ifSpeed')])->groupBy(['ifSpeed'])->get(),
'port_vlans' => $this->selectTotal('ports_vlans', ['state']),
'processes' => $this->selectTotal('processes'),
'processors' => $this->selectTotal('processors', ['processor_type']),
'pseudowires' => $this->selectTotal('pseudowires'),
'sensors' => $this->selectTotal('sensors', ['sensor_class']),
'sla' => $this->selectTotal('slas', ['rtt_type']),
'wireless' => $this->selectTotal('wireless_sensors', ['sensor_class']),
'storage' => $this->selectTotal('storage', ['storage_type']),
'toner' => $this->selectTotal('printer_supplies', ['supply_type']),
'vlans' => $this->selectTotal('vlans', ['vlan_type']),
'vminfo' => $this->selectTotal('vminfo', ['vm_type']),
'vmware' => $this->selectTotal('vminfo'),
'vrfs' => $this->selectTotal('vrfs'),
'database_version' => $this->selectStatic($version->databaseServer()),
'php_version' => $this->selectStatic(phpversion()),
'python_version' => $this->selectStatic($version->python()),
'rrdtool_version' => $this->selectStatic($version->rrdtool()),
'netsnmp_version' => $this->selectStatic($version->netSnmp()),
'os_version' => $this->selectStatic($version->os()),
'php_version' => $this->selectStatic(phpversion()),
'python_version' => $this->selectStatic($version->python()),
'rrdtool_version' => $this->selectStatic($version->rrdtool()),
'netsnmp_version' => $this->selectStatic($version->netSnmp()),
'os_version' => $this->selectStatic($version->os()),
'librenms_release' => $this->selectStatic($version->release(), 'release'),
];
}

View File

@ -60,7 +60,7 @@ class NominatimApi extends BaseApi implements Geocoder
],
'headers' => [
'User-Agent' => 'LibreNMS',
'Accept' => 'application/json',
'Accept' => 'application/json',
],
];
}

View File

@ -105,10 +105,10 @@ class DeviceAdd extends LnmsCommand
'poller_group' => $this->option('poller-group'),
'port_association_mode' => PortAssociationMode::getId($this->option('port-association-mode')),
'community' => $this->option('community'),
'authlevel' => ($auth ? 'auth' : 'noAuth') . (($priv && $auth) ? 'Priv' : 'NoPriv'),
'authname' => $this->option('security-name'),
'authpass' => $this->option('auth-password'),
'authalgo' => $this->option('auth-protocol'),
'authlevel' => ($auth ? 'auth' : 'noAuth') . (($priv && $auth) ? 'Priv' : 'NoPriv'),
'authname' => $this->option('security-name'),
'authpass' => $this->option('auth-password'),
'authalgo' => $this->option('auth-protocol'),
'cryptopass' => $this->option('privacy-password'),
'cryptoalgo' => $this->option('privacy-protocol'),
]);

View File

@ -66,7 +66,7 @@ class AboutController extends Controller
return view('about.index', [
'usage_reporting_status' => Config::get('reporting.usage'),
'error_reporting_status' => Config::get('reporting.error'),
'reporting_clearable' => Callback::whereIn('name', ['uuid', 'error_reporting_uuid'])->exists(),
'reporting_clearable' => Callback::whereIn('name', ['uuid', 'error_reporting_uuid'])->exists(),
'db_schema' => $version->database(),
'git_log' => $version->git->log(),
@ -90,21 +90,21 @@ class AboutController extends Controller
'stat_hrdev' => HrDevice::count(),
'stat_ipv4_addy' => Ipv4Address::count(),
'stat_ipv4_nets' => Ipv4Network::count(),
'stat_ipv6_addy' => Ipv6Address::count(),
'stat_ipv6_nets' => Ipv6Network::count(),
'stat_memory' => Mempool::count(),
'stat_ports' => Port::count(),
'stat_ipv6_addy' => Ipv6Address::count(),
'stat_ipv6_nets' => Ipv6Network::count(),
'stat_memory' => Mempool::count(),
'stat_ports' => Port::count(),
'stat_processors' => Processor::count(),
'stat_pw' => Pseudowire::count(),
'stat_sensors' => Sensor::count(),
'stat_services' => Service::count(),
'stat_slas' => Sla::count(),
'stat_storage' => Storage::count(),
'stat_syslog' => Syslog::count(),
'stat_toner' => PrinterSupply::count(),
'stat_vlans' => Vlan::count(),
'stat_vrf' => Vrf::count(),
'stat_wireless' => WirelessSensor::count(),
'stat_pw' => Pseudowire::count(),
'stat_sensors' => Sensor::count(),
'stat_services' => Service::count(),
'stat_slas' => Sla::count(),
'stat_storage' => Storage::count(),
'stat_syslog' => Syslog::count(),
'stat_toner' => PrinterSupply::count(),
'stat_vlans' => Vlan::count(),
'stat_vrf' => Vrf::count(),
'stat_wireless' => WirelessSensor::count(),
]);
}

View File

@ -59,14 +59,14 @@ class BgpSearchController extends SearchController
: 'fa fa-external-link-square fa-lg icon-theme';
return [
'url' => Url::deviceUrl($peer->device, ['tab' => 'routing', 'proto' => 'bgp']),
'name' => $peer->bgpPeerIdentifier,
'url' => Url::deviceUrl($peer->device, ['tab' => 'routing', 'proto' => 'bgp']),
'name' => $peer->bgpPeerIdentifier,
'description' => $peer->astext,
'localas' => $peer->device->bgpLocalAs,
'bgp_image' => $bgp_image,
'remoteas' => $peer->bgpPeerRemoteAs,
'colours' => Color::forBgpPeerStatus($peer),
'hostname' => $peer->device->displayName(),
'localas' => $peer->device->bgpLocalAs,
'bgp_image' => $bgp_image,
'remoteas' => $peer->bgpPeerRemoteAs,
'colours' => Color::forBgpPeerStatus($peer),
'hostname' => $peer->device->displayName(),
];
}
}

View File

@ -65,12 +65,12 @@ class PortSearchController extends SearchController
}
return [
'url' => Url::portUrl($port),
'name' => $label,
'url' => Url::portUrl($port),
'name' => $label,
'description' => $description,
'colours' => Color::forPortStatus($port),
'hostname' => $port->device->displayName(),
'port_id' => $port->port_id,
'colours' => Color::forPortStatus($port),
'hostname' => $port->device->displayName(),
'port_id' => $port->port_id,
];
}
}

View File

@ -135,7 +135,7 @@ class SocialiteController extends Controller
$user = User::firstOrNew([
'auth_type' => "socialite_$provider",
'auth_id' => $this->socialite_user->getId(),
'auth_id' => $this->socialite_user->getId(),
]);
if ($user->user_id) {

View File

@ -113,7 +113,7 @@ class DeviceDependencyController extends MapController
// List all Device
$devices_by_id[] = array_merge(
[
'id' => $device->device_id,
'id' => $device->device_id,
'label' => $device->shortDisplayName(),
'title' => Url::deviceLink($device, null, [], 0, 0, 0, 0),
'shape' => 'box',
@ -131,8 +131,8 @@ class DeviceDependencyController extends MapController
foreach ($parents as $parent) {
$device_associations[] = $parent->device_id;
$dependencies[] = [
'from' => $device->device_id,
'to' => $parent->device_id,
'from' => $device->device_id,
'to' => $parent->device_id,
'width' => 2,
];
}

View File

@ -103,12 +103,12 @@ class CustomersController extends TableController
public function formatItem($port)
{
return [
'port_descr_descr' => $port->port_descr_descr,
'hostname' => Url::deviceLink($port->device),
'ifDescr' => Url::portLink($port),
'port_descr_speed' => $port->port_descr_speed,
'port_descr_descr' => $port->port_descr_descr,
'hostname' => Url::deviceLink($port->device),
'ifDescr' => Url::portLink($port),
'port_descr_speed' => $port->port_descr_speed,
'port_descr_circuit' => $port->port_descr_circuit,
'port_descr_notes' => $port->port_descr_notes,
'port_descr_notes' => $port->port_descr_notes,
];
}
@ -124,12 +124,12 @@ class CustomersController extends TableController
$graph_data = Html::graphRow($graph_array);
return [
'port_descr_descr' => $graph_data[0],
'hostname' => $graph_data[1],
'ifDescr' => '',
'port_descr_speed' => '',
'port_descr_descr' => $graph_data[0],
'hostname' => $graph_data[1],
'ifDescr' => '',
'port_descr_speed' => '',
'port_descr_circuit' => $graph_data[2],
'port_descr_notes' => $graph_data[3],
'port_descr_notes' => $graph_data[3],
];
}

View File

@ -70,18 +70,18 @@ class EditPortsController extends TableController
}
return [
'ifIndex' => $port->ifIndex,
'ifName' => $port->getLabel(),
'ifAdminStatus' => $port->ifAdminStatus,
'ifOperStatus' => '<span id="operstatus_' . $port->port_id . '" ' . $out_of_sync . '>' . $port->ifOperStatus . '</span>',
'disabled' => '<input type="checkbox" class="disable-check" data-size="small" name="disabled_' . $port->port_id . '"' . ($port->disabled ? 'checked' : '') . '>
'ifIndex' => $port->ifIndex,
'ifName' => $port->getLabel(),
'ifAdminStatus' => $port->ifAdminStatus,
'ifOperStatus' => '<span id="operstatus_' . $port->port_id . '" ' . $out_of_sync . '>' . $port->ifOperStatus . '</span>',
'disabled' => '<input type="checkbox" class="disable-check" data-size="small" name="disabled_' . $port->port_id . '"' . ($port->disabled ? 'checked' : '') . '>
<input type="hidden" name="olddis_' . $port->port_id . '" value="' . ($port->disabled ? 1 : 0) . '"">',
'ignore' => '<input type="checkbox" class="ignore-check" data-size="small" name="ignore_' . $port->port_id . '"' . ($port->ignore ? 'checked' : '') . '>
'ignore' => '<input type="checkbox" class="ignore-check" data-size="small" name="ignore_' . $port->port_id . '"' . ($port->ignore ? 'checked' : '') . '>
<input type="hidden" name="oldign_' . $port->port_id . '" value="' . ($port->ignore ? 1 : 0) . '"">',
'port_tune' => '<input type="checkbox" name="override_config" data-attrib="ifName_tune:' . $port->ifName . '" data-device_id="' . $port->device_id . '" data-size="small" ' . $tune . '>',
'ifAlias' => '<div class="form-group"><input class="form-control input-sm" name="if-alias" data-device_id="' . $port->device_id . '" data-port_id="' . $port->port_id . '" data-ifName="' . $port->ifName . '" value="' . $port->ifAlias . '"><span class="form-control-feedback"><i class="fa" aria-hidden="true"></i></span></div>',
'ifSpeed' => '<div class="form-group has-feedback"><input type="text" pattern="[0-9]*" inputmode="numeric" class="form-control input-sm" name="if-speed" data-device_id="' . $port->device_id . '" data-port_id="' . $port->port_id . '" data-ifName="' . $port->ifName . '" value="' . $port->ifSpeed . '"><span class="form-control-feedback"><i class="fas" aria-hidden="true"></i></span></div>',
'portGroup' => '<div class="form-group has-feedback"><select class="input-sm port_group_select" name="port_group_' . $port->port_id . '[]" data-port_id="' . $port->port_id . '" multiple>' . $port_group_options . '</select></div>',
'port_tune' => '<input type="checkbox" name="override_config" data-attrib="ifName_tune:' . $port->ifName . '" data-device_id="' . $port->device_id . '" data-size="small" ' . $tune . '>',
'ifAlias' => '<div class="form-group"><input class="form-control input-sm" name="if-alias" data-device_id="' . $port->device_id . '" data-port_id="' . $port->port_id . '" data-ifName="' . $port->ifName . '" value="' . $port->ifAlias . '"><span class="form-control-feedback"><i class="fa" aria-hidden="true"></i></span></div>',
'ifSpeed' => '<div class="form-group has-feedback"><input type="text" pattern="[0-9]*" inputmode="numeric" class="form-control input-sm" name="if-speed" data-device_id="' . $port->device_id . '" data-port_id="' . $port->port_id . '" data-ifName="' . $port->ifName . '" value="' . $port->ifSpeed . '"><span class="form-control-feedback"><i class="fas" aria-hidden="true"></i></span></div>',
'portGroup' => '<div class="form-group has-feedback"><select class="input-sm port_group_select" name="port_group_' . $port->port_id . '[]" data-port_id="' . $port->port_id . '" multiple>' . $port_group_options . '</select></div>',
];
}
}

View File

@ -117,13 +117,13 @@ class GraylogController extends SimpleTableController
$facility = $message['message']['facility'] ?? '';
return [
'origin' => $origin ? Url::deviceLink($origin) : htmlspecialchars($message['message']['gl2_remote_ip']),
'severity' => $this->severityLabel($level),
'origin' => $origin ? Url::deviceLink($origin) : htmlspecialchars($message['message']['gl2_remote_ip']),
'severity' => $this->severityLabel($level),
'timestamp' => $displayTime,
'source' => $source ? Url::deviceLink($source) : htmlspecialchars($message['message']['source']),
'message' => htmlspecialchars($message['message']['message'] ?? ''),
'facility' => is_numeric($facility) ? "($facility) " . __("syslog.facility.$facility") : $facility,
'level' => (is_numeric($level) && $level >= 0) ? "($level) " . __("syslog.severity.$level") : $level,
'source' => $source ? Url::deviceLink($source) : htmlspecialchars($message['message']['source']),
'message' => htmlspecialchars($message['message']['message'] ?? ''),
'facility' => is_numeric($facility) ? "($facility) " . __("syslog.facility.$facility") : $facility,
'level' => (is_numeric($level) && $level >= 0) ? "($level) " . __("syslog.severity.$level") : $level,
];
}
@ -138,7 +138,7 @@ class GraylogController extends SimpleTableController
'5' => 'label-info',
'6' => 'label-info',
'7' => 'label-default',
'' => 'label-info',
'' => 'label-info',
];
$barColor = isset($map[$severity]) ? $map[$severity] : 'label-info';

View File

@ -37,7 +37,7 @@ class InventoryController extends TableController
return [
'device' => 'nullable|int',
'descr' => 'nullable|string',
'model'=> 'nullable|string',
'model' => 'nullable|string',
'serial' => 'nullable|string',
];
}

View File

@ -80,21 +80,21 @@ class MempoolsController extends TableController
]);
return [
'hostname' => Url::deviceLink($device),
'hostname' => Url::deviceLink($device),
'mempool_descr' => $graphs[0],
'graph' => $graphs[1],
'mempool_used' => $graphs[2],
'mempool_perc' => $graphs[3],
'graph' => $graphs[1],
'mempool_used' => $graphs[2],
'mempool_perc' => $graphs[3],
];
}
/** @var Mempool $mempool */
return [
'hostname' => Url::deviceLink($mempool->device),
'hostname' => Url::deviceLink($mempool->device),
'mempool_descr' => $mempool->mempool_descr,
'graph' => $this->miniGraph($mempool),
'mempool_used' => $this->barLink($mempool),
'mempool_perc' => $mempool->mempool_perc . '%',
'graph' => $this->miniGraph($mempool),
'mempool_used' => $this->barLink($mempool),
'mempool_perc' => $mempool->mempool_perc . '%',
];
}

View File

@ -44,8 +44,8 @@ class NotesController extends WidgetController
}
$purifier_config = [
'HTML.Allowed' => 'b,iframe[frameborder|src|width|height],i,ul,ol,li,h1,h2,h3,h4,br,p,pre',
'HTML.Trusted' => true,
'HTML.Allowed' => 'b,iframe[frameborder|src|width|height],i,ul,ol,li,h1,h2,h3,h4,br,p,pre',
'HTML.Trusted' => true,
'HTML.SafeIframe' => true,
'URI.SafeIframeRegexp' => '%^(https?:)?//%',
];

View File

@ -466,6 +466,7 @@ class Device extends BaseModel
if (empty($ip)) {
return null;
}
// @ suppresses warning, inet_ntop() returns false if it fails
return @inet_ntop($ip) ?: null;
}

View File

@ -75,7 +75,7 @@ class Eventlog extends DeviceRelatedModel
'datetime' => Carbon::now(),
'severity' => $severity,
'message' => $text,
'username' => (class_exists('\Auth') && Auth::check()) ? Auth::user()->username : '',
'username' => (class_exists('\Auth') && Auth::check()) ? Auth::user()->username : '',
]);
if (is_numeric($device)) {

View File

@ -35,6 +35,7 @@ class PortGroup extends BaseModel
if ($user->hasGlobalRead()) {
return $query;
}
// maybe filtered in future
return $query;
}

View File

@ -13,36 +13,36 @@ class Sensor extends DeviceRelatedModel
public $timestamps = false;
protected $primaryKey = 'sensor_id';
protected static $icons = [
'airflow' => 'angle-double-right',
'ber' => 'sort-amount-desc',
'charge' => 'battery-half',
'airflow' => 'angle-double-right',
'ber' => 'sort-amount-desc',
'charge' => 'battery-half',
'chromatic_dispersion' => 'indent',
'cooling' => 'thermometer-full',
'count' => 'hashtag',
'current' => 'bolt fa-flip-horizontal',
'dbm' => 'sun-o',
'delay' => 'clock-o',
'eer' => 'snowflake-o',
'fanspeed' => 'refresh',
'frequency' => 'line-chart',
'humidity' => 'tint',
'load' => 'percent',
'loss' => 'percentage',
'power' => 'power-off',
'power_consumed' => 'plug',
'power_factor' => 'calculator',
'pressure' => 'thermometer-empty',
'quality_factor' => 'arrows',
'runtime' => 'hourglass-half',
'signal' => 'wifi',
'snr' => 'signal',
'state' => 'bullseye',
'temperature' => 'thermometer-three-quarters',
'tv_signal' => 'signal',
'bitrate' => 'bar-chart',
'voltage' => 'bolt',
'waterflow' => 'tint',
'percent' => 'percent',
'cooling' => 'thermometer-full',
'count' => 'hashtag',
'current' => 'bolt fa-flip-horizontal',
'dbm' => 'sun-o',
'delay' => 'clock-o',
'eer' => 'snowflake-o',
'fanspeed' => 'refresh',
'frequency' => 'line-chart',
'humidity' => 'tint',
'load' => 'percent',
'loss' => 'percentage',
'power' => 'power-off',
'power_consumed' => 'plug',
'power_factor' => 'calculator',
'pressure' => 'thermometer-empty',
'quality_factor' => 'arrows',
'runtime' => 'hourglass-half',
'signal' => 'wifi',
'snr' => 'signal',
'state' => 'bullseye',
'temperature' => 'thermometer-three-quarters',
'tv_signal' => 'signal',
'bitrate' => 'bar-chart',
'voltage' => 'bolt',
'waterflow' => 'tint',
'percent' => 'percent',
];
// ---- Helper Functions ----

View File

@ -43,7 +43,7 @@ abstract class DeviceOverviewHook
{
return [
'title' => __CLASS__,
'device' => $device,
'device' => $device,
];
}

View File

@ -45,7 +45,7 @@ abstract class PortTabHook implements Hook
{
return [
'title' => __CLASS__,
'port' => $port,
'port' => $port,
];
}

View File

@ -74,17 +74,17 @@ foreach (dbFetchRows('SELECT * FROM `bills` ORDER BY `bill_id`') as $bill) {
if ($i == '0') {
$update = [
'rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
'rate_95th_out' => $rate_data['rate_95th_out'],
'dir_95th' => $rate_data['dir_95th'],
'total_data' => $rate_data['total_data'],
'total_data_in' => $rate_data['total_data_in'],
'total_data_out' => $rate_data['total_data_out'],
'rate_average' => $rate_data['rate_average'],
'rate_average_in' => $rate_data['rate_average_in'],
'rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
'rate_95th_out' => $rate_data['rate_95th_out'],
'dir_95th' => $rate_data['dir_95th'],
'total_data' => $rate_data['total_data'],
'total_data_in' => $rate_data['total_data_in'],
'total_data_out' => $rate_data['total_data_out'],
'rate_average' => $rate_data['rate_average'],
'rate_average_in' => $rate_data['rate_average_in'],
'rate_average_out' => $rate_data['rate_average_out'],
'bill_last_calc' => ['NOW()'],
'bill_last_calc' => ['NOW()'],
];
dbUpdate($update, 'bills', '`bill_id` = ?', [$bill['bill_id']]);
@ -93,46 +93,46 @@ foreach (dbFetchRows('SELECT * FROM `bills` ORDER BY `bill_id`') as $bill) {
if (isset($check['bill_id']) && $check['bill_id'] == $bill['bill_id']) {
$update = [
'rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
'rate_95th_out' => $rate_data['rate_95th_out'],
'dir_95th' => $rate_data['dir_95th'],
'rate_average' => $rate_data['rate_average'],
'rate_average_in' => $rate_data['rate_average_in'],
'rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
'rate_95th_out' => $rate_data['rate_95th_out'],
'dir_95th' => $rate_data['dir_95th'],
'rate_average' => $rate_data['rate_average'],
'rate_average_in' => $rate_data['rate_average_in'],
'rate_average_out' => $rate_data['rate_average_out'],
'traf_total' => $rate_data['total_data'],
'traf_in' => $rate_data['total_data_in'],
'traf_out' => $rate_data['total_data_out'],
'bill_peak_out' => $period['peak_out'],
'bill_peak_in' => $period['peak_in'],
'bill_used' => $used,
'bill_overuse' => $overuse,
'bill_percent' => $percent,
'updated' => ['NOW()'],
'traf_total' => $rate_data['total_data'],
'traf_in' => $rate_data['total_data_in'],
'traf_out' => $rate_data['total_data_out'],
'bill_peak_out' => $period['peak_out'],
'bill_peak_in' => $period['peak_in'],
'bill_used' => $used,
'bill_overuse' => $overuse,
'bill_percent' => $percent,
'updated' => ['NOW()'],
];
dbUpdate($update, 'bill_history', '`bill_hist_id` = ?', [$check['bill_hist_id']]);
echo ' Updated history! ';
} else {
$update = [
'rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
'rate_95th_out' => $rate_data['rate_95th_out'],
'dir_95th' => $rate_data['dir_95th'],
'rate_average' => $rate_data['rate_average'],
'rate_average_in' => $rate_data['rate_average_in'],
'rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
'rate_95th_out' => $rate_data['rate_95th_out'],
'dir_95th' => $rate_data['dir_95th'],
'rate_average' => $rate_data['rate_average'],
'rate_average_in' => $rate_data['rate_average_in'],
'rate_average_out' => $rate_data['rate_average_out'],
'traf_total' => $rate_data['total_data'],
'traf_in' => $rate_data['total_data_in'],
'traf_out' => $rate_data['total_data_out'],
'bill_datefrom' => $datefrom,
'bill_dateto' => $dateto,
'bill_type' => $type,
'bill_allowed' => $allowed,
'bill_used' => $used,
'bill_overuse' => $overuse,
'bill_percent' => $percent,
'bill_id' => $bill['bill_id'],
'traf_total' => $rate_data['total_data'],
'traf_in' => $rate_data['total_data_in'],
'traf_out' => $rate_data['total_data_out'],
'bill_datefrom' => $datefrom,
'bill_dateto' => $dateto,
'bill_type' => $type,
'bill_allowed' => $allowed,
'bill_used' => $used,
'bill_overuse' => $overuse,
'bill_percent' => $percent,
'bill_id' => $bill['bill_id'],
];
dbInsert($update, 'bill_history');
echo ' Generated history! ';

View File

@ -163,9 +163,9 @@ return [
],
'testing_memory' => [
'driver' => 'sqlite',
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
'prefix' => '',
'foreign_key_constraints' => true,
],

View File

@ -42,11 +42,11 @@
|
*/
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '', // Instance of StorageInterface for custom driver
'provider' => '', // Instance of StorageInterface for custom driver
],
/*
@ -111,27 +111,27 @@
*/
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => true, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => true, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'mail' => true, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
],
/*
@ -148,14 +148,14 @@
'show_name' => true, // Also show the users name/email in the debugbar
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
'hints' => true, // Show hints for common mistakes
],
'mail' => [
'full_log' => false,

View File

@ -17,37 +17,37 @@
*/
return [
'encoding' => 'UTF-8',
'finalize' => true,
'ignoreNonStrings' => false,
'cachePath' => storage_path('app/purifier'),
'cacheFileMode' => 0755,
'settings' => [
'encoding' => 'UTF-8',
'finalize' => true,
'ignoreNonStrings' => false,
'cachePath' => storage_path('app/purifier'),
'cacheFileMode' => 0755,
'settings' => [
'default' => [
'HTML.Doctype' => 'HTML 4.01 Transitional',
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'HTML.Doctype' => 'HTML 4.01 Transitional',
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'AutoFormat.AutoParagraph' => true,
'AutoFormat.RemoveEmpty' => true,
'AutoFormat.RemoveEmpty' => true,
],
'notification' => [
'HTML.Allowed' => 'a,b,i,ul,ol,li,h1,h2,h3,h4,br,p,pre',
'HTML.Allowed' => 'a,b,i,ul,ol,li,h1,h2,h3,h4,br,p,pre',
],
'widget' => [
'HTML.Allowed' => 'b,iframe[frameborder|src|width|height],i,ul,ol,li,h1,h2,h3,h4,br,p,pre',
'HTML.Trusted' => true,
'HTML.Allowed' => 'b,iframe[frameborder|src|width|height],i,ul,ol,li,h1,h2,h3,h4,br,p,pre',
'HTML.Trusted' => true,
'HTML.SafeIframe' => true,
'URI.SafeIframeRegexp' => '%^(https?:)?//%',
],
'test' => [
'test' => [
'Attr.EnableID' => 'true',
],
'youtube' => [
'HTML.SafeIframe' => 'true',
'HTML.SafeIframe' => 'true',
'URI.SafeIframeRegexp' => '%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%',
],
'custom_definition' => [
'id' => 'html5-definitions',
'id' => 'html5-definitions',
'rev' => 1,
'debug' => false,
'elements' => [

View File

@ -18,7 +18,7 @@ class DeviceGroupFactory extends Factory
return [
'name' => $this->faker->domainWord(),
'desc' => $this->faker->text(255),
'type' =>'static',
'type' => 'static',
];
}
}

View File

@ -12,11 +12,11 @@ $init_modules = ['web', 'auth'];
require realpath(__DIR__ . '/..') . '/includes/init.php';
$urlargs = [
'type' => 'bill_historictransfer',
'id' => $_GET['bill_id'],
'width' => $_GET['x'],
'height' => $_GET['y'],
'imgtype' => $_GET['type'],
'type' => 'bill_historictransfer',
'id' => $_GET['bill_id'],
'width' => $_GET['x'],
'height' => $_GET['y'],
'imgtype' => $_GET['type'],
];
if (is_numeric($_GET['bill_hist_id'])) {
$urlargs['bill_hist_id'] = $_GET['bill_hist_id'];

View File

@ -15,10 +15,10 @@ $init_modules = ['web', 'auth'];
require realpath(__DIR__ . '/..') . '/includes/init.php';
$urlargs = [
'type' => 'bill_historicbits',
'id' => $_GET['bill_id'],
'width' => $_GET['x'],
'height' => $_GET['y'],
'type' => 'bill_historicbits',
'id' => $_GET['bill_id'],
'width' => $_GET['x'],
'height' => $_GET['y'],
];
if (isset($_GET['bill_hist_id'])) {
$urlargs['bill_hist_id'] = $_GET['bill_hist_id'];

View File

@ -7,7 +7,7 @@ if (Auth::user()->hasGlobalRead()) {
$perms_sql = '`D`.`device_id` IN ' . dbGenPlaceholders(count($device_ids));
$data['active_count'] = [
'query' => 'SELECT COUNT(`alerts`.`id`) FROM `alerts` LEFT JOIN `devices` ON `alerts`.`device_id`=`devices`.`device_id` RIGHT JOIN `alert_rules` ON `alerts`.`rule_id`=`alert_rules`.`id` WHERE $perms_sql AND `alerts`.`state` NOT IN (0,2) AND `devices`.`disabled` = 0 AND `devices`.`ignore` = 0',
'query' => 'SELECT COUNT(`alerts`.`id`) FROM `alerts` LEFT JOIN `devices` ON `alerts`.`device_id`=`devices`.`device_id` RIGHT JOIN `alert_rules` ON `alerts`.`rule_id`=`alert_rules`.`id` WHERE $perms_sql AND `alerts`.`state` NOT IN (0,2) AND `devices`.`disabled` = 0 AND `devices`.`ignore` = 0',
'params' => $device_ids,
];
}

View File

@ -15,27 +15,27 @@ if (Auth::user()->hasGlobalRead()) {
$perms_sql = '`D`.`device_id` IN ' . dbGenPlaceholders(count($device_ids));
$data['count'] = [
'query' => 'SELECT COUNT(*) FROM devices AS D WHERE $perms_sql',
'query' => 'SELECT COUNT(*) FROM devices AS D WHERE $perms_sql',
'params' => $device_ids,
];
$data['up'] = [
'query' => "SELECT COUNT(*) FROM devices AS D WHERE $perms_sql AND D.`status` = '1' AND D.`ignore` = '0' AND D.`disabled` = '0'",
'query' => "SELECT COUNT(*) FROM devices AS D WHERE $perms_sql AND D.`status` = '1' AND D.`ignore` = '0' AND D.`disabled` = '0'",
'params' => $device_ids,
];
$data['down'] = [
'query' => "SELECT COUNT(*) FROM devices AS D WHERE $perms_sql AND D.`status` = '0' AND D.`ignore` = '0' AND D.`disabled` = '0'",
'query' => "SELECT COUNT(*) FROM devices AS D WHERE $perms_sql AND D.`status` = '0' AND D.`ignore` = '0' AND D.`disabled` = '0'",
'params' => $device_ids,
];
$data['ignored'] = [
'query' => "SELECT COUNT(*) FROM devices AS D WHERE $perms_sql AND D.`ignore` = '1' AND D.`disabled` = '0'",
'query' => "SELECT COUNT(*) FROM devices AS D WHERE $perms_sql AND D.`ignore` = '1' AND D.`disabled` = '0'",
'params' => $device_ids,
];
$data['disabled'] = [
'query' => "SELECT COUNT(*) FROM devices AS D WHERE $perms_sql AND D.`disabled` = '1'",
'query' => "SELECT COUNT(*) FROM devices AS D WHERE $perms_sql AND D.`disabled` = '1'",
'params' => $device_ids,
];
}//end if

View File

@ -21,24 +21,24 @@
* @license GPL
*/
$data['count'] = [
'query' => 'select count(notifications.notifications_id) from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?)',
'query' => 'select count(notifications.notifications_id) from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?)',
'params' => [Auth::id()],
];
$data['unread'] = [
'query' => 'select notifications.* from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?) order by notifications.notifications_id desc',
'query' => 'select notifications.* from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?) order by notifications.notifications_id desc',
'params' => [Auth::id()],
];
$data['sticky'] = [
'query' => 'select notifications.*,notifications_attribs.user_id from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.key = "sticky" && notifications_attribs.value = 1 order by notifications_attribs.attrib_id desc',
'query' => 'select notifications.*,notifications_attribs.user_id from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.key = "sticky" && notifications_attribs.value = 1 order by notifications_attribs.attrib_id desc',
];
$data['sticky_count'] = [
'query' => 'select count(notifications.notifications_id) from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.key = "sticky" && notifications_attribs.value = 1',
'query' => 'select count(notifications.notifications_id) from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.key = "sticky" && notifications_attribs.value = 1',
];
$data['read'] = [
'query' => 'select notifications.* from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.user_id = ? && ( notifications_attribs.key = "read" && notifications_attribs.value = 1) && not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.key = "sticky" && notifications_attribs.value = "1") order by notifications_attribs.attrib_id desc',
'query' => 'select notifications.* from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.user_id = ? && ( notifications_attribs.key = "read" && notifications_attribs.value = 1) && not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.key = "sticky" && notifications_attribs.value = "1") order by notifications_attribs.attrib_id desc',
'params' => [Auth::id()],
];

View File

@ -17,32 +17,32 @@ if (Auth::user()->hasGlobalRead()) {
$perms_sql = '`I`.`port_id` IN ' . dbGenPlaceholders(count($device_ids));
$data['count'] = [
'query' => "SELECT COUNT(*) FROM ports AS I WHERE $perms_sql AND I.`deleted` = '0'",
'query' => "SELECT COUNT(*) FROM ports AS I WHERE $perms_sql AND I.`deleted` = '0'",
'params' => $device_ids,
];
$data['up'] = [
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'up'",
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'up'",
'params' => $device_ids,
];
$data['down'] = [
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` <> 'up' AND I.`ifAdminStatus` = 'up'",
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` <> 'up' AND I.`ifAdminStatus` = 'up'",
'params' => $device_ids,
];
$data['shutdown'] = [
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifAdminStatus` = 'down'",
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifAdminStatus` = 'down'",
'params' => $device_ids,
];
$data['errored'] = [
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')",
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')",
'params' => $device_ids,
];
$data['ignored'] = [
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND (I.`ignore` = '1' OR D.`ignore` = '1')",
'query' => "SELECT COUNT(*) FROM ports AS I, devices AS D WHERE $perms_sql AND I.`deleted` = '0' AND I.`device_id` = D.`device_id` AND (I.`ignore` = '1' OR D.`ignore` = '1')",
'params' => $device_ids,
];
}//end if

View File

@ -11,27 +11,27 @@ if (Auth::user()->hasGlobalRead()) {
$perms_sql = '`S`.`device_id` IN ' . dbGenPlaceholders(count($device_ids));
$data['count'] = [
'query' => 'SELECT COUNT(*) FROM services AS S WHERE $perms_sql',
'query' => 'SELECT COUNT(*) FROM services AS S WHERE $perms_sql',
'params' => $device_ids,
];
$data['up'] = [
'query' => "SELECT COUNT(*) FROM services AS S WHERE $perms_sql AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0'",
'query' => "SELECT COUNT(*) FROM services AS S WHERE $perms_sql AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0'",
'params' => $device_ids,
];
$data['down'] = [
'query' => "SELECT COUNT(*) FROM services AS S WHERE $perms_sql AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '2'",
'query' => "SELECT COUNT(*) FROM services AS S WHERE $perms_sql AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '2'",
'params' => $device_ids,
];
$data['ignored'] = [
'query' => "SELECT COUNT(*) FROM services AS S WHERE $perms_sql AND S.`service_ignore` = '1' AND S.`service_disabled` = '0'",
'query' => "SELECT COUNT(*) FROM services AS S WHERE $perms_sql AND S.`service_ignore` = '1' AND S.`service_disabled` = '0'",
'params' => $device_ids,
];
$data['disabled'] = [
'query' => "SELECT COUNT(*) FROM services AS S WHERE $perms_sql AND S.`service_disabled` = '1'",
'query' => "SELECT COUNT(*) FROM services AS S WHERE $perms_sql AND S.`service_disabled` = '1'",
'params' => $device_ids,
];
}//end if

View File

@ -7,7 +7,7 @@ if (Auth::user()->hasGlobalRead()) {
$perms_sql = '`printer_supplies`.`device_id` IN ' . dbGenPlaceholders(count($device_ids));
$data['count'] = [
'query' => "SELECT COUNT(`supply_id`) FROM printer_supplies WHERE $perms_sql",
'query' => "SELECT COUNT(`supply_id`) FROM printer_supplies WHERE $perms_sql",
'params' => $device_ids,
];
}

View File

@ -511,7 +511,7 @@ function get_ports_mapped($device_id, $with_statistics = false)
$ports = [];
$maps = [
'ifIndex' => [],
'ifName' => [],
'ifName' => [],
'ifDescr' => [],
];
@ -537,7 +537,7 @@ function get_ports_mapped($device_id, $with_statistics = false)
return [
'ports' => $ports,
'maps' => $maps,
'maps' => $maps,
];
}
@ -648,6 +648,7 @@ function ResolveGlues($tables, $target, $x = 0, $hist = [], $last = [])
}
}
}
//You should never get here.
return false;
}

View File

@ -77,9 +77,9 @@ foreach (DeviceCache::getPrimary()->getVrfContexts() as $context_name) {
} elseif (isset($interface['port_id'])) {
d_echo("$raw_mac => $ip\n", '+');
$insert_data[] = [
'port_id' => $port_id,
'device_id' => $device['device_id'],
'mac_address' => $mac,
'port_id' => $port_id,
'device_id' => $device['device_id'],
'mac_address' => $mac,
'ipv4_address' => $ip,
'context_name' => (string) $context_name,
];

View File

@ -15,7 +15,7 @@ if ($device['os_group'] == 'cisco') {
$module = 'Cisco-CBQOS';
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id'], ['type'=>$module]);
$components = $component->getComponents($device['device_id'], ['type' => $module]);
// We only care about our device id.
$components = $components[$device['device_id']];

View File

@ -59,7 +59,7 @@ if ($device['os_group'] == 'cisco') {
$module = 'Cisco-OTV';
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id'], ['type'=>$module]);
$components = $component->getComponents($device['device_id'], ['type' => $module]);
// We only care about our device id.
$components = $components[$device['device_id']];

View File

@ -36,15 +36,15 @@ if (Config::get('enable_pseudowires') && $device['os_group'] == 'cisco') {
} else {
$pseudowire_id = dbInsert(
[
'device_id' => $device['device_id'],
'port_id' => $if_id,
'device_id' => $device['device_id'],
'port_id' => $if_id,
'peer_device_id' => $cpw_remote_device,
'peer_ldp_id' => $cpw_remote_id,
'cpwVcID' => $pw['cpwVcID'],
'cpwOid' => $pw_id,
'pw_type' => $pw['cpwVcType'],
'pw_descr' => $pw['cpwVcDescr'],
'pw_psntype' => $pw['cpwVcPsnType'],
'peer_ldp_id' => $cpw_remote_id,
'cpwVcID' => $pw['cpwVcID'],
'cpwOid' => $pw_id,
'pw_type' => $pw['cpwVcType'],
'pw_descr' => $pw['cpwVcDescr'],
'pw_psntype' => $pw['cpwVcPsnType'],
],
'pseudowires'
);

View File

@ -43,7 +43,7 @@ if ($device['os_group'] == 'cisco') {
* Get module's components for a device
*/
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id'], ['type'=>$module]);
$components = $component->getComponents($device['device_id'], ['type' => $module]);
$components = $components[$device['device_id']];
/*

View File

@ -4,11 +4,11 @@ $physical_name = snmpwalk_cache_multi_oid($device, 'sysObjectID.0', $physical_na
$serial_number = snmpwalk_cache_multi_oid($device, 'axosSystemChassisSerialNumber', $serial_number, 'Axos-System-MIB');
$physical_index = 1;
$entity_array[1] = [
'entPhysicalIndex' => $physical_index,
'entPhysicalIndex' => $physical_index,
'entPhysicalDescr' => $physical_name[0]['sysObjectID'],
'entPhysicalVendorType' => 'Calix',
'entPhysicalContainedIn' => '0',
'entPhysicalClass' => 'chassis',
'entPhysicalClass' => 'chassis',
'entPhysicalParentRelPos' => '-1',
'entPhysicalName' => $physical_name[0]['sysObjectID'],
'entPhysicalSerialNum' => $serial_number[0]['axosSystemChassisSerialNumber'],
@ -21,15 +21,15 @@ foreach ($card_array as $card) {
$physical_index++;
// Discover the card
$entity_array[] = [
'entPhysicalIndex' => $physical_index,
'entPhysicalDescr' => "Calix {$card['axosCardActualType']}",
'entPhysicalClass' => 'container',
'entPhysicalModelName' => $card['axosCardPartNumber'],
'entPhysicalSerialNum' => $card['axosCardSerialNumber'],
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $card['axosCardSlot'],
'entPhysicalSoftwareRev' => $card['axosCardSoftwareVersion'],
'entPhysicalIsFRU' => true,
'entPhysicalIndex' => $physical_index,
'entPhysicalDescr' => "Calix {$card['axosCardActualType']}",
'entPhysicalClass' => 'container',
'entPhysicalModelName' => $card['axosCardPartNumber'],
'entPhysicalSerialNum' => $card['axosCardSerialNumber'],
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $card['axosCardSlot'],
'entPhysicalSoftwareRev' => $card['axosCardSoftwareVersion'],
'entPhysicalIsFRU' => true,
];
}

View File

@ -108,55 +108,55 @@ foreach ($chassis_array as $cienaCesChassis => $chassis_contents) {
// as far as I know, there can only be 1 chassis, but iterate just in case
$chassisIndex = $cienaCesChassis + 1;
$entity_array[] = [
'entPhysicalIndex' => $chassisIndex,
'entPhysicalDescr' => $chassis_contents['cienaCesChassisPlatformDesc'],
'entPhysicalClass' => 'chassis',
'entPhysicalName' => 'Chassis',
'entPhysicalModelName' => $chassis_contents['cienaCesChassisPartNumber'],
'entPhysicalSerialNum' => $chassis_contents['cienaCesChassisSerialNumber'],
'entPhysicalContainedIn' => '0',
'entPhysicalMfgName' => 'Ciena',
'entPhysicalIndex' => $chassisIndex,
'entPhysicalDescr' => $chassis_contents['cienaCesChassisPlatformDesc'],
'entPhysicalClass' => 'chassis',
'entPhysicalName' => 'Chassis',
'entPhysicalModelName' => $chassis_contents['cienaCesChassisPartNumber'],
'entPhysicalSerialNum' => $chassis_contents['cienaCesChassisSerialNumber'],
'entPhysicalContainedIn' => '0',
'entPhysicalMfgName' => 'Ciena',
'entPhysicalParentRelPos' => '-1',
'entPhysicalHardwareRev' => $chassis_contents['cienaCesChassisIDPModelRevision'],
'entPhysicalIsFRU' => 'true',
'entPhysicalHardwareRev' => $chassis_contents['cienaCesChassisIDPModelRevision'],
'entPhysicalIsFRU' => 'true',
];
$entity_array[] = [
'entPhysicalIndex' => "40$chassisIndex",
'entPhysicalClass' => 'container',
'entPhysicalName' => 'Modules',
'entPhysicalContainedIn' => $chassisIndex,
'entPhysicalIndex' => "40$chassisIndex",
'entPhysicalClass' => 'container',
'entPhysicalName' => 'Modules',
'entPhysicalContainedIn' => $chassisIndex,
'entPhysicalParentRelPos' => -1,
];
$entity_array[] = [
'entPhysicalIndex' => "41$chassisIndex",
'entPhysicalClass' => 'container',
'entPhysicalName' => 'Power Supplies',
'entPhysicalContainedIn' => $chassisIndex,
'entPhysicalIndex' => "41$chassisIndex",
'entPhysicalClass' => 'container',
'entPhysicalName' => 'Power Supplies',
'entPhysicalContainedIn' => $chassisIndex,
'entPhysicalParentRelPos' => -1,
];
$entity_array[] = [
'entPhysicalIndex' => "42$chassisIndex",
'entPhysicalClass' => 'container',
'entPhysicalName' => 'Fans',
'entPhysicalContainedIn' => $chassisIndex,
'entPhysicalIndex' => "42$chassisIndex",
'entPhysicalClass' => 'container',
'entPhysicalName' => 'Fans',
'entPhysicalContainedIn' => $chassisIndex,
'entPhysicalParentRelPos' => -1,
];
}
foreach ($cienaCesChassisPowerModule as $index => $contents) {
$entity_array[] = [
'entPhysicalIndex' => "50$index",
'entPhysicalDescr' => $contents['cienaCesChassisPowerSupplyManufacturer'],
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesChassisPowerSupplySlotName'],
'entPhysicalModelName' => $contents['cienaCesChassisPowerSupplyPartNum'],
'entPhysicalSerialNum' => $contents['cienaCesChassisPowerSupplySerialNumber'],
'entPhysicalContainedIn' => '41' . $contents['cienaCesChassisPowerSupplyChassisIndx'],
'entPhysicalMfgName' => 'Ciena',
'entPhysicalIndex' => "50$index",
'entPhysicalDescr' => $contents['cienaCesChassisPowerSupplyManufacturer'],
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesChassisPowerSupplySlotName'],
'entPhysicalModelName' => $contents['cienaCesChassisPowerSupplyPartNum'],
'entPhysicalSerialNum' => $contents['cienaCesChassisPowerSupplySerialNumber'],
'entPhysicalContainedIn' => '41' . $contents['cienaCesChassisPowerSupplyChassisIndx'],
'entPhysicalMfgName' => 'Ciena',
'entPhysicalParentRelPos' => $contents['cienaCesChassisPowerSupplySlotIndx'],
'entPhysicalHardwareRev' => $contents['cienaCesChassisPowerSupplyRevInfo'],
'entPhysicalIsFRU' => $contents['cienaCesChassisPowerSupplyFRU'],
'ifIndex' => null,
'entPhysicalHardwareRev' => $contents['cienaCesChassisPowerSupplyRevInfo'],
'entPhysicalIsFRU' => $contents['cienaCesChassisPowerSupplyFRU'],
'ifIndex' => null,
];
}
@ -189,16 +189,16 @@ foreach ($cienaCesChassisFanTrayEntry as $index => $contents) {
}
$entity_array[] = [
'entPhysicalIndex' => "53$index",
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesChassisFanTrayName'],
'entPhysicalModelName' => 'Fan Tray',
'entPhysicalDescr' => "$typeString$modeString",
'entPhysicalSerialNum' => $contents['cienaCesChassisFanTraySerialNumber'],
'entPhysicalContainedIn' => '42' . $contents['cienaCesChassisFanTrayChassisIndx'],
'entPhysicalMfgName' => 'Ciena',
'entPhysicalIndex' => "53$index",
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesChassisFanTrayName'],
'entPhysicalModelName' => 'Fan Tray',
'entPhysicalDescr' => "$typeString$modeString",
'entPhysicalSerialNum' => $contents['cienaCesChassisFanTraySerialNumber'],
'entPhysicalContainedIn' => '42' . $contents['cienaCesChassisFanTrayChassisIndx'],
'entPhysicalMfgName' => 'Ciena',
'entPhysicalParentRelPos' => $contents['cienaCesChassisFanTraySlotIndx'],
'entPhysicalIsFRU' => ($contents['cienaCesChassisFanTrayType'] = '2') ? 'true' : 'false',
'entPhysicalIsFRU' => ($contents['cienaCesChassisFanTrayType'] = '2') ? 'true' : 'false',
];
}
@ -209,13 +209,13 @@ foreach ($cienaCesChassisFanEntry as $index => $contents) {
$fanIndex = $indexArr[1];
$entity_array[] = [
'entPhysicalIndex' => "51$fanIndex",
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesChassisFanName'],
'entPhysicalModelName' => 'Fan',
'entPhysicalContainedIn' => (isset($cienaCesChassisFanTrayEntry[$fanTray])) ?
'entPhysicalIndex' => "51$fanIndex",
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesChassisFanName'],
'entPhysicalModelName' => 'Fan',
'entPhysicalContainedIn' => (isset($cienaCesChassisFanTrayEntry[$fanTray])) ?
"53$fanTray" : '42' . $contents['cienaCesChassisFanChassisIndx'],
'entPhysicalMfgName' => 'Ciena',
'entPhysicalMfgName' => 'Ciena',
'entPhysicalParentRelPos' => $fanIndex,
];
}
@ -227,11 +227,11 @@ foreach ($cienaCesChassisFanTempEntry as $index => $contents) {
$sensorIndex = $indexArr[1];
$entity_array[] = [
'entPhysicalIndex' => "52$sensorIndex",
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesChassisFanTempName'],
'entPhysicalModelName' => 'Temp Sensor',
'entPhysicalContainedIn' => (isset($cienaCesChassisFanTrayEntry[$fanTray])) ?
'entPhysicalIndex' => "52$sensorIndex",
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesChassisFanTempName'],
'entPhysicalModelName' => 'Temp Sensor',
'entPhysicalContainedIn' => (isset($cienaCesChassisFanTrayEntry[$fanTray])) ?
"53$fanTray" : '42' . $contents['cienaCesChassisFanTempChassisIndx'],
'entPhysicalParentRelPos' => -1,
];
@ -245,17 +245,17 @@ foreach ($module_array as $index => $contents) {
$slotIndex = $indexArr[2];
$entity_array[] = [
'entPhysicalIndex' => "55$slotIndex",
'entPhysicalDescr' => $contents['cienaCesModuleDescription'] . ', ' . $contents['cienaCesModuleSwRunningRelease'],
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesModuleSlotName'] . ': ' . $contents['cienaCesModuleDescriptionBoardName'],
'entPhysicalModelName' => $contents['cienaCesModuleDescriptionBoardPartNum'],
'entPhysicalSerialNum' => $contents['cienaCesModuleDescriptionBoardSerialNum'],
'entPhysicalContainedIn' => '40' . $chassisIndex,
'entPhysicalMfgName' => 'Ciena',
'entPhysicalIndex' => "55$slotIndex",
'entPhysicalDescr' => $contents['cienaCesModuleDescription'] . ', ' . $contents['cienaCesModuleSwRunningRelease'],
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $contents['cienaCesModuleSlotName'] . ': ' . $contents['cienaCesModuleDescriptionBoardName'],
'entPhysicalModelName' => $contents['cienaCesModuleDescriptionBoardPartNum'],
'entPhysicalSerialNum' => $contents['cienaCesModuleDescriptionBoardSerialNum'],
'entPhysicalContainedIn' => '40' . $chassisIndex,
'entPhysicalMfgName' => 'Ciena',
'entPhysicalParentRelPos' => $slotIndex,
'entPhysicalFirmwareRev' => $contents['cienaCesModuleSwRunningRelease'],
'entPhysicalIsFRU' => 'true',
'entPhysicalFirmwareRev' => $contents['cienaCesModuleSwRunningRelease'],
'entPhysicalIsFRU' => 'true',
];
}
@ -265,13 +265,13 @@ foreach ($cienaCesEttpConfigEntry as $index => $contents) {
$slotIndex = ((isset($nameArr[1])) ? $nameArr[0] : 1);
$entity_array[] = [
'entPhysicalIndex' => "56$index",
'entPhysicalDescr' => $contents['cienaCesEttpConfigEttpType'],
'entPhysicalClass' => 'port',
'entPhysicalName' => $contents['cienaCesEttpConfigName'],
'entPhysicalContainedIn' => '55' . $slotIndex,
'entPhysicalIndex' => "56$index",
'entPhysicalDescr' => $contents['cienaCesEttpConfigEttpType'],
'entPhysicalClass' => 'port',
'entPhysicalName' => $contents['cienaCesEttpConfigName'],
'entPhysicalContainedIn' => '55' . $slotIndex,
'entPhysicalParentRelPos' => $index,
'ifIndex' => $portIndex,
'ifIndex' => $portIndex,
];
if (isset($cienaCesPortXcvrEntry[$index])) {
if ($cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrOperState'] != 'notPresent') {
@ -280,17 +280,17 @@ foreach ($cienaCesEttpConfigEntry as $index => $contents) {
$mfgString = ($cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrMfgDate'] != '' ?
'manufactured ' . $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrMfgDate'] . ' ' : '');
$entity_array[] = [
'entPhysicalIndex' => $portIndex,
'entPhysicalDescr' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrVendorName'] . ' ' . $wavelengthString .
'entPhysicalIndex' => $portIndex,
'entPhysicalDescr' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrVendorName'] . ' ' . $wavelengthString .
$cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrIdentiferType'] . ' transceiver ' . $mfgString,
'entPhysicalClass' => 'sensor',
'entPhysicalModelName' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrVendorPartNum'],
'entPhysicalSerialNum' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrSerialNum'],
'entPhysicalContainedIn' => "56$index",
'entPhysicalMfgName' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrVendorName'],
'entPhysicalClass' => 'sensor',
'entPhysicalModelName' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrVendorPartNum'],
'entPhysicalSerialNum' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrSerialNum'],
'entPhysicalContainedIn' => "56$index",
'entPhysicalMfgName' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrVendorName'],
'entPhysicalParentRelPos' => -1,
'entPhysicalHardwareRev' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrRevNum'],
'entPhysicalIsFRU' => 'true',
'entPhysicalHardwareRev' => $cienaCesPortXcvrEntry[$index]['cienaCesPortXcvrRevNum'],
'entPhysicalIsFRU' => 'true',
];
}
}

View File

@ -13,7 +13,7 @@
$comp_module = 'Cisco-CIMC';
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id'], ['type'=>$comp_module]);
$components = $component->getComponents($device['device_id'], ['type' => $comp_module]);
// We only care about our device id.
$components = $components[$device['device_id']];
@ -72,10 +72,10 @@ if (is_null($tblUCSObjects)) {
// Lets Set some defaults.
$entPhysicalData = [
'entPhysicalHardwareRev' => '',
'entPhysicalFirmwareRev' => '',
'entPhysicalSoftwareRev' => '',
'entPhysicalIsFRU' => 'FALSE',
'entPhysicalHardwareRev' => '',
'entPhysicalFirmwareRev' => '',
'entPhysicalSoftwareRev' => '',
'entPhysicalIsFRU' => 'FALSE',
];
switch ($tbl) {

View File

@ -38,16 +38,16 @@ foreach ($trans as $index => $data) {
}
if ($connectedto) {
$entity_array[] = [
'entPhysicalIndex' => $index,
'entPhysicalDescr' => $data['eltPhdTransceiverInfoType'],
'entPhysicalClass' => 'sfp-cage',
'entPhysicalName' => strtoupper($data['eltPhdTransceiverInfoConnectorType']),
'entPhysicalModelName' => \LibreNMS\OS\EltexMes23xx::normData($data['eltPhdTransceiverInfoPartNumber']),
'entPhysicalSerialNum' => $data['eltPhdTransceiverInfoSerialNumber'],
'entPhysicalContainedIn' => $connectedto,
'entPhysicalMfgName' => $data['eltPhdTransceiverInfoVendorName'],
'entPhysicalHardwareRev' => \LibreNMS\OS\EltexMes23xx::normData($data['eltPhdTransceiverInfoVendorRev']),
'entPhysicalIsFRU' => 'true',
'entPhysicalIndex' => $index,
'entPhysicalDescr' => $data['eltPhdTransceiverInfoType'],
'entPhysicalClass' => 'sfp-cage',
'entPhysicalName' => strtoupper($data['eltPhdTransceiverInfoConnectorType']),
'entPhysicalModelName' => \LibreNMS\OS\EltexMes23xx::normData($data['eltPhdTransceiverInfoPartNumber']),
'entPhysicalSerialNum' => $data['eltPhdTransceiverInfoSerialNumber'],
'entPhysicalContainedIn' => $connectedto,
'entPhysicalMfgName' => $data['eltPhdTransceiverInfoVendorName'],
'entPhysicalHardwareRev' => \LibreNMS\OS\EltexMes23xx::normData($data['eltPhdTransceiverInfoVendorRev']),
'entPhysicalIsFRU' => 'true',
];
}
}

View File

@ -269,24 +269,24 @@ foreach ($entity_array as $entPhysicalIndex => $entry) {
// List of real names for cisco entities
$entPhysicalVendorTypes = [
'cevC7xxxIo1feTxIsl' => 'C7200-IO-FE-MII',
'cevC7xxxIo1feTxIsl' => 'C7200-IO-FE-MII',
'cevChassis7140Dualfe' => 'C7140-2FE',
'cevChassis7204' => 'C7204',
'cevChassis7204Vxr' => 'C7204VXR',
'cevChassis7206' => 'C7206',
'cevChassis7206Vxr' => 'C7206VXR',
'cevCpu7200Npe200' => 'NPE-200',
'cevCpu7200Npe225' => 'NPE-225',
'cevCpu7200Npe300' => 'NPE-300',
'cevCpu7200Npe400' => 'NPE-400',
'cevCpu7200Npeg1' => 'NPE-G1',
'cevCpu7200Npeg2' => 'NPE-G2',
'cevPa1feTxIsl' => 'PA-FE-TX-ISL',
'cevPa2feTxI82543' => 'PA-2FE-TX',
'cevPa8e' => 'PA-8E',
'cevPaA8tX21' => 'PA-8T-X21',
'cevMGBIC1000BaseLX' => '1000BaseLX GBIC',
'cevPort10GigBaseLR' => '10GigBaseLR',
'cevChassis7204' => 'C7204',
'cevChassis7204Vxr' => 'C7204VXR',
'cevChassis7206' => 'C7206',
'cevChassis7206Vxr' => 'C7206VXR',
'cevCpu7200Npe200' => 'NPE-200',
'cevCpu7200Npe225' => 'NPE-225',
'cevCpu7200Npe300' => 'NPE-300',
'cevCpu7200Npe400' => 'NPE-400',
'cevCpu7200Npeg1' => 'NPE-G1',
'cevCpu7200Npeg2' => 'NPE-G2',
'cevPa1feTxIsl' => 'PA-FE-TX-ISL',
'cevPa2feTxI82543' => 'PA-2FE-TX',
'cevPa8e' => 'PA-8E',
'cevPaA8tX21' => 'PA-8T-X21',
'cevMGBIC1000BaseLX' => '1000BaseLX GBIC',
'cevPort10GigBaseLR' => '10GigBaseLR',
];
if (! empty($entPhysicalVendorTypes[$entPhysicalVendorType]) && ! $entPhysicalModelName) {

View File

@ -5,15 +5,15 @@ $id = 1;
foreach ($chassis_array as $chassis_contents) {
// Discover the chassis
$entity_array[] = [
'entPhysicalIndex' => $id++,
'entPhysicalDescr' => "Eurostore {$chassis_contents['siModel']}",
'entPhysicalClass' => 'chassis',
'entPhysicalModelName' => $chassis_contents['siModel'],
'entPhysicalSerialNum' => $chassis_contents['siSerial'],
'entPhysicalContainedIn' => '0',
'entPhysicalVendorType' => $chassis_contents['siVendor'],
'entPhysicalHardwareRev' => $chassis_contents['siBootVer'],
'entPhysicalFirmwareRev' => $chassis_contents['siFirmVer'],
'entPhysicalIndex' => $id++,
'entPhysicalDescr' => "Eurostore {$chassis_contents['siModel']}",
'entPhysicalClass' => 'chassis',
'entPhysicalModelName' => $chassis_contents['siModel'],
'entPhysicalSerialNum' => $chassis_contents['siSerial'],
'entPhysicalContainedIn' => '0',
'entPhysicalVendorType' => $chassis_contents['siVendor'],
'entPhysicalHardwareRev' => $chassis_contents['siBootVer'],
'entPhysicalFirmwareRev' => $chassis_contents['siFirmVer'],
];
}
@ -27,10 +27,10 @@ for ($i = 1; $i <= 8; $i++) {
$backplane_id = $id++;
// Discover the chassis
$entity_array[] = [
'entPhysicalIndex' => $backplane_id,
'entPhysicalDescr' => $backplane_contents['hwEnclosure0' . $i . 'Description'],
'entPhysicalClass' => 'backplane',
'entPhysicalContainedIn' => '1',
'entPhysicalIndex' => $backplane_id,
'entPhysicalDescr' => $backplane_contents['hwEnclosure0' . $i . 'Description'],
'entPhysicalClass' => 'backplane',
'entPhysicalContainedIn' => '1',
'entPhysicalParentRelPos' => $i,
];
@ -39,16 +39,16 @@ for ($i = 1; $i <= 8; $i++) {
foreach ($hdd_array as $hdd_contents) {
// Discover the chassis
$entity_array[] = [
'entPhysicalContainedIn' => $backplane_id,
'entPhysicalIndex' => $id++,
'entPhysicalDescr' => $hdd_contents['hddEnclosure0' . $i . 'Desc'],
'entPhysicalClass' => 'container',
'entPhysicalContainedIn' => $backplane_id,
'entPhysicalIndex' => $id++,
'entPhysicalDescr' => $hdd_contents['hddEnclosure0' . $i . 'Desc'],
'entPhysicalClass' => 'container',
'entPhysicalParentRelPos' => $hdd_contents['hddEnclosure0' . $i . 'Slots'],
'entPhysicalName' => $hdd_contents['hddEnclosure0' . $i . 'Name'],
'entPhysicalSerialNum' => $hdd_contents['hddEnclosure0' . $i . 'Serial'],
'entPhysicalFirmwareRev' => $hdd_contents['hddEnclosure0' . $i . 'FrimVer'],
'entPhysicalIsFRU' => 'true',
'entPhysicalAlias' => $hdd_contents['hddEnclosure0' . $i . 'State'],
'entPhysicalName' => $hdd_contents['hddEnclosure0' . $i . 'Name'],
'entPhysicalSerialNum' => $hdd_contents['hddEnclosure0' . $i . 'Serial'],
'entPhysicalFirmwareRev' => $hdd_contents['hddEnclosure0' . $i . 'FrimVer'],
'entPhysicalIsFRU' => 'true',
'entPhysicalAlias' => $hdd_contents['hddEnclosure0' . $i . 'State'],
];
}
}

View File

@ -9,59 +9,59 @@ $entity_array = [];
foreach ($controller_array as $controller) {
// Discover the chassis
$entity_array[] = [
'entPhysicalIndex' => 200 + $controller['adapterID-AIT'],
'entPhysicalIndex' => 200 + $controller['adapterID-AIT'],
'entPhysicalParentRelPos' => $controller['adapterID-AIT'],
'entPhysicalDescr' => '/C' . $controller['adapterID-AIT'],
'entPhysicalClass' => 'port',
'entPhysicalModelName' => $controller['productName'],
'entPhysicalSerialNum' => $controller['serialNo'],
'entPhysicalContainedIn' => '0',
'entPhysicalVendorType' => $controller['adapterVendorID'],
'entPhysicalFirmwareRev' => $controller['firmwareVersion'],
'entPhysicalDescr' => '/C' . $controller['adapterID-AIT'],
'entPhysicalClass' => 'port',
'entPhysicalModelName' => $controller['productName'],
'entPhysicalSerialNum' => $controller['serialNo'],
'entPhysicalContainedIn' => '0',
'entPhysicalVendorType' => $controller['adapterVendorID'],
'entPhysicalFirmwareRev' => $controller['firmwareVersion'],
];
}
foreach ($bbus as $bbu) {
// Discover the chassis
$entity_array[] = [
'entPhysicalIndex' => 1000 + $bbu['pdIndex'],
'entPhysicalClass' => 'charge',
'entPhysicalModelName' => $bbu['deviceName'],
'entPhysicalSerialNum' => $bbu['serialNumber'],
'entPhysicalContainedIn' => 200 + $bbu['adpID'],
'entPhysicalIsFRU' => 'true',
'entPhysicalFirmwareRev' => $bbu['firmwareStatus'],
'entPhysicalIndex' => 1000 + $bbu['pdIndex'],
'entPhysicalClass' => 'charge',
'entPhysicalModelName' => $bbu['deviceName'],
'entPhysicalSerialNum' => $bbu['serialNumber'],
'entPhysicalContainedIn' => 200 + $bbu['adpID'],
'entPhysicalIsFRU' => 'true',
'entPhysicalFirmwareRev' => $bbu['firmwareStatus'],
];
}
foreach ($enclosures as $enclosure) {
// Discover the chassis
$entity_array[] = [
'entPhysicalIndex' => 210 + $enclosure['deviceId'],
'entPhysicalMfgName' => $enclosure['slotCount'],
'entPhysicalIndex' => 210 + $enclosure['deviceId'],
'entPhysicalMfgName' => $enclosure['slotCount'],
'entPhysicalParentRelPos' => $enclosure['deviceId'],
'entPhysicalDescr' => '/C' . $enclosure['adapterID-CDIT'] . '/E' . $enclosure['deviceId'],
'entPhysicalClass' => 'chassis',
'entPhysicalModelName' => $enclosure['productID'],
'entPhysicalSerialNum' => $enclosure['enclSerialNumber'],
'entPhysicalContainedIn' => 200 + $enclosure['adapterID-CDIT'],
'entPhysicalVendorType' => $enclosure['adapterVendorID'],
'entPhysicalFirmwareRev' => $enclosure['firmwareVersion'],
'entPhysicalDescr' => '/C' . $enclosure['adapterID-CDIT'] . '/E' . $enclosure['deviceId'],
'entPhysicalClass' => 'chassis',
'entPhysicalModelName' => $enclosure['productID'],
'entPhysicalSerialNum' => $enclosure['enclSerialNumber'],
'entPhysicalContainedIn' => 200 + $enclosure['adapterID-CDIT'],
'entPhysicalVendorType' => $enclosure['adapterVendorID'],
'entPhysicalFirmwareRev' => $enclosure['firmwareVersion'],
];
}
foreach ($drives as $drive) {
// Discover the chassis
$entity_array[] = [
'entPhysicalIndex' => 500 + $drive['enclDeviceId'] * 100 + $drive['physDevID'],
'entPhysicalIndex' => 500 + $drive['enclDeviceId'] * 100 + $drive['physDevID'],
'entPhysicalParentRelPos' => $drive['slotNumber'],
'entPhysicalDescr' => '/C' . $drive['adpID-PDT'] . '/E' . $drive['enclDeviceId'] . '/S' . $drive['slotNumber'],
'entPhysicalClass' => 'drive',
'entPhysicalModelName' => $drive['pdProductID'],
'entPhysicalSerialNum' => $drive['pdSerialNumber'],
'entPhysicalContainedIn' => 210 + $drive['enclDeviceId'],
'entPhysicalIsFRU' => 'true',
'entPhysicalFirmwareRev' => $drive['pdFwversion'],
'entPhysicalDescr' => '/C' . $drive['adpID-PDT'] . '/E' . $drive['enclDeviceId'] . '/S' . $drive['slotNumber'],
'entPhysicalClass' => 'drive',
'entPhysicalModelName' => $drive['pdProductID'],
'entPhysicalSerialNum' => $drive['pdSerialNumber'],
'entPhysicalContainedIn' => 210 + $drive['enclDeviceId'],
'entPhysicalIsFRU' => 'true',
'entPhysicalFirmwareRev' => $drive['pdFwversion'],
];
}

View File

@ -21,9 +21,9 @@ $port_array = snmpwalk_cache_multi_oid($device, 'nbsCmmcPortTable', $port_array,
// We use the last digit in the OID to define an entPhysicalIndex for Power Supply state sensors
$nbsCmmcChassisPSStatus_array = [
7 => 'nbsCmmcChassisPS1Status',
8 => 'nbsCmmcChassisPS2Status',
9 => 'nbsCmmcChassisPS3Status',
7 => 'nbsCmmcChassisPS1Status',
8 => 'nbsCmmcChassisPS2Status',
9 => 'nbsCmmcChassisPS3Status',
10 => 'nbsCmmcChassisPS4Status',
];
@ -54,33 +54,33 @@ $nbsCmmcPortType_array = [
$nbsCmmcPortSensor_array = [
30 => [
'objectType' => 'nbsCmmcPortTemperature',
'skipValue' => '-2147483648',
'objectType' => 'nbsCmmcPortTemperature',
'skipValue' => '-2147483648',
'entPhysicalName' => 'Port Temperature',
],
31 => [
'objectType' => 'nbsCmmcPortTxPower',
'skipValue' => '-2147483648',
'objectType' => 'nbsCmmcPortTxPower',
'skipValue' => '-2147483648',
'entPhysicalName' => 'Port Tx Power',
],
32 => [
'objectType' => 'nbsCmmcPortRxPower',
'skipValue' => '-2147483648',
'objectType' => 'nbsCmmcPortRxPower',
'skipValue' => '-2147483648',
'entPhysicalName' => 'Port Rx Power',
],
33 => [
'objectType' => 'nbsCmmcPortBiasAmps',
'skipValue' => '-1',
'objectType' => 'nbsCmmcPortBiasAmps',
'skipValue' => '-1',
'entPhysicalName' => 'Port Tx Bias Current',
],
34 => [
'objectType' => 'nbsCmmcPortSupplyVolts',
'skipValue' => '-1',
'objectType' => 'nbsCmmcPortSupplyVolts',
'skipValue' => '-1',
'entPhysicalName' => 'Port Tx Supply Voltage',
],
38 => [
'objectType' => 'nbsCmmcPortDigitalDiags',
'skipValue' => '1',
'objectType' => 'nbsCmmcPortDigitalDiags',
'skipValue' => '1',
'entPhysicalName' => 'Port Overall DigiDiags State',
],
];
@ -89,47 +89,47 @@ foreach ($chassis_array as $nbsCmmcChassis => $chassis_contents) {
[$chassisHardwareRev, $chassisFirmwareRev] = explode(', ', $chassis_contents['nbsCmmcChassisHardwareRevision']);
// Discover the chassis
$entity_array[] = [
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'] . '00',
'entPhysicalDescr' => "MRV OptiDriver {$chassis_contents['nbsCmmcChassisModel']}",
'entPhysicalClass' => 'chassis',
'entPhysicalName' => "Chassis $nbsCmmcChassis",
'entPhysicalModelName' => $chassis_contents['nbsCmmcChassisModel'],
'entPhysicalSerialNum' => $chassis_contents['nbsCmmcChassisSerialNum'],
'entPhysicalContainedIn' => '0',
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'] . '00',
'entPhysicalDescr' => "MRV OptiDriver {$chassis_contents['nbsCmmcChassisModel']}",
'entPhysicalClass' => 'chassis',
'entPhysicalName' => "Chassis $nbsCmmcChassis",
'entPhysicalModelName' => $chassis_contents['nbsCmmcChassisModel'],
'entPhysicalSerialNum' => $chassis_contents['nbsCmmcChassisSerialNum'],
'entPhysicalContainedIn' => '0',
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => $chassis_contents['nbsCmmcChassisIndex'],
'entPhysicalVendorType' => $chassis_contents['nbsCmmcChassisType'],
'entPhysicalHardwareRev' => $chassisHardwareRev,
'entPhysicalFirmwareRev' => $chassisFirmwareRev,
'entPhysicalIsFRU' => 'true',
'entPhysicalAlias' => $chassis_contents['nbsCmmcChassisName'],
'entPhysicalVendorType' => $chassis_contents['nbsCmmcChassisType'],
'entPhysicalHardwareRev' => $chassisHardwareRev,
'entPhysicalFirmwareRev' => $chassisFirmwareRev,
'entPhysicalIsFRU' => 'true',
'entPhysicalAlias' => $chassis_contents['nbsCmmcChassisName'],
];
// Discover the chassis temperature sensor
if (isset($chassis_contents['nbsCmmcChassisTemperature']) && $chassis_contents['nbsCmmcChassisTemperature'] != '-2147483648') {
$entity_array[] = [
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}15",
'entPhysicalDescr' => 'Chassis Temperature Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Chassis Temperature',
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}15",
'entPhysicalDescr' => 'Chassis Temperature Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Chassis Temperature',
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => '-1',
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
}
// Discover the chassis power budget status sensor
if (isset($chassis_contents['nbsCmmcChassisPowerStatus']) && $chassis_contents['nbsCmmcChassisPowerStatus'] != 'notSupported') {
$entity_array[] = [
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}51",
'entPhysicalDescr' => 'Chassis Power Budget Status Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Chassis Power Budget Status',
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}51",
'entPhysicalDescr' => 'Chassis Power Budget Status Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Chassis Power Budget Status',
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => '-1',
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
}
@ -138,24 +138,24 @@ foreach ($chassis_array as $nbsCmmcChassis => $chassis_contents) {
if (isset($chassis_contents[$item]) && $chassis_contents[$item] != 'notSupported') {
$position = substr($item, 16, 1);
$entity_array[] = [
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'] . $position,
'entPhysicalDescr' => 'Power Supply',
'entPhysicalClass' => 'powerSupply',
'entPhysicalName' => "Power Supply $position",
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'] . $position,
'entPhysicalDescr' => 'Power Supply',
'entPhysicalClass' => 'powerSupply',
'entPhysicalName' => "Power Supply $position",
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => $position,
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
$entity_array[] = [
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'] . $index,
'entPhysicalDescr' => 'Power Supply State',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => "Power Supply $position",
'entPhysicalContainedIn' => $chassis_contents['nbsCmmcChassisIfIndex'] . $position,
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'] . $index,
'entPhysicalDescr' => 'Power Supply State',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => "Power Supply $position",
'entPhysicalContainedIn' => $chassis_contents['nbsCmmcChassisIfIndex'] . $position,
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => '-1',
'entPhysicalIsFRU' => 'true',
'entPhysicalIsFRU' => 'true',
];
}
}
@ -165,24 +165,24 @@ foreach ($chassis_array as $nbsCmmcChassis => $chassis_contents) {
if (isset($chassis_contents[$item]) && $chassis_contents[$item] != 'notSupported') {
$position = substr($item, 17, 1);
$entity_array[] = [
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}0$position",
'entPhysicalDescr' => 'Fan Tray',
'entPhysicalClass' => 'fan',
'entPhysicalName' => "Fan Tray $position",
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => "{$chassis_contents['nbsCmmcChassisIfIndex']}0$position",
'entPhysicalDescr' => 'Fan Tray',
'entPhysicalClass' => 'fan',
'entPhysicalName' => "Fan Tray $position",
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => $position,
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
$entity_array[] = [
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'] . $index,
'entPhysicalDescr' => 'Fan State',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => "Fan $position",
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}0$position",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => $chassis_contents['nbsCmmcChassisIfIndex'] . $index,
'entPhysicalDescr' => 'Fan State',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => "Fan $position",
'entPhysicalContainedIn' => "{$chassis_contents['nbsCmmcChassisIfIndex']}0$position",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => '-1',
'entPhysicalIsFRU' => 'true',
'entPhysicalIsFRU' => 'true',
];
}
}
@ -195,46 +195,46 @@ foreach ($slot_array as $nbsCmmcSlot => $slot_contents) {
$nbsCmmcSlotIfIndex = $nbsCmmcChassisIfIndex + $slot_contents['nbsCmmcSlotIndex'] * 1000;
// Discover the slot
$entity_array[] = [
'entPhysicalIndex' => $nbsCmmcSlotIfIndex . '00',
'entPhysicalDescr' => 'MRV OptiDriver Slot',
'entPhysicalClass' => 'container',
'entPhysicalName' => "Card Slot $nbsCmmcSlot",
'entPhysicalContainedIn' => $nbsCmmcChassisIfIndex . '00',
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => $nbsCmmcSlotIfIndex . '00',
'entPhysicalDescr' => 'MRV OptiDriver Slot',
'entPhysicalClass' => 'container',
'entPhysicalName' => "Card Slot $nbsCmmcSlot",
'entPhysicalContainedIn' => $nbsCmmcChassisIfIndex . '00',
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => $slot_contents['nbsCmmcSlotIndex'],
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
if (isset($slot_contents['nbsCmmcSlotIfIndex']) && $slot_contents['nbsCmmcSlotIfIndex'] != '-1') {
[$cardHardwareRev, $cardFirmwareRev, $cardOtherRev] = explode(', ', $slot_contents['nbsCmmcSlotHardwareRevision']);
// Discover the card
$entity_array[] = [
'entPhysicalIndex' => $slot_contents['nbsCmmcSlotIfIndex'] . '01',
'entPhysicalDescr' => 'MRV ' . ucfirst($slot_contents['nbsCmmcSlotOperationType']) . ' Card',
'entPhysicalClass' => 'module',
'entPhysicalName' => "Card $nbsCmmcSlot",
'entPhysicalModelName' => $slot_contents['nbsCmmcSlotModel'],
'entPhysicalSerialNum' => $slot_contents['nbsCmmcSlotSerialNum'],
'entPhysicalContainedIn' => "{$slot_contents['nbsCmmcSlotIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => $slot_contents['nbsCmmcSlotIfIndex'] . '01',
'entPhysicalDescr' => 'MRV ' . ucfirst($slot_contents['nbsCmmcSlotOperationType']) . ' Card',
'entPhysicalClass' => 'module',
'entPhysicalName' => "Card $nbsCmmcSlot",
'entPhysicalModelName' => $slot_contents['nbsCmmcSlotModel'],
'entPhysicalSerialNum' => $slot_contents['nbsCmmcSlotSerialNum'],
'entPhysicalContainedIn' => "{$slot_contents['nbsCmmcSlotIfIndex']}00",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => '-1',
'entPhysicalVendorType' => $slot_contents['nbsCmmcSlotType'],
'entPhysicalHardwareRev' => "$cardHardwareRev, $cardOtherRev",
'entPhysicalFirmwareRev' => $cardFirmwareRev,
'entPhysicalIsFRU' => 'true',
'entPhysicalAlias' => $slot_contents['nbsCmmcSlotName'],
'entPhysicalVendorType' => $slot_contents['nbsCmmcSlotType'],
'entPhysicalHardwareRev' => "$cardHardwareRev, $cardOtherRev",
'entPhysicalFirmwareRev' => $cardFirmwareRev,
'entPhysicalIsFRU' => 'true',
'entPhysicalAlias' => $slot_contents['nbsCmmcSlotName'],
];
// Discover the module temperature sensor
if (isset($slot_contents['nbsCmmcSlotTemperature']) && $slot_contents['nbsCmmcSlotTemperature'] != '-2147483648') {
$entity_array[] = [
'entPhysicalIndex' => "{$slot_contents['nbsCmmcSlotIfIndex']}34",
'entPhysicalDescr' => 'Card Temperature Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Card Temperature',
'entPhysicalContainedIn' => "{$slot_contents['nbsCmmcSlotIfIndex']}01",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => "{$slot_contents['nbsCmmcSlotIfIndex']}34",
'entPhysicalDescr' => 'Card Temperature Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Card Temperature',
'entPhysicalContainedIn' => "{$slot_contents['nbsCmmcSlotIfIndex']}01",
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => '-1',
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
}
}
@ -251,14 +251,14 @@ foreach ($port_array as $nbsCmmcPort => $port_contents) {
// Discover the transceiver container
$entity_array[] = [
'entPhysicalIndex' => $port_contents['nbsCmmcPortIfIndex'] . '00',
'entPhysicalDescr' => "$nbsCmmcPortType Transceiver Container",
'entPhysicalClass' => 'container',
'entPhysicalName' => "Transceiver Container $nbsCmmcPort",
'entPhysicalContainedIn' => $nbsCmmcSlotIfIndex . '01',
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalIndex' => $port_contents['nbsCmmcPortIfIndex'] . '00',
'entPhysicalDescr' => "$nbsCmmcPortType Transceiver Container",
'entPhysicalClass' => 'container',
'entPhysicalName' => "Transceiver Container $nbsCmmcPort",
'entPhysicalContainedIn' => $nbsCmmcSlotIfIndex . '01',
'entPhysicalMfgName' => 'MRV Communications',
'entPhysicalParentRelPos' => $port_contents['nbsCmmcPortIndex'],
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
// Set a few variables for the port discovery
$nbsCmmcPortContainedIn = $port_contents['nbsCmmcPortIfIndex'] . '00';
@ -293,34 +293,34 @@ foreach ($port_array as $nbsCmmcPort => $port_contents) {
// Discover the port
$entity_array[] = [
'entPhysicalIndex' => "{$port_contents['nbsCmmcPortIfIndex']}01",
'entPhysicalDescr' => $portEntPhysicalDescr,
'entPhysicalClass' => 'port',
'entPhysicalName' => "Port $nbsCmmcPort",
'entPhysicalModelName' => $nbsCmmcPortModelName,
'entPhysicalSerialNum' => $port_contents['nbsCmmcPortSerialNumber'],
'entPhysicalContainedIn' => $nbsCmmcPortContainedIn,
'entPhysicalMfgName' => $nbsCmmcPortVendorInfo,
'entPhysicalIndex' => "{$port_contents['nbsCmmcPortIfIndex']}01",
'entPhysicalDescr' => $portEntPhysicalDescr,
'entPhysicalClass' => 'port',
'entPhysicalName' => "Port $nbsCmmcPort",
'entPhysicalModelName' => $nbsCmmcPortModelName,
'entPhysicalSerialNum' => $port_contents['nbsCmmcPortSerialNumber'],
'entPhysicalContainedIn' => $nbsCmmcPortContainedIn,
'entPhysicalMfgName' => $nbsCmmcPortVendorInfo,
'entPhysicalParentRelPos' => $nbsCmmcPortParentRelPos,
'entPhysicalVendorType' => $port_contents['nbsCmmcPortType'],
'entPhysicalHardwareRev' => $nbsCmmcPortHardwareRev,
'entPhysicalIsFRU' => $nbsCmmcPortIsFRU,
'entPhysicalAlias' => $port_contents['nbsCmmcPortName'],
'ifIndex' => $port_contents['nbsCmmcPortIfIndex'],
'entPhysicalVendorType' => $port_contents['nbsCmmcPortType'],
'entPhysicalHardwareRev' => $nbsCmmcPortHardwareRev,
'entPhysicalIsFRU' => $nbsCmmcPortIsFRU,
'entPhysicalAlias' => $port_contents['nbsCmmcPortName'],
'ifIndex' => $port_contents['nbsCmmcPortIfIndex'],
];
// Discover the port sensors
foreach ($nbsCmmcPortSensor_array as $index => $nbsCmmcPortSensor) {
if (isset($port_contents[$nbsCmmcPortSensor['objectType']]) && $port_contents[$nbsCmmcPortSensor['objectType']] != $nbsCmmcPortSensor['skipValue']) {
$entity_array[] = [
'entPhysicalIndex' => $port_contents['nbsCmmcPortIfIndex'] . $index,
'entPhysicalDescr' => "{$nbsCmmcPortSensor['entPhysicalName']} Sensor",
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $nbsCmmcPortSensor['entPhysicalName'],
'entPhysicalContainedIn' => "{$port_contents['nbsCmmcPortIfIndex']}01",
'entPhysicalMfgName' => $nbsCmmcPortVendorInfo,
'entPhysicalIndex' => $port_contents['nbsCmmcPortIfIndex'] . $index,
'entPhysicalDescr' => "{$nbsCmmcPortSensor['entPhysicalName']} Sensor",
'entPhysicalClass' => 'sensor',
'entPhysicalName' => $nbsCmmcPortSensor['entPhysicalName'],
'entPhysicalContainedIn' => "{$port_contents['nbsCmmcPortIfIndex']}01",
'entPhysicalMfgName' => $nbsCmmcPortVendorInfo,
'entPhysicalParentRelPos' => '-1',
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
}
}

View File

@ -21,14 +21,14 @@ d_echo($modules_array);
// Create a fake Chassis to host the modules we discover
$entity_array[] = [
'entPhysicalIndex' => '10',
'entPhysicalDescr' => 'Chassis',
'entPhysicalClass' => 'chassis',
'entPhysicalName' => 'Chassis',
'entPhysicalModelName' => 'Infra93',
'entPhysicalContainedIn' => '0',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalIsFRU' => 'false',
'entPhysicalIndex' => '10',
'entPhysicalDescr' => 'Chassis',
'entPhysicalClass' => 'chassis',
'entPhysicalName' => 'Chassis',
'entPhysicalModelName' => 'Infra93',
'entPhysicalContainedIn' => '0',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalIsFRU' => 'false',
];
// Fill the different modules the "entPhysical" way to have a correct display.
@ -36,86 +36,86 @@ $entity_array[] = [
// this code would need to be adapted with loops
if (isset($modules_array[0]) and isset($modules_array[0]['fpInfoProductCode'])) {
$entity_array[] = [
'entPhysicalIndex' => '11',
'entPhysicalDescr' => 'Front Panel',
'entPhysicalClass' => 'module',
'entPhysicalName' => 'Front Panel',
'entPhysicalModelName' => $modules_array[0]['fpInfoProductCode'],
'entPhysicalSerialNum' => $modules_array[0]['fpInfoSerialNumber'],
'entPhysicalContainedIn' => '10',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalHardwareRev' => $modules_array[0]['fpInfoHardwareVersion'],
'entPhysicalFirmwareRev' => $modules_array[0]['fpInfoFirmwareVersion'],
'entPhysicalIsFRU' => 'true',
'entPhysicalIndex' => '11',
'entPhysicalDescr' => 'Front Panel',
'entPhysicalClass' => 'module',
'entPhysicalName' => 'Front Panel',
'entPhysicalModelName' => $modules_array[0]['fpInfoProductCode'],
'entPhysicalSerialNum' => $modules_array[0]['fpInfoSerialNumber'],
'entPhysicalContainedIn' => '10',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalHardwareRev' => $modules_array[0]['fpInfoHardwareVersion'],
'entPhysicalFirmwareRev' => $modules_array[0]['fpInfoFirmwareVersion'],
'entPhysicalIsFRU' => 'true',
];
}
if (isset($modules_array[0]) and isset($modules_array[0]['rctInfoProductCode'])) {
$entity_array[] = [
'entPhysicalIndex' => '120',
'entPhysicalDescr' => 'Reciter',
'entPhysicalClass' => 'module',
'entPhysicalName' => 'Reciter',
'entPhysicalModelName' => $modules_array[0]['rctInfoProductCode'],
'entPhysicalSerialNum' => $modules_array[0]['rctInfoSerialNumber'],
'entPhysicalContainedIn' => '10',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalHardwareRev' => $modules_array[0]['rctInfoHardwareVersion'],
'entPhysicalFirmwareRev' => $modules_array[0]['rctInfoFirmwareVersion'],
'entPhysicalIsFRU' => 'true',
'entPhysicalIndex' => '120',
'entPhysicalDescr' => 'Reciter',
'entPhysicalClass' => 'module',
'entPhysicalName' => 'Reciter',
'entPhysicalModelName' => $modules_array[0]['rctInfoProductCode'],
'entPhysicalSerialNum' => $modules_array[0]['rctInfoSerialNumber'],
'entPhysicalContainedIn' => '10',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalHardwareRev' => $modules_array[0]['rctInfoHardwareVersion'],
'entPhysicalFirmwareRev' => $modules_array[0]['rctInfoFirmwareVersion'],
'entPhysicalIsFRU' => 'true',
];
$entity_array[] = [
'entPhysicalIndex' => '1200',
'entPhysicalDescr' => 'Reciter Temperature Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Reciter Temperature',
'entPhysicalContainedIn' => '120',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalIndex' => '1200',
'entPhysicalDescr' => 'Reciter Temperature Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Reciter Temperature',
'entPhysicalContainedIn' => '120',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalParentRelPos' => '-1',
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
}
if (isset($modules_array[0]) and isset($modules_array[0]['paInfoProductCode'])) {
$entity_array[] = [
'entPhysicalIndex' => '130',
'entPhysicalDescr' => 'Power Amplifier',
'entPhysicalClass' => 'module',
'entPhysicalName' => 'Power Amplifier',
'entPhysicalModelName' => $modules_array[0]['paInfoProductCode'],
'entPhysicalSerialNum' => $modules_array[0]['paInfoSerialNumber'],
'entPhysicalContainedIn' => '10',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalHardwareRev' => $modules_array[0]['paInfoHardwareVersion'],
'entPhysicalFirmwareRev' => $modules_array[0]['paInfoFirmwareVersion'],
'entPhysicalIsFRU' => 'true',
'entPhysicalIndex' => '130',
'entPhysicalDescr' => 'Power Amplifier',
'entPhysicalClass' => 'module',
'entPhysicalName' => 'Power Amplifier',
'entPhysicalModelName' => $modules_array[0]['paInfoProductCode'],
'entPhysicalSerialNum' => $modules_array[0]['paInfoSerialNumber'],
'entPhysicalContainedIn' => '10',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalHardwareRev' => $modules_array[0]['paInfoHardwareVersion'],
'entPhysicalFirmwareRev' => $modules_array[0]['paInfoFirmwareVersion'],
'entPhysicalIsFRU' => 'true',
];
$entity_array[] = [
'entPhysicalIndex' => '1300',
'entPhysicalDescr' => 'Amplifier Power Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Output Power',
'entPhysicalContainedIn' => '130',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalIndex' => '1300',
'entPhysicalDescr' => 'Amplifier Power Sensor',
'entPhysicalClass' => 'sensor',
'entPhysicalName' => 'Output Power',
'entPhysicalContainedIn' => '130',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalParentRelPos' => '-1',
'entPhysicalIsFRU' => 'false',
'entPhysicalIsFRU' => 'false',
];
}
$entity_array[] = [
'entPhysicalIndex' => '140',
'entPhysicalDescr' => 'PMU',
'entPhysicalClass' => 'module',
'entPhysicalName' => 'PMU',
'entPhysicalModelName' => $modules_array[0]['pmuInfoProductCode'],
'entPhysicalSerialNum' => $modules_array[0]['pmuInfoSerialNumber'],
'entPhysicalContainedIn' => '10',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalIndex' => '140',
'entPhysicalDescr' => 'PMU',
'entPhysicalClass' => 'module',
'entPhysicalName' => 'PMU',
'entPhysicalModelName' => $modules_array[0]['pmuInfoProductCode'],
'entPhysicalSerialNum' => $modules_array[0]['pmuInfoSerialNumber'],
'entPhysicalContainedIn' => '10',
'entPhysicalMfgName' => 'TAIT',
'entPhysicalParentRelPos' => '',
'entPhysicalVendorType' => '',
'entPhysicalHardwareRev' => $modules_array[0]['pmuInfoHardwareVersion'],
'entPhysicalFirmwareRev' => $modules_array[0]['pmuInfoFirmwareVersion'],
'entPhysicalIsFRU' => 'true',
'entPhysicalVendorType' => '',
'entPhysicalHardwareRev' => $modules_array[0]['pmuInfoHardwareVersion'],
'entPhysicalFirmwareRev' => $modules_array[0]['pmuInfoFirmwareVersion'],
'entPhysicalIsFRU' => 'true',
];
foreach ($entity_array as $entPhysicalIndex => $entry) {

View File

@ -597,23 +597,23 @@ function discover_entity_physical(&$valid, $device, $entPhysicalIndex, $entPhysi
if ($entPhysicalDescr || $entPhysicalName) {
if (dbFetchCell('SELECT COUNT(entPhysical_id) FROM `entPhysical` WHERE `device_id` = ? AND `entPhysicalIndex` = ?', [$device['device_id'], $entPhysicalIndex]) == '0') {
$insert_data = [
'device_id' => $device['device_id'],
'entPhysicalIndex' => $entPhysicalIndex,
'entPhysicalDescr' => $entPhysicalDescr,
'entPhysicalClass' => $entPhysicalClass,
'entPhysicalName' => $entPhysicalName,
'entPhysicalModelName' => $entPhysicalModelName,
'entPhysicalSerialNum' => $entPhysicalSerialNum,
'entPhysicalContainedIn' => $entPhysicalContainedIn,
'entPhysicalMfgName' => $entPhysicalMfgName,
'device_id' => $device['device_id'],
'entPhysicalIndex' => $entPhysicalIndex,
'entPhysicalDescr' => $entPhysicalDescr,
'entPhysicalClass' => $entPhysicalClass,
'entPhysicalName' => $entPhysicalName,
'entPhysicalModelName' => $entPhysicalModelName,
'entPhysicalSerialNum' => $entPhysicalSerialNum,
'entPhysicalContainedIn' => $entPhysicalContainedIn,
'entPhysicalMfgName' => $entPhysicalMfgName,
'entPhysicalParentRelPos' => $entPhysicalParentRelPos,
'entPhysicalVendorType' => $entPhysicalVendorType,
'entPhysicalHardwareRev' => $entPhysicalHardwareRev,
'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev,
'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev,
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID,
'entPhysicalVendorType' => $entPhysicalVendorType,
'entPhysicalHardwareRev' => $entPhysicalHardwareRev,
'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev,
'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev,
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID,
];
if (! empty($ifIndex)) {
$insert_data['ifIndex'] = $ifIndex;
@ -625,23 +625,23 @@ function discover_entity_physical(&$valid, $device, $entPhysicalIndex, $entPhysi
} else {
echo '.';
$update_data = [
'entPhysicalIndex' => $entPhysicalIndex,
'entPhysicalDescr' => $entPhysicalDescr,
'entPhysicalClass' => $entPhysicalClass,
'entPhysicalName' => $entPhysicalName,
'entPhysicalModelName' => $entPhysicalModelName,
'entPhysicalSerialNum' => $entPhysicalSerialNum,
'entPhysicalContainedIn' => $entPhysicalContainedIn,
'entPhysicalMfgName' => $entPhysicalMfgName,
'entPhysicalIndex' => $entPhysicalIndex,
'entPhysicalDescr' => $entPhysicalDescr,
'entPhysicalClass' => $entPhysicalClass,
'entPhysicalName' => $entPhysicalName,
'entPhysicalModelName' => $entPhysicalModelName,
'entPhysicalSerialNum' => $entPhysicalSerialNum,
'entPhysicalContainedIn' => $entPhysicalContainedIn,
'entPhysicalMfgName' => $entPhysicalMfgName,
'entPhysicalParentRelPos' => $entPhysicalParentRelPos,
'entPhysicalVendorType' => $entPhysicalVendorType,
'entPhysicalHardwareRev' => $entPhysicalHardwareRev,
'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev,
'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev,
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID,
'ifIndex' => $ifIndex,
'entPhysicalVendorType' => $entPhysicalVendorType,
'entPhysicalHardwareRev' => $entPhysicalHardwareRev,
'entPhysicalFirmwareRev' => $entPhysicalFirmwareRev,
'entPhysicalSoftwareRev' => $entPhysicalSoftwareRev,
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID,
'ifIndex' => $ifIndex,
];
dbUpdate($update_data, 'entPhysical', '`device_id`=? AND `entPhysicalIndex`=?', [$device['device_id'], $entPhysicalIndex]);
}//end if
@ -1075,10 +1075,10 @@ function build_bgp_peers($device, $data, $peer2)
}
d_echo("Found peer $peer_ip (AS$peer_as)\n");
$peerlist[] = [
'ip' => $peer_ip,
'as' => $peer_as,
'ip' => $peer_ip,
'as' => $peer_as,
'localip' => $local_ip ?: '0.0.0.0',
'ver' => $ver,
'ver' => $ver,
];
}
}

View File

@ -17,8 +17,8 @@ if (is_array($hrDevices)) {
if (is_array($hrDevice) && isset($hrDevice['hrDeviceIndex']) && is_numeric($hrDevice['hrDeviceIndex'])) {
if (dbFetchCell('SELECT COUNT(*) FROM `hrDevice` WHERE device_id = ? AND hrDeviceIndex = ?', [$device['device_id'], $hrDevice['hrDeviceIndex']])) {
$update_array = [
'hrDeviceType' => $hrDevice['hrDeviceType'],
'hrDeviceDescr' => $hrDevice['hrDeviceDescr'],
'hrDeviceType' => $hrDevice['hrDeviceType'],
'hrDeviceDescr' => $hrDevice['hrDeviceDescr'],
'hrDeviceStatus' => $hrDevice['hrDeviceStatus'] ?? 'unknown',
'hrDeviceErrors' => $hrDevice['hrDeviceErrors'] ?? 0,
];

View File

@ -14,7 +14,7 @@
$module = 'ntp';
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id'], ['type'=>$module]);
$components = $component->getComponents($device['device_id'], ['type' => $module]);
// We only care about our device id.
$components = $components[$device['device_id']];

View File

@ -16,7 +16,7 @@ use LibreNMS\Util\IP;
$module = 'ntp';
$component = new LibreNMS\Component();
$components = $component->getComponents($device['device_id'], ['type'=>$module]);
$components = $component->getComponents($device['device_id'], ['type' => $module]);
// We only care about our device id.
$components = $components[$device['device_id']];

View File

@ -1,6 +1,6 @@
<?php
$int_desc = snmpwalk_group($device, 'ifMainDesc', 'ARICENT-CFA-MIB');
foreach ($port_stats as $index=>$port) {
foreach ($port_stats as $index => $port) {
$port_stats[$index]['ifAlias'] = $int_desc[$index]['ifMainDesc'];
}

View File

@ -206,7 +206,7 @@ if ($device['os_group'] == 'cisco') {
[, $tmp_ifindex] = explode('.', $entAliasMappingIdentifier);
}
break;
//or sensor entity has a parent entity with module class and entPhysicalName set to an existing ifName.
//or sensor entity has a parent entity with module class and entPhysicalName set to an existing ifName.
} elseif ($entPhysicalClass === 'module' && array_key_exists($entPhysicalName, $port_reverse_array)) {
$tmp_ifindex = $port_reverse_array[$entPhysicalName]['ifIndex'];
break;

View File

@ -9,29 +9,29 @@
$oids = [
0 => [
'type' => 'dhcpatriotDatabaseThreads',
'type' => 'dhcpatriotDatabaseThreads',
'descr' => 'Database Threads',
'oid' => '.1.3.6.1.4.1.2021.50.45',
'oid' => '.1.3.6.1.4.1.2021.50.45',
],
1 => [
'type' => 'dhcpatriotDatabaseQueriesPerSecond',
'type' => 'dhcpatriotDatabaseQueriesPerSecond',
'descr' => 'Database Queries Per Second',
'oid' => '.1.3.6.1.4.1.2021.50.46',
'oid' => '.1.3.6.1.4.1.2021.50.46',
],
2 => [
'type' => 'dhcpatriotDHCPv4LeasesPerSecond',
'type' => 'dhcpatriotDHCPv4LeasesPerSecond',
'descr' => 'DHCPv4 Leases Per Second',
'oid' => '.1.3.6.1.4.1.2021.50.70',
'oid' => '.1.3.6.1.4.1.2021.50.70',
],
3 => [
'type' => 'dhcpatriotDHCPv6LeasesPerSecond',
'type' => 'dhcpatriotDHCPv6LeasesPerSecond',
'descr' => 'DHCPv6 Leases Per Second',
'oid' => '.1.3.6.1.5.1.2021.50.140',
'oid' => '.1.3.6.1.5.1.2021.50.140',
],
4 => [
'type' => 'dhcpatriotLicenseExpiration',
'type' => 'dhcpatriotLicenseExpiration',
'descr' => 'License Expiration Days Remaining',
'oid' => '.1.3.6.1.4.1.2021.51.12.4.1.2.7.76.73.67.69.78.83.69.1',
'oid' => '.1.3.6.1.4.1.2021.51.12.4.1.2.7.76.73.67.69.78.83.69.1',
],
];

View File

@ -24,27 +24,27 @@
*/
$tpdin_oids = [
[
'oid' => '.1.3.6.1.4.1.45621.2.2.9.0',
'index' => 'current1',
'descr' => 'Current 1',
'oid' => '.1.3.6.1.4.1.45621.2.2.9.0',
'index' => 'current1',
'descr' => 'Current 1',
'current' => $pre_cache['tpdin_monitor'][0]['current1'],
],
[
'oid' => '.1.3.6.1.4.1.45621.2.2.10.0',
'index' => 'current2',
'descr' => 'Current 2',
'oid' => '.1.3.6.1.4.1.45621.2.2.10.0',
'index' => 'current2',
'descr' => 'Current 2',
'current' => $pre_cache['tpdin_monitor'][0]['current2'],
],
[
'oid' => '.1.3.6.1.4.1.45621.2.2.11.0',
'index' => 'current3',
'descr' => 'Current 3',
'oid' => '.1.3.6.1.4.1.45621.2.2.11.0',
'index' => 'current3',
'descr' => 'Current 3',
'current' => $pre_cache['tpdin_monitor'][0]['current3'],
],
[
'oid' => '.1.3.6.1.4.1.45621.2.2.12.0',
'index' => 'current4',
'descr' => 'Current 4',
'oid' => '.1.3.6.1.4.1.45621.2.2.12.0',
'index' => 'current4',
'descr' => 'Current 4',
'current' => $pre_cache['tpdin_monitor'][0]['current4'],
],
];

View File

@ -40,15 +40,15 @@ if (! empty($entity_array)) {
if (! empty($entity_oids)) {
$entitysensor = [
'voltsDC' => 'voltage',
'voltsAC' => 'voltage',
'amperes' => 'current',
'watts' => 'power',
'hertz' => 'freq',
'voltsDC' => 'voltage',
'voltsAC' => 'voltage',
'amperes' => 'current',
'watts' => 'power',
'hertz' => 'freq',
'percentRH' => 'humidity',
'rpm' => 'fanspeed',
'celsius' => 'temperature',
'dBm' => 'dbm',
'rpm' => 'fanspeed',
'celsius' => 'temperature',
'dBm' => 'dbm',
];
foreach ($entity_oids as $index => $entry) {

View File

@ -4,33 +4,33 @@ echo 'pCOWeb: ';
$humidities = [
[
'mib' => 'CAREL-ug40cdz-MIB::roomRH.0',
'descr' => 'Room Relative Humidity',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.6.0',
'mib' => 'CAREL-ug40cdz-MIB::roomRH.0',
'descr' => 'Room Relative Humidity',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.6.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::dehumPband.0',
'descr' => 'Dehumidification Prop. Band',
'oid' => '.1.3.6.1.4.1.9839.2.1.3.12.0',
'mib' => 'CAREL-ug40cdz-MIB::dehumPband.0',
'descr' => 'Dehumidification Prop. Band',
'oid' => '.1.3.6.1.4.1.9839.2.1.3.12.0',
'precision' => '1',
],
[
'mib' => 'CAREL-ug40cdz-MIB::humidPband.0',
'descr' => 'Humidification Prop. Band',
'oid' => '.1.3.6.1.4.1.9839.2.1.3.13.0',
'mib' => 'CAREL-ug40cdz-MIB::humidPband.0',
'descr' => 'Humidification Prop. Band',
'oid' => '.1.3.6.1.4.1.9839.2.1.3.13.0',
'precision' => '1',
],
[
'mib' => 'CAREL-ug40cdz-MIB::dehumSetp.0',
'descr' => 'Dehumidification Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.3.16.0',
'mib' => 'CAREL-ug40cdz-MIB::dehumSetp.0',
'descr' => 'Dehumidification Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.3.16.0',
'precision' => '1',
],
[
'mib' => 'CAREL-ug40cdz-MIB::humidSetp.0',
'descr' => 'Humidification Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.3.17.0',
'mib' => 'CAREL-ug40cdz-MIB::humidSetp.0',
'descr' => 'Humidification Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.3.17.0',
'precision' => '1',
],
];

View File

@ -21,12 +21,12 @@ if ($phasecount > 1) {
$oid_array = [
[
'HighPrecOid' => 'upsHighPrecOutputLoad',
'AdvOid' => 'upsAdvOutputLoad',
'type' => 'apc',
'index' => 0,
'descr' => 'Load(VA)',
'divisor' => 10,
'mib' => '+PowerNet-MIB',
'AdvOid' => 'upsAdvOutputLoad',
'type' => 'apc',
'index' => 0,
'descr' => 'Load(VA)',
'divisor' => 10,
'mib' => '+PowerNet-MIB',
],
];
foreach ($oid_array as $item) {

View File

@ -27,13 +27,13 @@ if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.21362.100.')) {
if ($pre_cache['ifoSysProductIndex'] != null) {
$virtual_tables = [
'ifoTempName' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.3\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempDescr' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.4\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempValue' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.5\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempAlarmStatus' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.6\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempLowThldAlarm' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.7\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempHighThldAlarm' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.8\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempLowThldWarning' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.9\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempName' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.3\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempDescr' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.4\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempValue' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.5\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempAlarmStatus' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.6\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempLowThldAlarm' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.7\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempHighThldAlarm' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.8\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempLowThldWarning' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.9\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
'ifoTempHighThldWarning' => '/\.1\.3\.6\.1\.4\.1\.21362\.101\.2\.1\.1\.10\.' . $pre_cache['ifoSysProductIndex'] . '\.(\d+)/',
];

View File

@ -146,16 +146,16 @@ foreach ($cmc_iii_sensors as $sensor_id => $sensor_data) {
$sensor_data['name'] = $sensor_data['name'] . '_' . $serial_number;
$sensor_logic = [
[
'value' => 0,
'value' => 0,
'generic' => 0,
'graph' => 1,
'descr' => $sensor_data['logic'][0],
'graph' => 1,
'descr' => $sensor_data['logic'][0],
],
[
'value' => 1,
'value' => 1,
'generic' => 0,
'graph' => 1,
'descr' => $sensor_data['logic'][1],
'graph' => 1,
'descr' => $sensor_data['logic'][1],
],
];

View File

@ -34,32 +34,32 @@ $states = [
];
$octetSetup = [
[
'oid' => 'portOnM.0',
'state_name' => 'portOnM',
'states' => $states['power'],
'name' => 'Master Port Enabled',
'num_oid' => '.1.3.6.1.4.1.25868.1.12.0',
'oid' => 'portOnM.0',
'state_name' => 'portOnM',
'states' => $states['power'],
'name' => 'Master Port Enabled',
'num_oid' => '.1.3.6.1.4.1.25868.1.12.0',
],
[
'oid' => 'portSyncM.0',
'state_name' => 'portSyncM',
'states' => $states['sync'],
'name' => 'Master Port Sync Status',
'num_oid' => '.1.3.6.1.4.1.25868.1.13.0',
'oid' => 'portSyncM.0',
'state_name' => 'portSyncM',
'states' => $states['sync'],
'name' => 'Master Port Sync Status',
'num_oid' => '.1.3.6.1.4.1.25868.1.13.0',
],
[
'oid' => 'portOnS.0',
'state_name' => 'portOnS',
'states' => $states['power'],
'name' => 'Slave Port Enabled',
'num_oid' => '.1.3.6.1.4.1.25868.1.29.0',
'oid' => 'portOnS.0',
'state_name' => 'portOnS',
'states' => $states['power'],
'name' => 'Slave Port Enabled',
'num_oid' => '.1.3.6.1.4.1.25868.1.29.0',
],
[
'oid' => 'portSyncS.0',
'state_name' => 'portSyncS',
'states' => $states['sync'],
'name' => 'Slave Port Sync Status',
'num_oid' => '.1.3.6.1.4.1.25868.1.30.0',
'oid' => 'portSyncS.0',
'state_name' => 'portSyncS',
'states' => $states['sync'],
'name' => 'Slave Port Sync Status',
'num_oid' => '.1.3.6.1.4.1.25868.1.30.0',
],
];

View File

@ -10,43 +10,43 @@
$oids = [
0 => [
'descr' => 'System Software Health',
'oid' => '.1.3.6.1.4.1.2021.51.9.4.1.2.6.72.69.65.76.84.72.1',
'oid' => '.1.3.6.1.4.1.2021.51.9.4.1.2.6.72.69.65.76.84.72.1',
],
1 => [
'descr' => 'DHCPv4',
'oid' => '.1.3.6.1.4.1.2021.52.6.4.1.2.4.68.72.67.80.1',
'oid' => '.1.3.6.1.4.1.2021.52.6.4.1.2.4.68.72.67.80.1',
],
2 => [
'descr' => 'DHCPv6',
'oid' => '.1.3.6.1.4.1.2021.52.9.4.1.2.5.68.72.67.80.54.1',
'oid' => '.1.3.6.1.4.1.2021.52.9.4.1.2.5.68.72.67.80.54.1',
],
3 => [
'descr' => 'DNS',
'oid' => '.1.3.6.1.4.1.2021.52.1.4.1.2.3.68.78.83.1',
'oid' => '.1.3.6.1.4.1.2021.52.1.4.1.2.3.68.78.83.1',
],
4 => [
'descr' => 'HTTP',
'oid' => '.1.3.6.1.4.1.2021.52.2.4.1.2.4.72.84.84.80.1',
'oid' => '.1.3.6.1.4.1.2021.52.2.4.1.2.4.72.84.84.80.1',
],
5 => [
'descr' => 'HTTPS',
'oid' => '.1.3.6.1.4.1.2021.52.3.4.1.2.5.72.84.84.80.83.1',
'oid' => '.1.3.6.1.4.1.2021.52.3.4.1.2.5.72.84.84.80.83.1',
],
6 => [
'descr' => 'NTP',
'oid' => '.1.3.6.1.4.1.2021.52.4.4.1.2.3.78.84.80.1',
'oid' => '.1.3.6.1.4.1.2021.52.4.4.1.2.3.78.84.80.1',
],
7 => [
'descr' => 'SSH',
'oid' => '.1.3.6.1.4.1.2021.52.5.4.1.2.3.83.83.72.1',
'oid' => '.1.3.6.1.4.1.2021.52.5.4.1.2.3.83.83.72.1',
],
8 => [
'descr' => 'Database Status',
'oid' => '.1.3.6.1.4.1.2021.51.2.4.1.2.5.77.89.83.81.76.1',
'oid' => '.1.3.6.1.4.1.2021.51.2.4.1.2.5.77.89.83.81.76.1',
],
9 => [
'descr' => 'Database Sync Status',
'oid' => '.1.3.6.1.4.1.2021.51.3.4.1.2.16.77.89.83.81.76.82.69.80.76.73.67.65.84.73.79.78.1',
'oid' => '.1.3.6.1.4.1.2021.51.3.4.1.2.16.77.89.83.81.76.82.69.80.76.73.67.65.84.73.79.78.1',
],
];

View File

@ -4,111 +4,111 @@ echo ' pCOWeb ';
$temperatures = [
[
'mib' => 'CAREL-ug40cdz-MIB::roomTemp.0',
'descr' => 'Room Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.1.0',
'mib' => 'CAREL-ug40cdz-MIB::roomTemp.0',
'descr' => 'Room Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.1.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::outdoorTemp.0',
'descr' => 'Ambient Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.2.0',
'mib' => 'CAREL-ug40cdz-MIB::outdoorTemp.0',
'descr' => 'Ambient Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.2.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::deliveryTemp.0',
'descr' => 'Delivery Air Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.3.0',
'mib' => 'CAREL-ug40cdz-MIB::deliveryTemp.0',
'descr' => 'Delivery Air Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.3.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::cwTemp.0',
'descr' => 'Chilled Water Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.4.0',
'mib' => 'CAREL-ug40cdz-MIB::cwTemp.0',
'descr' => 'Chilled Water Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.4.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::hwTemp.0',
'descr' => 'Hot Water Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.5.0',
'mib' => 'CAREL-ug40cdz-MIB::hwTemp.0',
'descr' => 'Hot Water Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.5.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::cwoTemp.0',
'descr' => 'Chilled Water Outlet Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.7.0',
'mib' => 'CAREL-ug40cdz-MIB::cwoTemp.0',
'descr' => 'Chilled Water Outlet Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.7.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::suctTemp1.0',
'descr' => 'Circuit 1 Suction Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.10.0',
'mib' => 'CAREL-ug40cdz-MIB::suctTemp1.0',
'descr' => 'Circuit 1 Suction Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.10.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::suctTemp2.0',
'descr' => 'Circuit 2 Suction Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.11.0',
'mib' => 'CAREL-ug40cdz-MIB::suctTemp2.0',
'descr' => 'Circuit 2 Suction Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.11.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::evapTemp1.0',
'descr' => 'Circuit 1 Evap. Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.12.0',
'mib' => 'CAREL-ug40cdz-MIB::evapTemp1.0',
'descr' => 'Circuit 1 Evap. Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.12.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::evapTemp2.0',
'descr' => 'Circuit 2 Evap. Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.13.0',
'mib' => 'CAREL-ug40cdz-MIB::evapTemp2.0',
'descr' => 'Circuit 2 Evap. Temperature',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.13.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::ssh1.0',
'descr' => 'Circuit 1 Superheat',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.14.0',
'mib' => 'CAREL-ug40cdz-MIB::ssh1.0',
'descr' => 'Circuit 1 Superheat',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.14.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::ssh2.0',
'descr' => 'Circuit 2 Superheat',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.15.0',
'mib' => 'CAREL-ug40cdz-MIB::ssh2.0',
'descr' => 'Circuit 2 Superheat',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.15.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::coolSetP.0',
'descr' => 'Cooling Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.20.0',
'mib' => 'CAREL-ug40cdz-MIB::coolSetP.0',
'descr' => 'Cooling Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.20.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::coolDiff.0',
'descr' => 'Cooling Prop. Band',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.21.0',
'mib' => 'CAREL-ug40cdz-MIB::coolDiff.0',
'descr' => 'Cooling Prop. Band',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.21.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::cool2SetP.0',
'descr' => 'Cooling 2nd Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.22.0',
'mib' => 'CAREL-ug40cdz-MIB::cool2SetP.0',
'descr' => 'Cooling 2nd Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.22.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::heatSetP.0',
'descr' => 'Heating Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.23.0',
'mib' => 'CAREL-ug40cdz-MIB::heatSetP.0',
'descr' => 'Heating Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.23.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::heatDiff.0',
'descr' => 'Heating Prop. Band',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.25.0',
'mib' => 'CAREL-ug40cdz-MIB::heatDiff.0',
'descr' => 'Heating Prop. Band',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.25.0',
'precision' => '10',
],
[
'mib' => 'CAREL-ug40cdz-MIB::heat2SetP.0',
'descr' => 'Heating 2nd Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.24.0',
'mib' => 'CAREL-ug40cdz-MIB::heat2SetP.0',
'descr' => 'Heating 2nd Set Point',
'oid' => '.1.3.6.1.4.1.9839.2.1.2.24.0',
'precision' => '10',
],
];

View File

@ -24,15 +24,15 @@
*/
$tpdin_oids = [
[
'oid' => '.1.3.6.1.4.1.45621.2.2.13.0',
'index' => 'temperature1',
'descr' => 'External Temp',
'oid' => '.1.3.6.1.4.1.45621.2.2.13.0',
'index' => 'temperature1',
'descr' => 'External Temp',
'current' => $pre_cache['tpdin_monitor'][0]['temperature1'],
],
[
'oid' => '.1.3.6.1.4.1.45621.2.2.14.0',
'index' => 'temperature2',
'descr' => 'Internal Temp',
'oid' => '.1.3.6.1.4.1.45621.2.2.14.0',
'index' => 'temperature2',
'descr' => 'Internal Temp',
'current' => $pre_cache['tpdin_monitor'][0]['temperature2'],
],
];

View File

@ -24,27 +24,27 @@
*/
$tpdin_oids = [
[
'oid' => '.1.3.6.1.4.1.45621.2.2.5.0',
'index' => 'voltage1',
'descr' => 'Voltage 1',
'oid' => '.1.3.6.1.4.1.45621.2.2.5.0',
'index' => 'voltage1',
'descr' => 'Voltage 1',
'current' => $pre_cache['tpdin_monitor'][0]['voltage1'],
],
[
'oid' => '.1.3.6.1.4.1.45621.2.2.6.0',
'index' => 'voltage2',
'descr' => 'Voltage 2',
'oid' => '.1.3.6.1.4.1.45621.2.2.6.0',
'index' => 'voltage2',
'descr' => 'Voltage 2',
'current' => $pre_cache['tpdin_monitor'][0]['voltage2'],
],
[
'oid' => '.1.3.6.1.4.1.45621.2.2.7.0',
'index' => 'voltage3',
'descr' => 'Voltage 3',
'oid' => '.1.3.6.1.4.1.45621.2.2.7.0',
'index' => 'voltage3',
'descr' => 'Voltage 3',
'current' => $pre_cache['tpdin_monitor'][0]['voltage3'],
],
[
'oid' => '.1.3.6.1.4.1.45621.2.2.8.0',
'index' => 'voltage4',
'descr' => 'Voltage 4',
'oid' => '.1.3.6.1.4.1.45621.2.2.8.0',
'index' => 'voltage4',
'descr' => 'Voltage 4',
'current' => $pre_cache['tpdin_monitor'][0]['voltage4'],
],
];

View File

@ -9,10 +9,10 @@ if (Config::get('discover_services_templates')) {
if (Config::get('discover_services')) {
// FIXME: use /etc/services?
$known_services = [
22 => 'ssh',
25 => 'smtp',
53 => 'dns',
80 => 'http',
22 => 'ssh',
25 => 'smtp',
53 => 'dns',
80 => 'http',
110 => 'pop',
143 => 'imap',
];

View File

@ -61,8 +61,8 @@ foreach ($device['vlans'] as $domain_id => $vlans) {
$db_w = [
'device_id' => $device['device_id'],
'port_id' => $port['port_id'] ?? null,
'vlan' => $vlan_id,
'port_id' => $port['port_id'] ?? null,
'vlan' => $vlan_id,
];
$db_a['baseport'] = $index_to_base[$ifIndex] ?? '';

View File

@ -142,7 +142,7 @@ function device_discovery_trigger($id)
$message = 'Error rediscovering device';
}
return ['status'=> $update, 'message' => $message];
return ['status' => $update, 'message' => $message];
}
function delete_device($id)
@ -740,13 +740,13 @@ function getCIMCentPhysical($location, &$entphysical, &$index)
// Now we have an ID, create the entry.
$index++;
$insert = [
'device_id' => $device['device_id'],
'entPhysicalIndex' => $index,
'entPhysicalClass' => 'container',
'entPhysicalVendorType' => $location,
'entPhysicalName' => $shortlocation,
'entPhysicalContainedIn' => $parent,
'entPhysicalParentRelPos' => '-1',
'device_id' => $device['device_id'],
'entPhysicalIndex' => $index,
'entPhysicalClass' => 'container',
'entPhysicalVendorType' => $location,
'entPhysicalName' => $shortlocation,
'entPhysicalContainedIn' => $parent,
'entPhysicalParentRelPos' => '-1',
];
// Add to the DB and Array.
@ -837,21 +837,21 @@ function cache_peeringdb()
if ($tmp_peer) {
$peer_keep[] = $tmp_peer['pdb_ix_peers_id'];
$update = [
'remote_asn' => $peer->{'asn'},
'remote_ipaddr4' => $peer->{'ipaddr4'},
'remote_asn' => $peer->{'asn'},
'remote_ipaddr4' => $peer->{'ipaddr4'},
'remote_ipaddr6' => $peer->{'ipaddr6'},
'name' => $peer_name,
'name' => $peer_name,
];
dbUpdate($update, 'pdb_ix_peers', '`pdb_ix_peers_id` = ?', [$tmp_peer['pdb_ix_peers_id']]);
} else {
$peer_insert = [
'ix_id' => $ixid,
'peer_id' => $peer->{'id'},
'remote_asn' => $peer->{'asn'},
'ix_id' => $ixid,
'peer_id' => $peer->{'id'},
'remote_asn' => $peer->{'asn'},
'remote_ipaddr4' => $peer->{'ipaddr4'},
'remote_ipaddr6' => $peer->{'ipaddr6'},
'name' => $peer_name,
'timestamp' => time(),
'name' => $peer_name,
'timestamp' => time(),
];
$peer_keep[] = dbInsert($peer_insert, 'pdb_ix_peers');
}

View File

@ -81,7 +81,7 @@ function api_success_noresult($code, $message = null): JsonResponse
function api_error($statusCode, $message): JsonResponse
{
return response()->json([
'status' => 'error',
'status' => 'error',
'message' => $message,
], $statusCode, [], JSON_PRETTY_PRINT);
} // end api_error()
@ -114,7 +114,7 @@ function api_get_graph(Request $request, array $additional = [])
]);
$graph = Graph::get([
'width' => $request->get('width', 1075),
'width' => $request->get('width', 1075),
'height' => $request->get('height', 300),
...$additional,
...$vars,
@ -815,7 +815,7 @@ function get_graph_by_portgroup(Request $request)
}
return api_get_graph($request, [
'type' => 'multiport_bits_separate',
'type' => 'multiport_bits_separate',
'id' => $if_list,
]);
}
@ -1017,7 +1017,7 @@ function list_available_wireless_graphs(Illuminate\Http\Request $request)
foreach (dbFetchRows('SELECT `sensor_id`, `sensor_descr` FROM `wireless_sensors` WHERE `device_id` = ? AND `sensor_class` = ? AND `sensor_deleted` = 0', [$device_id, $type]) as $graph) {
$graphs[] = [
'sensor_id' => $graph['sensor_id'],
'desc' => $graph['sensor_descr'],
'desc' => $graph['sensor_descr'],
];
}
}
@ -1327,7 +1327,7 @@ function add_edit_rule(Illuminate\Http\Request $request)
}
$extra = [
'mute' => $mute,
'mute' => $mute,
'count' => $count,
'delay' => $delay_sec,
'interval' => $interval_sec,

View File

@ -56,24 +56,24 @@ Config::set('rrd_rows', 2400);
// "-c", "MGRID#FFAAAA", "-c", "FRAME#3e3e3e", "-c", "ARROW#5e5e5e", "-R", "normal");
// Predefined set of colors for use by collectd_draw_rrd()
Config::set('rrd_colors', [
'h_1' => 'F7B7B7',
'f_1' => 'FF0000', // Red
'h_2' => 'B7EFB7',
'f_2' => '00E000', // Green
'h_3' => 'B7B7F7',
'f_3' => '0000FF', // Blue
'h_4' => 'F3DFB7',
'f_4' => 'F0A000', // Yellow
'h_5' => 'B7DFF7',
'f_5' => '00A0FF', // Cyan
'h_6' => 'DFB7F7',
'f_6' => 'A000FF', // Magenta
'h_7' => 'FFC782',
'f_7' => 'FF8C00', // Orange
'h_8' => 'DCFF96',
'f_8' => 'AAFF00', // Lime
'h_9' => '83FFCD',
'f_9' => '00FF99',
'h_1' => 'F7B7B7',
'f_1' => 'FF0000', // Red
'h_2' => 'B7EFB7',
'f_2' => '00E000', // Green
'h_3' => 'B7B7F7',
'f_3' => '0000FF', // Blue
'h_4' => 'F3DFB7',
'f_4' => 'F0A000', // Yellow
'h_5' => 'B7DFF7',
'f_5' => '00A0FF', // Cyan
'h_6' => 'DFB7F7',
'f_6' => 'A000FF', // Magenta
'h_7' => 'FFC782',
'f_7' => 'FF8C00', // Orange
'h_8' => 'DCFF96',
'f_8' => 'AAFF00', // Lime
'h_9' => '83FFCD',
'f_9' => '00FF99',
'h_10' => '81D9FF',
'f_10' => '00B2FF',
'h_11' => 'FF89F5',

View File

@ -75,7 +75,7 @@ function meta_graph_local($host, $plugin, $plugin_instance, $type, $type_instanc
continue;
}
$sources[] = ['name'=>$inst, 'file'=>$file];
$sources[] = ['name' => $inst, 'file' => $file];
}
// return collectd_draw_meta_stack($opts, $sources);

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