mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 02:18:39 +00:00
Apply fixes from StyleCI (#13208)
This commit is contained in:
parent
c6d2385c3a
commit
26b95c0ccc
@ -36,8 +36,8 @@ use LibreNMS\Alerting\QueryBuilderParser;
|
||||
class AlertDB
|
||||
{
|
||||
/**
|
||||
* @param string $rule
|
||||
* @param mixed $query_builder
|
||||
* @param string $rule
|
||||
* @param mixed $query_builder
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function genSQL($rule, $query_builder = false)
|
||||
@ -51,7 +51,7 @@ class AlertDB
|
||||
|
||||
/**
|
||||
* Generate SQL from Rule
|
||||
* @param string $rule Rule to generate SQL for
|
||||
* @param string $rule Rule to generate SQL for
|
||||
* @return string|bool
|
||||
*/
|
||||
public static function genSQLOld($rule)
|
||||
|
@ -35,7 +35,7 @@ class AlertUtil
|
||||
/**
|
||||
* Get the rule_id for a specific alert
|
||||
*
|
||||
* @param int $alert_id
|
||||
* @param int $alert_id
|
||||
* @return mixed|null
|
||||
*/
|
||||
private static function getRuleId($alert_id)
|
||||
@ -48,7 +48,7 @@ class AlertUtil
|
||||
/**
|
||||
* Get the transport for a given alert_id
|
||||
*
|
||||
* @param int $alert_id
|
||||
* @param int $alert_id
|
||||
* @return array
|
||||
*/
|
||||
public static function getAlertTransports($alert_id)
|
||||
@ -73,7 +73,7 @@ class AlertUtil
|
||||
|
||||
/**
|
||||
* Find contacts for alert
|
||||
* @param array $results Rule-Result
|
||||
* @param array $results Rule-Result
|
||||
* @return array
|
||||
*/
|
||||
public static function getContacts($results)
|
||||
@ -193,7 +193,7 @@ class AlertUtil
|
||||
|
||||
/**
|
||||
* Check if device is under maintenance
|
||||
* @param int $device_id Device-ID
|
||||
* @param int $device_id Device-ID
|
||||
* @return bool
|
||||
*/
|
||||
public static function isMaintenance($device_id)
|
||||
@ -203,7 +203,7 @@ class AlertUtil
|
||||
|
||||
/**
|
||||
* Check if device is set to ignore alerts
|
||||
* @param int $device_id Device-ID
|
||||
* @param int $device_id Device-ID
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasDisableNotify($device_id)
|
||||
@ -215,8 +215,8 @@ class AlertUtil
|
||||
|
||||
/**
|
||||
* Process Macros
|
||||
* @param string $rule Rule to process
|
||||
* @param int $x Recursion-Anchor
|
||||
* @param string $rule Rule to process
|
||||
* @param int $x Recursion-Anchor
|
||||
* @return string|bool
|
||||
*/
|
||||
public static function runMacros($rule, $x = 1)
|
||||
|
@ -41,8 +41,8 @@ class RunAlerts
|
||||
{
|
||||
/**
|
||||
* Populate variables
|
||||
* @param string $txt Text with variables
|
||||
* @param bool $wrap Wrap variable for text-usage (default: true)
|
||||
* @param string $txt Text with variables
|
||||
* @param bool $wrap Wrap variable for text-usage (default: true)
|
||||
* @return string
|
||||
*/
|
||||
public function populate($txt, $wrap = true)
|
||||
@ -76,7 +76,7 @@ class RunAlerts
|
||||
|
||||
/**
|
||||
* Describe Alert
|
||||
* @param array $alert Alert-Result from DB
|
||||
* @param array $alert Alert-Result from DB
|
||||
* @return array|bool|string
|
||||
*/
|
||||
public function describeAlert($alert)
|
||||
@ -196,7 +196,7 @@ class RunAlerts
|
||||
|
||||
/**
|
||||
* Format Elapsed Time
|
||||
* @param int $secs Seconds elapsed
|
||||
* @param int $secs Seconds elapsed
|
||||
* @return string
|
||||
*/
|
||||
public function timeFormat($secs)
|
||||
@ -236,8 +236,8 @@ class RunAlerts
|
||||
|
||||
/**
|
||||
* Re-Validate Rule-Mappings
|
||||
* @param int $device_id Device-ID
|
||||
* @param int $rule Rule-ID
|
||||
* @param int $device_id Device-ID
|
||||
* @param int $rule Rule-ID
|
||||
* @return bool
|
||||
*/
|
||||
public function isRuleValid($device_id, $rule)
|
||||
@ -258,7 +258,7 @@ class RunAlerts
|
||||
|
||||
/**
|
||||
* Issue Alert-Object
|
||||
* @param array $alert
|
||||
* @param array $alert
|
||||
* @return bool
|
||||
*/
|
||||
public function issueAlert($alert)
|
||||
@ -488,7 +488,7 @@ class RunAlerts
|
||||
|
||||
/**
|
||||
* Run external transports
|
||||
* @param array $obj Alert-Array
|
||||
* @param array $obj Alert-Array
|
||||
* @return void
|
||||
*/
|
||||
public function extTransports($obj)
|
||||
@ -576,7 +576,7 @@ class RunAlerts
|
||||
/**
|
||||
* Check if a device's all parent are down
|
||||
* Returns true if all parents are down
|
||||
* @param int $device Device-ID
|
||||
* @param int $device Device-ID
|
||||
* @return bool
|
||||
*/
|
||||
public function isParentDown($device)
|
||||
|
@ -34,7 +34,7 @@ class Template
|
||||
/**
|
||||
* Get the template details
|
||||
*
|
||||
* @param array|null $obj
|
||||
* @param array|null $obj
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTemplate($obj = null)
|
||||
@ -66,7 +66,7 @@ class Template
|
||||
/**
|
||||
* Parse Blade body
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function bladeBody($data)
|
||||
@ -82,7 +82,7 @@ class Template
|
||||
/**
|
||||
* Parse Blade title
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function bladeTitle($data)
|
||||
|
@ -13,7 +13,7 @@ abstract class Transport implements TransportInterface
|
||||
|
||||
/**
|
||||
* Transport constructor.
|
||||
* @param null $transport_id
|
||||
* @param null $transport_id
|
||||
*/
|
||||
public function __construct($transport_id = null)
|
||||
{
|
||||
@ -26,7 +26,7 @@ abstract class Transport implements TransportInterface
|
||||
/**
|
||||
* Helper function to parse free form text box defined in ini style to key value pairs
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $input
|
||||
* @return array
|
||||
*/
|
||||
protected function parseUserOptions($input)
|
||||
@ -44,7 +44,7 @@ abstract class Transport implements TransportInterface
|
||||
|
||||
/**
|
||||
* Get the hex color string for a particular state
|
||||
* @param int $state State code from alert
|
||||
* @param int $state State code from alert
|
||||
* @return string Hex color, default to #337AB7 blue if state unrecognised
|
||||
*/
|
||||
public static function getColorForState($state)
|
||||
|
@ -48,8 +48,8 @@ class Pagerduty extends Transport
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $obj
|
||||
* @param array $config
|
||||
* @param array $obj
|
||||
* @param array $config
|
||||
* @return bool|string
|
||||
*/
|
||||
public function contactPagerduty($obj, $config)
|
||||
|
@ -41,7 +41,7 @@ class QueryBuilderFilter implements \JsonSerializable
|
||||
|
||||
/**
|
||||
* QueryBuilderFilter constructor.
|
||||
* @param string $type alert|group
|
||||
* @param string $type alert|group
|
||||
*/
|
||||
public function __construct($type = 'alert')
|
||||
{
|
||||
@ -162,7 +162,7 @@ class QueryBuilderFilter implements \JsonSerializable
|
||||
* Specify data which should be serialized to JSON
|
||||
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
* @return mixed data which can be serialized by <b>json_encode</b>,
|
||||
* which is a value of any type other than a resource.
|
||||
* which is a value of any type other than a resource.
|
||||
* @since 5.4.0
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
@ -176,7 +176,7 @@ class QueryBuilderFilter implements \JsonSerializable
|
||||
/**
|
||||
* Get the filter for a specific item
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $id
|
||||
* @return array|null
|
||||
*/
|
||||
public function getFilter($id)
|
||||
|
@ -52,9 +52,9 @@ class QueryBuilderFluentParser extends QueryBuilderParser
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder $query
|
||||
* @param array $rule
|
||||
* @param string $parent_condition AND or OR (for root, this should be null)
|
||||
* @param Builder $query
|
||||
* @param array $rule
|
||||
* @param string $parent_condition AND or OR (for root, this should be null)
|
||||
* @return Builder
|
||||
*/
|
||||
protected function parseGroupToQuery($query, $rule, $parent_condition = null)
|
||||
@ -71,9 +71,9 @@ class QueryBuilderFluentParser extends QueryBuilderParser
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder $query
|
||||
* @param array $rule
|
||||
* @param string $condition AND or OR
|
||||
* @param Builder $query
|
||||
* @param array $rule
|
||||
* @param string $condition AND or OR
|
||||
* @return Builder
|
||||
*/
|
||||
protected function parseRuleToQuery($query, $rule, $condition)
|
||||
@ -126,7 +126,7 @@ class QueryBuilderFluentParser extends QueryBuilderParser
|
||||
/**
|
||||
* Extract field, operator and value from the rule and expand macros and raw values
|
||||
*
|
||||
* @param array $rule
|
||||
* @param array $rule
|
||||
* @return array [field, operator, value]
|
||||
*/
|
||||
protected function expandRule($rule)
|
||||
@ -147,7 +147,7 @@ class QueryBuilderFluentParser extends QueryBuilderParser
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder $query
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
protected function joinTables($query)
|
||||
|
@ -107,7 +107,7 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
/**
|
||||
* Recursively find tables (including expanding macros) in the given rules
|
||||
*
|
||||
* @param array $rules
|
||||
* @param array $rules
|
||||
* @return array List of tables found in rules
|
||||
*/
|
||||
protected function findTablesRecursive($rules)
|
||||
@ -143,7 +143,7 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
/**
|
||||
* Initialize this from json generated by jQuery QueryBuilder
|
||||
*
|
||||
* @param string|array $json
|
||||
* @param string|array $json
|
||||
* @return static
|
||||
*/
|
||||
public static function fromJson($json)
|
||||
@ -158,7 +158,7 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
/**
|
||||
* Initialize this from a legacy LibreNMS rule
|
||||
*
|
||||
* @param string $query
|
||||
* @param string $query
|
||||
* @return static
|
||||
*/
|
||||
public static function fromOld($query)
|
||||
@ -230,7 +230,7 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
* Get the SQL for this rule, ready to execute with device_id supplied as the parameter
|
||||
* If $expand is false, this will return a more readable representation of the rule, but not executable.
|
||||
*
|
||||
* @param bool $expand
|
||||
* @param bool $expand
|
||||
* @return null|string The rule or null if this is invalid.
|
||||
*/
|
||||
public function toSql($expand = true)
|
||||
@ -256,9 +256,9 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
/**
|
||||
* Parse a rule group
|
||||
*
|
||||
* @param array $rule
|
||||
* @param bool $expand Expand macros?
|
||||
* @param bool $wrap Wrap in parenthesis
|
||||
* @param array $rule
|
||||
* @param bool $expand Expand macros?
|
||||
* @param bool $wrap Wrap in parenthesis
|
||||
* @return string
|
||||
*/
|
||||
private function parseGroup($rule, $expand = false, $wrap = true)
|
||||
@ -285,8 +285,8 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
/**
|
||||
* Parse a rule
|
||||
*
|
||||
* @param array $rule
|
||||
* @param bool $expand Expand macros?
|
||||
* @param array $rule
|
||||
* @param bool $expand Expand macros?
|
||||
* @return string
|
||||
*/
|
||||
protected function parseRule($rule, $expand = false)
|
||||
@ -323,9 +323,9 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
/**
|
||||
* Expand macro to sql
|
||||
*
|
||||
* @param string $subject
|
||||
* @param bool $tables_only Used when finding tables in query returns an array instead of sql string
|
||||
* @param int $depth_limit
|
||||
* @param string $subject
|
||||
* @param bool $tables_only Used when finding tables in query returns an array instead of sql string
|
||||
* @param int $depth_limit
|
||||
* @return string|array
|
||||
*/
|
||||
protected function expandMacro($subject, $tables_only = false, $depth_limit = 20)
|
||||
@ -368,7 +368,7 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
/**
|
||||
* Generate glue and first part of sql query for this rule
|
||||
*
|
||||
* @param string $target the name of the table to target, for alerting, this should be devices
|
||||
* @param string $target the name of the table to target, for alerting, this should be devices
|
||||
* @return array
|
||||
*/
|
||||
protected function generateGlue($target = 'devices')
|
||||
@ -396,8 +396,8 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
/**
|
||||
* Get glue sql between tables. Resolve fields to use.
|
||||
*
|
||||
* @param string $parent
|
||||
* @param string $child
|
||||
* @param string $parent
|
||||
* @param string $child
|
||||
* @return string
|
||||
*/
|
||||
public function getGlue($parent, $child)
|
||||
@ -460,7 +460,7 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
* Specify data which should be serialized to JSON
|
||||
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
* @return mixed data which can be serialized by <b>json_encode</b>,
|
||||
* which is a value of any type other than a resource.
|
||||
* which is a value of any type other than a resource.
|
||||
* @since 5.4.0
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
|
@ -178,7 +178,7 @@ trait ActiveDirectoryCommon
|
||||
* Must have the attributes: objectsid, samaccountname, displayname, mail
|
||||
* @internal
|
||||
*
|
||||
* @param array $entry
|
||||
* @param array $entry
|
||||
* @return array
|
||||
*/
|
||||
protected function userFromAd($entry)
|
||||
|
@ -320,7 +320,7 @@ class LdapAuthorizer extends AuthorizerBase
|
||||
* Get the ldap connection. If it hasn't been established yet, connect and try to bind.
|
||||
* @internal
|
||||
*
|
||||
* @param bool $skip_bind do not attempt to bind on connection
|
||||
* @param bool $skip_bind do not attempt to bind on connection
|
||||
* @return false|resource
|
||||
* @throws AuthenticationException
|
||||
*/
|
||||
@ -340,7 +340,7 @@ class LdapAuthorizer extends AuthorizerBase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $entry ldap entry array
|
||||
* @param array $entry ldap entry array
|
||||
* @return array
|
||||
*/
|
||||
private function ldapToUser($entry)
|
||||
|
@ -48,7 +48,7 @@ class LegacyAuth
|
||||
/**
|
||||
* Get class for the given or current authentication type/mechanism
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
public static function getClass($type = null)
|
||||
|
@ -72,7 +72,7 @@ class SSOAuthorizer extends MysqlAuthorizer
|
||||
* Return an attribute from the configured attribute store.
|
||||
* Returns null if the attribute cannot be found
|
||||
*
|
||||
* @param string $attr The name of the attribute to find
|
||||
* @param string $attr The name of the attribute to find
|
||||
* @return string|null
|
||||
*/
|
||||
public function authSSOGetAttr($attr, $prefix = 'HTTP_')
|
||||
|
@ -122,9 +122,9 @@ class TwoFactor
|
||||
/**
|
||||
* Verify HOTP token honouring window
|
||||
*
|
||||
* @param string $key Secret Key
|
||||
* @param int $otp OTP supplied by user
|
||||
* @param int|bool $counter Counter, if false timestamp is used
|
||||
* @param string $key Secret Key
|
||||
* @param int $otp OTP supplied by user
|
||||
* @param int|bool $counter Counter, if false timestamp is used
|
||||
* @return bool|int
|
||||
*/
|
||||
public static function verifyHOTP($key, $otp, $counter = false)
|
||||
@ -160,8 +160,8 @@ class TwoFactor
|
||||
|
||||
/**
|
||||
* Generate HOTP (RFC 4226)
|
||||
* @param string $key Secret Key
|
||||
* @param int|bool $counter Optional Counter, Defaults to Timestamp
|
||||
* @param string $key Secret Key
|
||||
* @param int|bool $counter Optional Counter, Defaults to Timestamp
|
||||
* @return string
|
||||
*/
|
||||
private static function oathHOTP($key, $counter = false)
|
||||
@ -195,9 +195,9 @@ class TwoFactor
|
||||
|
||||
/**
|
||||
* Generate 2fa URI
|
||||
* @param string $username
|
||||
* @param string $key
|
||||
* @param bool $counter if type is counter (false for time based)
|
||||
* @param string $username
|
||||
* @param string $key
|
||||
* @param bool $counter if type is counter (false for time based)
|
||||
* @return string
|
||||
*/
|
||||
public static function generateUri($username, $key, $counter = false)
|
||||
|
@ -43,7 +43,7 @@ class Device
|
||||
* Set the primary device.
|
||||
* This will be fetched by getPrimary()
|
||||
*
|
||||
* @param int $device_id
|
||||
* @param int $device_id
|
||||
*/
|
||||
public function setPrimary(int $device_id)
|
||||
{
|
||||
@ -53,7 +53,7 @@ class Device
|
||||
/**
|
||||
* Get a device by device_id
|
||||
*
|
||||
* @param int $device_id
|
||||
* @param int $device_id
|
||||
* @return \App\Models\Device
|
||||
*/
|
||||
public function get(?int $device_id): \App\Models\Device
|
||||
@ -68,7 +68,7 @@ class Device
|
||||
/**
|
||||
* Get a device by hostname
|
||||
*
|
||||
* @param string $hostname
|
||||
* @param string $hostname
|
||||
* @return \App\Models\Device
|
||||
*/
|
||||
public function getByHostname($hostname): \App\Models\Device
|
||||
@ -85,7 +85,7 @@ class Device
|
||||
/**
|
||||
* Ignore cache and load the device fresh from the database
|
||||
*
|
||||
* @param int $device_id
|
||||
* @param int $device_id
|
||||
* @return \App\Models\Device
|
||||
*/
|
||||
public function refresh(?int $device_id): \App\Models\Device
|
||||
|
@ -43,8 +43,8 @@ class PermissionsCache
|
||||
* Check if a device can be accessed by user (non-global read/admin)
|
||||
* If no user is given, use the logged in user
|
||||
*
|
||||
* @param \App\Models\Device|int $device
|
||||
* @param \App\Models\User|int $user
|
||||
* @param \App\Models\Device|int $device
|
||||
* @param \App\Models\User|int $user
|
||||
* @return bool
|
||||
*/
|
||||
public function canAccessDevice($device, $user = null)
|
||||
@ -57,8 +57,8 @@ class PermissionsCache
|
||||
* Check if a access can be accessed by user (non-global read/admin)
|
||||
* If no user is given, use the logged in user
|
||||
*
|
||||
* @param \App\Models\Port|int $port
|
||||
* @param \App\Models\User|int $user
|
||||
* @param \App\Models\Port|int $port
|
||||
* @param \App\Models\User|int $user
|
||||
* @return bool
|
||||
*/
|
||||
public function canAccessPort($port, $user = null)
|
||||
@ -73,8 +73,8 @@ class PermissionsCache
|
||||
* Check if a bill can be accessed by user (non-global read/admin)
|
||||
* If no user is given, use the logged in user
|
||||
*
|
||||
* @param \App\Models\Bill|int $bill
|
||||
* @param \App\Models\User|int $user
|
||||
* @param \App\Models\Bill|int $bill
|
||||
* @param \App\Models\User|int $user
|
||||
* @return bool
|
||||
*/
|
||||
public function canAccessBill($bill, $user = null)
|
||||
@ -88,7 +88,7 @@ class PermissionsCache
|
||||
/**
|
||||
* Get the user_id of users that have been granted access to device
|
||||
*
|
||||
* @param \App\Models\Device|int $device
|
||||
* @param \App\Models\Device|int $device
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
/*
|
||||
@ -103,7 +103,7 @@ class PermissionsCache
|
||||
/**
|
||||
* Get the user_id of users that have been granted access to port
|
||||
*
|
||||
* @param \App\Models\Port|int $port
|
||||
* @param \App\Models\Port|int $port
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function usersForPort($port)
|
||||
@ -116,7 +116,7 @@ class PermissionsCache
|
||||
/**
|
||||
* Get the user_id of users that have been granted access to bill
|
||||
*
|
||||
* @param \App\Models\Bill|int $bill
|
||||
* @param \App\Models\Bill|int $bill
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function usersForBill($bill)
|
||||
@ -129,7 +129,7 @@ class PermissionsCache
|
||||
/**
|
||||
* Get a list of device_id of all devices the user can access
|
||||
*
|
||||
* @param \App\Models\User|int $user
|
||||
* @param \App\Models\User|int $user
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function devicesForUser($user = null)
|
||||
@ -141,7 +141,7 @@ class PermissionsCache
|
||||
/**
|
||||
* Get a list of port_id of all ports the user can access directly
|
||||
*
|
||||
* @param \App\Models\User|int $user
|
||||
* @param \App\Models\User|int $user
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function portsForUser($user = null)
|
||||
@ -154,7 +154,7 @@ class PermissionsCache
|
||||
/**
|
||||
* Get a list of bill_id of all bills the user can access directly
|
||||
*
|
||||
* @param \App\Models\User|int $user
|
||||
* @param \App\Models\User|int $user
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function billsForUser($user = null)
|
||||
@ -167,7 +167,7 @@ class PermissionsCache
|
||||
/**
|
||||
* Get the ids of all device groups the user can access
|
||||
*
|
||||
* @param \App\Models\User|int $user
|
||||
* @param \App\Models\User|int $user
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function deviceGroupsForUser($user = null)
|
||||
@ -188,7 +188,7 @@ class PermissionsCache
|
||||
/**
|
||||
* Get the cached data for device permissions. Use helpers instead.
|
||||
*
|
||||
* @param \App\Models\User|int $user
|
||||
* @param \App\Models\User|int $user
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function getDevicePermissions($user = null)
|
||||
@ -238,7 +238,7 @@ class PermissionsCache
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $user
|
||||
* @param mixed $user
|
||||
* @return int|null
|
||||
*/
|
||||
private function getUserId($user)
|
||||
@ -247,7 +247,7 @@ class PermissionsCache
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $device
|
||||
* @param mixed $device
|
||||
* @return int
|
||||
*/
|
||||
private function getDeviceId($device)
|
||||
@ -256,7 +256,7 @@ class PermissionsCache
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $port
|
||||
* @param mixed $port
|
||||
* @return int
|
||||
*/
|
||||
private function getPortId($port)
|
||||
@ -265,7 +265,7 @@ class PermissionsCache
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $bill
|
||||
* @param mixed $bill
|
||||
* @return int
|
||||
*/
|
||||
private function getBillId($bill)
|
||||
|
@ -278,8 +278,8 @@ class Component
|
||||
* Get the component id for the first component in the array
|
||||
* Only set $device_id if using the array from getCompenents(), which is keyed by device_id
|
||||
*
|
||||
* @param array $component_array
|
||||
* @param int $device_id
|
||||
* @param array $component_array
|
||||
* @param int $device_id
|
||||
* @return int the component id
|
||||
*/
|
||||
public function getFirstComponentID($component_array, $device_id = null)
|
||||
|
@ -123,7 +123,7 @@ class ComposerHelper
|
||||
/**
|
||||
* Run a command or array of commands and echo the command and output
|
||||
*
|
||||
* @param string|array $cmds
|
||||
* @param string|array $cmds
|
||||
*/
|
||||
private static function exec($cmds)
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ class Config
|
||||
|
||||
/**
|
||||
* Load the user config from config.php
|
||||
* @param array $config (this should be self::$config)
|
||||
* @param array $config (this should be self::$config)
|
||||
*/
|
||||
private static function loadUserConfigFile(&$config)
|
||||
{
|
||||
@ -116,8 +116,8 @@ class Config
|
||||
/**
|
||||
* Get a config value, if non existent null (or default if set) will be returned
|
||||
*
|
||||
* @param string $key period separated config variable name
|
||||
* @param mixed $default optional value to return if the setting is not set
|
||||
* @param string $key period separated config variable name
|
||||
* @param mixed $default optional value to return if the setting is not set
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($key, $default = null)
|
||||
@ -137,7 +137,7 @@ class Config
|
||||
* Unset a config setting
|
||||
* or multiple
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param string|array $key
|
||||
*/
|
||||
public static function forget($key)
|
||||
{
|
||||
@ -149,10 +149,10 @@ class Config
|
||||
* fall back to the global config setting prefixed by $global_prefix
|
||||
* The key must be the same for the global setting and the device setting.
|
||||
*
|
||||
* @param array $device Device array
|
||||
* @param string $key Name of setting to fetch
|
||||
* @param string $global_prefix specify where the global setting lives in the global config
|
||||
* @param mixed $default will be returned if the setting is not set on the device or globally
|
||||
* @param array $device Device array
|
||||
* @param string $key Name of setting to fetch
|
||||
* @param string $global_prefix specify where the global setting lives in the global config
|
||||
* @param mixed $default will be returned if the setting is not set on the device or globally
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getDeviceSetting($device, $key, $global_prefix = null, $default = null)
|
||||
@ -171,9 +171,9 @@ class Config
|
||||
/**
|
||||
* Get a setting from the $config['os'] array using the os of the given device
|
||||
*
|
||||
* @param string $os The os name
|
||||
* @param string $key period separated config variable name
|
||||
* @param mixed $default optional value to return if the setting is not set
|
||||
* @param string $os The os name
|
||||
* @param string $key period separated config variable name
|
||||
* @param mixed $default optional value to return if the setting is not set
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getOsSetting($os, $key, $default = null)
|
||||
@ -199,9 +199,9 @@ class Config
|
||||
* Removes any duplicates.
|
||||
* When the arrays have keys, os settings take precedence over global settings
|
||||
*
|
||||
* @param string $os The os name
|
||||
* @param string $key period separated config variable name
|
||||
* @param array $default optional array to return if the setting is not set
|
||||
* @param string $os The os name
|
||||
* @param string $key period separated config variable name
|
||||
* @param array $default optional array to return if the setting is not set
|
||||
* @return array
|
||||
*/
|
||||
public static function getCombined($os, $key, $default = [])
|
||||
@ -228,8 +228,8 @@ class Config
|
||||
/**
|
||||
* Set a variable in the global config
|
||||
*
|
||||
* @param mixed $key period separated config variable name
|
||||
* @param mixed $value
|
||||
* @param mixed $key period separated config variable name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public static function set($key, $value)
|
||||
{
|
||||
@ -239,8 +239,8 @@ class Config
|
||||
/**
|
||||
* Save setting to persistent storage.
|
||||
*
|
||||
* @param mixed $key period separated config variable name
|
||||
* @param mixed $value
|
||||
* @param mixed $key period separated config variable name
|
||||
* @param mixed $value
|
||||
* @return bool if the save was successful
|
||||
*/
|
||||
public static function persist($key, $value)
|
||||
@ -272,7 +272,7 @@ class Config
|
||||
* Forget a key and all it's descendants from persistent storage.
|
||||
* This will effectively set it back to default.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $key
|
||||
* @return int|false
|
||||
*/
|
||||
public static function erase($key)
|
||||
@ -288,7 +288,7 @@ class Config
|
||||
/**
|
||||
* Check if a setting is set
|
||||
*
|
||||
* @param string $key period separated config variable name
|
||||
* @param string $key period separated config variable name
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($key)
|
||||
@ -462,9 +462,9 @@ class Config
|
||||
/**
|
||||
* Set default values for defaults that depend on other settings, if they are not already loaded
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value value to set to key or vsprintf() format string for values below
|
||||
* @param array $format_values array of keys to send to vsprintf()
|
||||
* @param string $key
|
||||
* @param string $value value to set to key or vsprintf() format string for values below
|
||||
* @param array $format_values array of keys to send to vsprintf()
|
||||
*/
|
||||
private static function setDefault($key, $value, $format_values = [])
|
||||
{
|
||||
@ -481,8 +481,8 @@ class Config
|
||||
/**
|
||||
* Copy data from old variables to new ones.
|
||||
*
|
||||
* @param string $old
|
||||
* @param string $new
|
||||
* @param string $old
|
||||
* @param string $new
|
||||
*/
|
||||
private static function deprecatedVariable($old, $new)
|
||||
{
|
||||
@ -497,7 +497,7 @@ class Config
|
||||
/**
|
||||
* Locate the actual path of a binary
|
||||
*
|
||||
* @param string $binary
|
||||
* @param string $binary
|
||||
* @return mixed
|
||||
*/
|
||||
public static function locateBinary($binary)
|
||||
|
@ -73,7 +73,7 @@ class Eloquent
|
||||
|
||||
/**
|
||||
* Set the strict mode for the current connection (will not persist)
|
||||
* @param bool $strict
|
||||
* @param bool $strict
|
||||
*/
|
||||
public static function setStrictMode($strict = true)
|
||||
{
|
||||
@ -103,7 +103,7 @@ class Eloquent
|
||||
/**
|
||||
* Access the Database Manager for Fluent style queries. Like the Laravel DB facade.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @return \Illuminate\Database\Connection|null
|
||||
*/
|
||||
public static function DB($name = null)
|
||||
|
@ -91,7 +91,7 @@ class Schema
|
||||
/**
|
||||
* Get the primary key column(s) for a table
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $table
|
||||
* @return string if a single column just the name is returned, otherwise the first column listed will be returned
|
||||
*/
|
||||
public function getPrimaryKey($table)
|
||||
@ -144,7 +144,7 @@ class Schema
|
||||
/**
|
||||
* Return all columns for the given table
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $table
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
@ -158,7 +158,7 @@ class Schema
|
||||
* Get all relationship paths.
|
||||
* Caches the data after the first call as long as the schema hasn't changed
|
||||
*
|
||||
* @param string $base
|
||||
* @param string $base
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAllRelationshipPaths($base = 'devices')
|
||||
@ -202,8 +202,8 @@ class Schema
|
||||
/**
|
||||
* Find the relationship path from $start to $target
|
||||
*
|
||||
* @param string $target
|
||||
* @param string $start Default: devices
|
||||
* @param string $target
|
||||
* @param string $start Default: devices
|
||||
* @return array|false list of tables in path order, or false if no path is found
|
||||
*/
|
||||
public function findRelationshipPath($target, $start = 'devices')
|
||||
@ -338,7 +338,7 @@ class Schema
|
||||
* Each entry in the Columns array contains these keys: Field, Type, Null, Default, Extra
|
||||
* Each entry in the Indexes array contains these keys: Name, Columns(array), Unique
|
||||
*
|
||||
* @param string $connection use a specific connection
|
||||
* @param string $connection use a specific connection
|
||||
* @return array
|
||||
*/
|
||||
public static function dump($connection = null)
|
||||
|
@ -39,7 +39,7 @@ class Measurement
|
||||
/**
|
||||
* Start the timer for a new operation
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $type
|
||||
* @return static
|
||||
*/
|
||||
public static function start(string $type)
|
||||
|
@ -49,7 +49,7 @@ abstract class BaseDatastore implements DatastoreContract
|
||||
|
||||
/**
|
||||
* Record statistics for operation
|
||||
* @param Measurement $stat
|
||||
* @param Measurement $stat
|
||||
*/
|
||||
protected function recordStatistic(Measurement $stat)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ class Datastore
|
||||
/**
|
||||
* Initialize and create the Datastore(s)
|
||||
*
|
||||
* @param array $options
|
||||
* @param array $options
|
||||
* @return Datastore
|
||||
*/
|
||||
public static function init($options = [])
|
||||
@ -61,7 +61,7 @@ class Datastore
|
||||
|
||||
/**
|
||||
* Datastore constructor.
|
||||
* @param array $datastores Implement DatastoreInterface
|
||||
* @param array $datastores Implement DatastoreInterface
|
||||
*/
|
||||
public function __construct($datastores)
|
||||
{
|
||||
@ -71,7 +71,7 @@ class Datastore
|
||||
/**
|
||||
* Disable a datastore for the rest of this run
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
*/
|
||||
public function disable($name)
|
||||
{
|
||||
@ -94,11 +94,11 @@ class Datastore
|
||||
* rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name()
|
||||
* rrd_step int: rrd step, defaults to 300
|
||||
*
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
*/
|
||||
public function put($device, $measurement, $tags, $fields)
|
||||
{
|
||||
@ -123,7 +123,7 @@ class Datastore
|
||||
/**
|
||||
* Filter all elements with keys that start with 'rrd_'
|
||||
*
|
||||
* @param array $arr input array
|
||||
* @param array $arr input array
|
||||
* @return array Copy of $arr with all keys beginning with 'rrd_' removed.
|
||||
*/
|
||||
private function rrdTagFilter($arr)
|
||||
|
@ -75,11 +75,11 @@ class Graphite extends BaseDatastore
|
||||
* rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name()
|
||||
* rrd_step int: rrd step, defaults to 300
|
||||
*
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
*/
|
||||
public function put($device, $measurement, $tags, $fields)
|
||||
{
|
||||
@ -122,9 +122,9 @@ class Graphite extends BaseDatastore
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $metric
|
||||
* @param mixed $value
|
||||
* @param mixed $timestamp
|
||||
* @param string $metric
|
||||
* @param mixed $value
|
||||
* @param mixed $timestamp
|
||||
*/
|
||||
private function writeData($metric, $value, $timestamp)
|
||||
{
|
||||
|
@ -70,11 +70,11 @@ class InfluxDB extends BaseDatastore
|
||||
* rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name()
|
||||
* rrd_step int: rrd step, defaults to 300
|
||||
*
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
*/
|
||||
public function put($device, $measurement, $tags, $fields)
|
||||
{
|
||||
|
@ -67,11 +67,11 @@ class OpenTSDB extends BaseDatastore
|
||||
* rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name()
|
||||
* rrd_step int: rrd step, defaults to 300
|
||||
*
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
*/
|
||||
public function put($device, $measurement, $tags, $fields)
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Opens up a pipe to RRDTool using handles provided
|
||||
*
|
||||
* @param bool $dual_process start an additional process that's output should be read after every command
|
||||
* @param bool $dual_process start an additional process that's output should be read after every command
|
||||
* @return bool the process(s) have been successfully started
|
||||
*/
|
||||
public function init($dual_process = true)
|
||||
@ -140,10 +140,10 @@ class Rrd extends BaseDatastore
|
||||
* rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name()
|
||||
* rrd_step int: rrd step, defaults to 300
|
||||
*
|
||||
* @param array $device device array
|
||||
* @param string $measurement the name of this measurement (if no rrd_name tag is given, this will be used to name the file)
|
||||
* @param array $tags tags to pass additional info to rrdtool
|
||||
* @param array $fields data values to update
|
||||
* @param array $device device array
|
||||
* @param string $measurement the name of this measurement (if no rrd_name tag is given, this will be used to name the file)
|
||||
* @param array $tags tags to pass additional info to rrdtool
|
||||
* @param array $fields data values to update
|
||||
*/
|
||||
public function put($device, $measurement, $tags, $fields)
|
||||
{
|
||||
@ -187,8 +187,8 @@ class Rrd extends BaseDatastore
|
||||
* Where $options is an array, each entry which is not a number is replaced with "U"
|
||||
*
|
||||
* @internal
|
||||
* @param string $filename
|
||||
* @param array $data
|
||||
* @param string $filename
|
||||
* @param array $data
|
||||
* @return array|string
|
||||
*/
|
||||
public function update($filename, $data)
|
||||
@ -219,9 +219,9 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Modify an rrd file's max value and trim the peaks as defined by rrdtool
|
||||
*
|
||||
* @param string $type only 'port' is supported at this time
|
||||
* @param string $filename the path to the rrd file
|
||||
* @param int $max the new max value
|
||||
* @param string $type only 'port' is supported at this time
|
||||
* @param string $filename the path to the rrd file
|
||||
* @param int $max the new max value
|
||||
* @return bool
|
||||
*/
|
||||
public function tune($type, $filename, $max)
|
||||
@ -263,9 +263,9 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Generates a filename for a proxmox cluster rrd
|
||||
*
|
||||
* @param string $pmxcluster
|
||||
* @param string $vmid
|
||||
* @param string $vmport
|
||||
* @param string $pmxcluster
|
||||
* @param string $vmid
|
||||
* @param string $vmport
|
||||
* @return string full path to the rrd.
|
||||
*/
|
||||
public function proxmoxName($pmxcluster, $vmid, $vmport)
|
||||
@ -282,8 +282,8 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Get the name of the port rrd file. For alternate rrd, specify the suffix.
|
||||
*
|
||||
* @param int $port_id
|
||||
* @param string $suffix
|
||||
* @param int $port_id
|
||||
* @param string $suffix
|
||||
* @return string
|
||||
*/
|
||||
public function portName($port_id, $suffix = null)
|
||||
@ -294,9 +294,9 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* rename an rrdfile, can only be done on the LibreNMS server hosting the rrd files
|
||||
*
|
||||
* @param array $device Device object
|
||||
* @param string|array $oldname RRD name array as used with rrd_name()
|
||||
* @param string|array $newname RRD name array as used with rrd_name()
|
||||
* @param array $device Device object
|
||||
* @param string|array $oldname RRD name array as used with rrd_name()
|
||||
* @param string|array $newname RRD name array as used with rrd_name()
|
||||
* @return bool indicating rename success or failure
|
||||
*/
|
||||
public function renameFile($device, $oldname, $newname)
|
||||
@ -322,9 +322,9 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Generates a filename based on the hostname (or IP) and some extra items
|
||||
*
|
||||
* @param string $host Host name
|
||||
* @param array|string $extra Components of RRD filename - will be separated with "-", or a pre-formed rrdname
|
||||
* @param string $extension File extension (default is .rrd)
|
||||
* @param string $host Host name
|
||||
* @param array|string $extra Components of RRD filename - will be separated with "-", or a pre-formed rrdname
|
||||
* @param string $extension File extension (default is .rrd)
|
||||
* @return string the name of the rrd file for $host's $extra component
|
||||
*/
|
||||
public function name($host, $extra, $extension = '.rrd')
|
||||
@ -337,7 +337,7 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Generates a path based on the hostname (or IP)
|
||||
*
|
||||
* @param string $host Host name
|
||||
* @param string $host Host name
|
||||
* @return string the name of the rrd directory for $host
|
||||
*/
|
||||
public function dirFromHost($host)
|
||||
@ -351,9 +351,9 @@ class Rrd extends BaseDatastore
|
||||
* Generates and pipes a command to rrdtool
|
||||
*
|
||||
* @internal
|
||||
* @param string $command create, update, updatev, graph, graphv, dump, restore, fetch, tune, first, last, lastupdate, info, resize, xport, flushcached
|
||||
* @param string $filename The full patth to the rrd file
|
||||
* @param string $options rrdtool command options
|
||||
* @param string $command create, update, updatev, graph, graphv, dump, restore, fetch, tune, first, last, lastupdate, info, resize, xport, flushcached
|
||||
* @param string $filename The full patth to the rrd file
|
||||
* @param string $options rrdtool command options
|
||||
* @return array the output of stdout and stderr in an array
|
||||
* @throws \Exception thrown when the rrdtool process(s) cannot be started
|
||||
*/
|
||||
@ -410,9 +410,9 @@ class Rrd extends BaseDatastore
|
||||
* Determines if --daemon and -O should be used
|
||||
*
|
||||
* @internal
|
||||
* @param string $command The base rrdtool command. Usually create, update, last.
|
||||
* @param string $filename The full path to the rrd file
|
||||
* @param string $options Options for the command possibly including the rrd definition
|
||||
* @param string $command The base rrdtool command. Usually create, update, last.
|
||||
* @param string $filename The full path to the rrd file
|
||||
* @param string $options Options for the command possibly including the rrd definition
|
||||
* @return string returns a full command ready to be piped to rrdtool
|
||||
* @throws FileExistsException if rrdtool <1.4.3 and the rrd file exists locally
|
||||
*/
|
||||
@ -448,7 +448,7 @@ class Rrd extends BaseDatastore
|
||||
* Get array of all rrd files for a device,
|
||||
* via rrdached or localdisk.
|
||||
*
|
||||
* @param array $device device for which we get the rrd's
|
||||
* @param array $device device for which we get the rrd's
|
||||
* @return array array of rrd files for this host
|
||||
*/
|
||||
public function getRrdFiles($device)
|
||||
@ -474,11 +474,11 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Get array of rrd files for specific application.
|
||||
*
|
||||
* @param array $device device for which we get the rrd's
|
||||
* @param int $app_id application id on the device
|
||||
* @param string $app_name name of app to be searched
|
||||
* @param string $category which category of graphs are searched
|
||||
* @return array array of rrd files for this host
|
||||
* @param array $device device for which we get the rrd's
|
||||
* @param int $app_id application id on the device
|
||||
* @param string $app_name name of app to be searched
|
||||
* @param string $category which category of graphs are searched
|
||||
* @return array array of rrd files for this host
|
||||
*/
|
||||
public function getRrdApplicationArrays($device, $app_id, $app_name, $category = null)
|
||||
{
|
||||
@ -512,7 +512,7 @@ class Rrd extends BaseDatastore
|
||||
* Checks if the rrd file exists on the server
|
||||
* This will perform a remote check if using rrdcached and rrdtool >= 1.5
|
||||
*
|
||||
* @param string $filename full path to the rrd file
|
||||
* @param string $filename full path to the rrd file
|
||||
* @return bool whether or not the passed rrd file exists
|
||||
*/
|
||||
public function checkRrdExists($filename)
|
||||
@ -529,8 +529,8 @@ class Rrd extends BaseDatastore
|
||||
|
||||
/**
|
||||
* Remove RRD file(s). Use with care as this permanently deletes rrd data.
|
||||
* @param string $hostname rrd subfolder (hostname)
|
||||
* @param string $prefix start of rrd file name all files matching will be deleted
|
||||
* @param string $hostname rrd subfolder (hostname)
|
||||
* @param string $prefix start of rrd file name all files matching will be deleted
|
||||
*/
|
||||
public function purge($hostname, $prefix)
|
||||
{
|
||||
@ -604,7 +604,7 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Remove invalid characters from the rrd file name
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
public static function safeName($name)
|
||||
@ -615,7 +615,7 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Remove invalid characters from the rrd description
|
||||
*
|
||||
* @param string $descr
|
||||
* @param string $descr
|
||||
* @return string
|
||||
*/
|
||||
public static function safeDescr($descr)
|
||||
@ -626,8 +626,8 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Escapes strings and sets them to a fixed length for use with RRDtool
|
||||
*
|
||||
* @param string $descr the string to escape
|
||||
* @param int $length if passed, string will be padded and trimmed to exactly this length (after rrdtool unescapes it)
|
||||
* @param string $descr the string to escape
|
||||
* @param int $length if passed, string will be padded and trimmed to exactly this length (after rrdtool unescapes it)
|
||||
* @return string
|
||||
*/
|
||||
public static function fixedSafeDescr($descr, $length)
|
||||
@ -656,7 +656,7 @@ class Rrd extends BaseDatastore
|
||||
/**
|
||||
* Only track update and create primarily, just put all others in an "other" bin
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
private function coalesceStatisticType($type)
|
||||
|
@ -66,9 +66,9 @@ class Availability
|
||||
/**
|
||||
* addition of all recorded outages in seconds
|
||||
*
|
||||
* @param object $found_outages filtered database object with all recorded outages
|
||||
* @param int $duration time period to calculate for
|
||||
* @param int $now timestamp for 'now'
|
||||
* @param object $found_outages filtered database object with all recorded outages
|
||||
* @param int $duration time period to calculate for
|
||||
* @param int $now timestamp for 'now'
|
||||
* @return int sum of all matching outages in seconds
|
||||
*/
|
||||
protected static function outageSummary($found_outages, $duration, $now = null)
|
||||
@ -101,9 +101,9 @@ class Availability
|
||||
* means, starting with 100% as default
|
||||
* substracts recorded outages
|
||||
*
|
||||
* @param array $device device to be looked at
|
||||
* @param int $duration time period to calculate for
|
||||
* @param int $precision float precision for calculated availability
|
||||
* @param array $device device to be looked at
|
||||
* @param int $duration time period to calculate for
|
||||
* @param int $precision float precision for calculated availability
|
||||
* @return float calculated availability
|
||||
*/
|
||||
public static function availability($device, $duration, $precision = 3, $now = null)
|
||||
|
@ -55,16 +55,16 @@ class Processor extends Model implements DiscoveryModule, PollerModule, Discover
|
||||
|
||||
/**
|
||||
* Processor constructor.
|
||||
* @param string $type
|
||||
* @param int $device_id
|
||||
* @param string $oid
|
||||
* @param int|string $index
|
||||
* @param string $description
|
||||
* @param int $precision The returned value will be divided by this number (should be factor of 10) If negative this oid returns idle cpu
|
||||
* @param int $current_usage
|
||||
* @param int $warn_percent
|
||||
* @param int $entPhysicalIndex
|
||||
* @param int $hrDeviceIndex
|
||||
* @param string $type
|
||||
* @param int $device_id
|
||||
* @param string $oid
|
||||
* @param int|string $index
|
||||
* @param string $description
|
||||
* @param int $precision The returned value will be divided by this number (should be factor of 10) If negative this oid returns idle cpu
|
||||
* @param int $current_usage
|
||||
* @param int $warn_percent
|
||||
* @param int $entPhysicalIndex
|
||||
* @param int $hrDeviceIndex
|
||||
* @return static
|
||||
*/
|
||||
public static function discover(
|
||||
@ -273,7 +273,7 @@ class Processor extends Model implements DiscoveryModule, PollerModule, Discover
|
||||
/**
|
||||
* Get an array of this sensor with fields that line up with the database.
|
||||
*
|
||||
* @param array $exclude exclude columns
|
||||
* @param array $exclude exclude columns
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($exclude = [])
|
||||
@ -296,7 +296,7 @@ class Processor extends Model implements DiscoveryModule, PollerModule, Discover
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Processor $processor
|
||||
* @param Processor $processor
|
||||
*/
|
||||
public static function onCreate($processor)
|
||||
{
|
||||
@ -307,7 +307,7 @@ class Processor extends Model implements DiscoveryModule, PollerModule, Discover
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Processor $processor
|
||||
* @param Processor $processor
|
||||
*/
|
||||
public static function onDelete($processor)
|
||||
{
|
||||
|
@ -61,22 +61,22 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
/**
|
||||
* Sensor constructor. Create a new sensor to be discovered.
|
||||
*
|
||||
* @param string $type Class of this sensor, must be a supported class
|
||||
* @param int $device_id the device_id of the device that owns this sensor
|
||||
* @param array|string $oids an array or single oid that contains the data for this sensor
|
||||
* @param string $subtype the type of sensor an additional identifier to separate out sensors of the same class, generally this is the os name
|
||||
* @param int|string $index the index of this sensor, must be stable, generally the index of the oid
|
||||
* @param string $description A user visible description of this sensor, may be truncated in some places (like graphs)
|
||||
* @param int|float $current The current value of this sensor, will seed the db and may be used to guess limits
|
||||
* @param int $multiplier a number to multiply the value(s) by
|
||||
* @param int $divisor a number to divide the value(s) by
|
||||
* @param string $aggregator an operation to combine multiple numbers. Supported: sum, avg
|
||||
* @param int|float $high_limit Alerting: Maximum value
|
||||
* @param int|float $low_limit Alerting: Minimum value
|
||||
* @param int|float $high_warn Alerting: High warning value
|
||||
* @param int|float $low_warn Alerting: Low warning value
|
||||
* @param int|float $entPhysicalIndex The entPhysicalIndex this sensor is associated, often a port
|
||||
* @param int|float $entPhysicalMeasured the table to look for the entPhysicalIndex, for example 'ports' (maybe unused)
|
||||
* @param string $type Class of this sensor, must be a supported class
|
||||
* @param int $device_id the device_id of the device that owns this sensor
|
||||
* @param array|string $oids an array or single oid that contains the data for this sensor
|
||||
* @param string $subtype the type of sensor an additional identifier to separate out sensors of the same class, generally this is the os name
|
||||
* @param int|string $index the index of this sensor, must be stable, generally the index of the oid
|
||||
* @param string $description A user visible description of this sensor, may be truncated in some places (like graphs)
|
||||
* @param int|float $current The current value of this sensor, will seed the db and may be used to guess limits
|
||||
* @param int $multiplier a number to multiply the value(s) by
|
||||
* @param int $divisor a number to divide the value(s) by
|
||||
* @param string $aggregator an operation to combine multiple numbers. Supported: sum, avg
|
||||
* @param int|float $high_limit Alerting: Maximum value
|
||||
* @param int|float $low_limit Alerting: Minimum value
|
||||
* @param int|float $high_warn Alerting: High warning value
|
||||
* @param int|float $low_warn Alerting: Low warning value
|
||||
* @param int|float $entPhysicalIndex The entPhysicalIndex this sensor is associated, often a port
|
||||
* @param int|float $entPhysicalMeasured the table to look for the entPhysicalIndex, for example 'ports' (maybe unused)
|
||||
*/
|
||||
public function __construct(
|
||||
$type,
|
||||
@ -241,7 +241,7 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
* Escape null values so dbFacile doesn't mess them up
|
||||
* honestly, this should be the default, but could break shit
|
||||
*
|
||||
* @param array $array
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
private function escapeNull($array)
|
||||
@ -254,7 +254,7 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
/**
|
||||
* Run Sensors discovery for the supplied OS (device)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public static function runDiscovery(OS $os)
|
||||
{
|
||||
@ -264,7 +264,7 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
/**
|
||||
* Poll sensors for the supplied OS (device)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public static function poll(OS $os)
|
||||
{
|
||||
@ -318,10 +318,10 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
/**
|
||||
* Poll all sensors of a specific class
|
||||
*
|
||||
* @param OS $os
|
||||
* @param string $type
|
||||
* @param array $sensors
|
||||
* @param array $prefetch
|
||||
* @param OS $os
|
||||
* @param string $type
|
||||
* @param array $sensors
|
||||
* @param array $prefetch
|
||||
*/
|
||||
protected static function pollSensorType($os, $type, $sensors, $prefetch = [])
|
||||
{
|
||||
@ -346,8 +346,8 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
* Fetch snmp data from the device
|
||||
* Return an array keyed by oid
|
||||
*
|
||||
* @param array $device
|
||||
* @param array $sensors
|
||||
* @param array $device
|
||||
* @param array $sensors
|
||||
* @return array
|
||||
*/
|
||||
private static function fetchSnmpData($device, $sensors)
|
||||
@ -377,8 +377,8 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
* Process the snmp data for the specified sensors
|
||||
* Returns an array sensor_id => value
|
||||
*
|
||||
* @param array $sensors
|
||||
* @param array $prefetch
|
||||
* @param array $sensors
|
||||
* @param array $prefetch
|
||||
* @return array
|
||||
* @internal param $device
|
||||
*/
|
||||
@ -425,8 +425,8 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
/**
|
||||
* Get a list of unique oids from an array of sensors and break it into chunks.
|
||||
*
|
||||
* @param array $sensors
|
||||
* @param int $chunk How many oids per chunk. Default 10.
|
||||
* @param array $sensors
|
||||
* @param int $chunk How many oids per chunk. Default 10.
|
||||
* @return array
|
||||
*/
|
||||
private static function getOidsFromSensors($sensors, $chunk = 10)
|
||||
@ -536,9 +536,9 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
* This the sensors array should contain all the sensors of a specific class
|
||||
* It may contain sensors from multiple tables and devices, but that isn't the primary use
|
||||
*
|
||||
* @param int $device_id
|
||||
* @param string $type
|
||||
* @param array $sensors
|
||||
* @param int $device_id
|
||||
* @param string $type
|
||||
* @param array $sensors
|
||||
*/
|
||||
final public static function sync($device_id, $type, array $sensors)
|
||||
{
|
||||
@ -558,9 +558,9 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
/**
|
||||
* Remove invalid sensors. Passing an empty array will remove all sensors of that class
|
||||
*
|
||||
* @param int $device_id
|
||||
* @param string $type
|
||||
* @param array $sensor_ids valid sensor ids
|
||||
* @param int $device_id
|
||||
* @param string $type
|
||||
* @param array $sensor_ids valid sensor ids
|
||||
*/
|
||||
private static function clean($device_id, $type, $sensor_ids)
|
||||
{
|
||||
@ -594,8 +594,8 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
* 'unit' - units used by this class 'dBm' for example
|
||||
* 'icon' - font awesome icon used by this class
|
||||
* )
|
||||
* @param bool $valid filter this list by valid types in the database
|
||||
* @param int $device_id when filtering, only return types valid for this device_id
|
||||
* @param bool $valid filter this list by valid types in the database
|
||||
* @param int $device_id when filtering, only return types valid for this device_id
|
||||
* @return array
|
||||
*/
|
||||
public static function getTypes($valid = false, $device_id = null)
|
||||
@ -606,9 +606,9 @@ class Sensor implements DiscoveryModule, PollerModule
|
||||
/**
|
||||
* Record sensor data in the database and data stores
|
||||
*
|
||||
* @param OS $os
|
||||
* @param array $sensors
|
||||
* @param array $data
|
||||
* @param OS $os
|
||||
* @param array $sensors
|
||||
* @param array $data
|
||||
*/
|
||||
protected static function recordSensorData(OS $os, $sensors, $data)
|
||||
{
|
||||
|
@ -39,23 +39,23 @@ class WirelessSensor extends Sensor
|
||||
/**
|
||||
* Sensor constructor. Create a new sensor to be discovered.
|
||||
*
|
||||
* @param string $type Class of this sensor, must be a supported class
|
||||
* @param int $device_id the device_id of the device that owns this sensor
|
||||
* @param array|string $oids an array or single oid that contains the data for this sensor
|
||||
* @param string $subtype the type of sensor an additional identifier to separate out sensors of the same class, generally this is the os name
|
||||
* @param int|string $index the index of this sensor, must be stable, generally the index of the oid
|
||||
* @param string $description A user visible description of this sensor, may be truncated in some places (like graphs)
|
||||
* @param int|float $current The current value of this sensor, will seed the db and may be used to guess limits
|
||||
* @param int $multiplier a number to multiply the value(s) by
|
||||
* @param int $divisor a number to divide the value(s) by
|
||||
* @param string $aggregator an operation to combine multiple numbers. Supported: sum, avg
|
||||
* @param int $access_point_id The id of the AP in the access_points sensor this belongs to (generally used for controllers)
|
||||
* @param int|float $high_limit Alerting: Maximum value
|
||||
* @param int|float $low_limit Alerting: Minimum value
|
||||
* @param int|float $high_warn Alerting: High warning value
|
||||
* @param int|float $low_warn Alerting: Low warning value
|
||||
* @param int|float $entPhysicalIndex The entPhysicalIndex this sensor is associated, often a port
|
||||
* @param int|float $entPhysicalMeasured the table to look for the entPhysicalIndex, for example 'ports' (maybe unused)
|
||||
* @param string $type Class of this sensor, must be a supported class
|
||||
* @param int $device_id the device_id of the device that owns this sensor
|
||||
* @param array|string $oids an array or single oid that contains the data for this sensor
|
||||
* @param string $subtype the type of sensor an additional identifier to separate out sensors of the same class, generally this is the os name
|
||||
* @param int|string $index the index of this sensor, must be stable, generally the index of the oid
|
||||
* @param string $description A user visible description of this sensor, may be truncated in some places (like graphs)
|
||||
* @param int|float $current The current value of this sensor, will seed the db and may be used to guess limits
|
||||
* @param int $multiplier a number to multiply the value(s) by
|
||||
* @param int $divisor a number to divide the value(s) by
|
||||
* @param string $aggregator an operation to combine multiple numbers. Supported: sum, avg
|
||||
* @param int $access_point_id The id of the AP in the access_points sensor this belongs to (generally used for controllers)
|
||||
* @param int|float $high_limit Alerting: Maximum value
|
||||
* @param int|float $low_limit Alerting: Minimum value
|
||||
* @param int|float $high_warn Alerting: High warning value
|
||||
* @param int|float $low_warn Alerting: Low warning value
|
||||
* @param int|float $entPhysicalIndex The entPhysicalIndex this sensor is associated, often a port
|
||||
* @param int|float $entPhysicalMeasured the table to look for the entPhysicalIndex, for example 'ports' (maybe unused)
|
||||
*/
|
||||
public function __construct(
|
||||
$type,
|
||||
@ -124,8 +124,8 @@ class WirelessSensor extends Sensor
|
||||
* 'unit' - units used by this class 'dBm' for example
|
||||
* 'icon' - font awesome icon used by this class
|
||||
* )
|
||||
* @param bool $valid filter this list by valid types in the database
|
||||
* @param int $device_id when filtering, only return types valid for this device_id
|
||||
* @param bool $valid filter this list by valid types in the database
|
||||
* @param int $device_id when filtering, only return types valid for this device_id
|
||||
* @return array
|
||||
*/
|
||||
public static function getTypes($valid = false, $device_id = null)
|
||||
@ -248,7 +248,7 @@ class WirelessSensor extends Sensor
|
||||
/**
|
||||
* Convert a WiFi channel to a Frequency in MHz
|
||||
*
|
||||
* @param int $channel
|
||||
* @param int $channel
|
||||
* @return int
|
||||
*/
|
||||
public static function channelToFrequency($channel)
|
||||
|
@ -37,9 +37,9 @@ class YamlDiscovery
|
||||
private static $cache_time = 1800; // 30 min, Used for oid translation cache
|
||||
|
||||
/**
|
||||
* @param OS $os
|
||||
* @param DiscoveryItem|string $class
|
||||
* @param array $yaml_data
|
||||
* @param OS $os
|
||||
* @param DiscoveryItem|string $class
|
||||
* @param array $yaml_data
|
||||
* @return array
|
||||
*/
|
||||
public static function discover(OS $os, $class, $yaml_data)
|
||||
@ -125,8 +125,8 @@ class YamlDiscovery
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $device Device we are working on
|
||||
* @param array $data Array derived from YAML
|
||||
* @param array $device Device we are working on
|
||||
* @param array $data Array derived from YAML
|
||||
* @return string
|
||||
*/
|
||||
public static function computeNumericalOID($device, $data)
|
||||
@ -151,11 +151,11 @@ class YamlDiscovery
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name Name of the field in yaml
|
||||
* @param string $index index in the snmp table
|
||||
* @param int $count current count of snmp table entries
|
||||
* @param array $def yaml definition
|
||||
* @param array $pre_cache snmp data fetched from device
|
||||
* @param string $name Name of the field in yaml
|
||||
* @param string $index index in the snmp table
|
||||
* @param int $count current count of snmp table entries
|
||||
* @param array $def yaml definition
|
||||
* @param array $pre_cache snmp data fetched from device
|
||||
* @return mixed|string|string[]|null
|
||||
*/
|
||||
public static function replaceValues($name, $index, $count, $def, $pre_cache)
|
||||
@ -200,11 +200,11 @@ class YamlDiscovery
|
||||
/**
|
||||
* Helper function for dynamic discovery to search for data from pre_cached snmp data
|
||||
*
|
||||
* @param string $name The name of the field from the discovery data or just an oid
|
||||
* @param string|int $index The index of the current sensor
|
||||
* @param array $discovery_data The discovery data for the current sensor
|
||||
* @param array $pre_cache all pre-cached snmp data
|
||||
* @param mixed $default The default value to return if data is not found
|
||||
* @param string $name The name of the field from the discovery data or just an oid
|
||||
* @param string|int $index The index of the current sensor
|
||||
* @param array $discovery_data The discovery data for the current sensor
|
||||
* @param array $pre_cache all pre-cached snmp data
|
||||
* @param mixed $default The default value to return if data is not found
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getValueFromData($name, $index, $discovery_data, $pre_cache, $default = null)
|
||||
@ -326,10 +326,10 @@ class YamlDiscovery
|
||||
/**
|
||||
* Check to see if we should skip this discovery item
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $yaml_item_data The data key from this item
|
||||
* @param array $group_options The options key from this group of items
|
||||
* @param array $pre_cache The pre-cache data array
|
||||
* @param mixed $value
|
||||
* @param array $yaml_item_data The data key from this item
|
||||
* @param array $group_options The options key from this group of items
|
||||
* @param array $pre_cache The pre-cache data array
|
||||
* @return bool
|
||||
*/
|
||||
public static function canSkipItem($value, $index, $yaml_item_data, $group_options, $pre_cache = [])
|
||||
@ -374,10 +374,10 @@ class YamlDiscovery
|
||||
/**
|
||||
* Translate an oid to numeric format (if already numeric, return as-is)
|
||||
*
|
||||
* @param string $oid
|
||||
* @param array|null $device
|
||||
* @param string $mib
|
||||
* @param string|null $mibdir
|
||||
* @param string $oid
|
||||
* @param array|null $device
|
||||
* @param string $mib
|
||||
* @param string|null $mibdir
|
||||
* @return string numeric oid
|
||||
* @throws \LibreNMS\Exceptions\InvalidOidException
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@ class DatabaseConnectException extends \Exception implements UpgradeableExceptio
|
||||
/**
|
||||
* Try to convert the given Exception to a DatabaseConnectException
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Exception $exception
|
||||
* @return static|null
|
||||
*/
|
||||
public static function upgrade($exception)
|
||||
|
@ -31,7 +31,7 @@ class DuskUnsafeException extends \Exception implements UpgradeableException
|
||||
/**
|
||||
* Try to convert the given Exception to this exception
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Exception $exception
|
||||
* @return static
|
||||
*/
|
||||
public static function upgrade($exception)
|
||||
|
@ -34,7 +34,7 @@ class FilePermissionsException extends \Exception implements UpgradeableExceptio
|
||||
/**
|
||||
* Try to convert the given Exception to a FilePermissionsException
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Exception $exception
|
||||
* @return static|null
|
||||
*/
|
||||
public static function upgrade($exception)
|
||||
@ -78,7 +78,7 @@ class FilePermissionsException extends \Exception implements UpgradeableExceptio
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $log_file
|
||||
* @param string $log_file
|
||||
* @return array
|
||||
*/
|
||||
private function generateCommands($log_file): array
|
||||
|
@ -40,7 +40,7 @@ class HostUnreachableException extends \Exception
|
||||
|
||||
/**
|
||||
* Add additional reasons
|
||||
* @param string $message
|
||||
* @param string $message
|
||||
*/
|
||||
public function addReason($message)
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ class MaximumExecutionTimeExceeded extends \Exception implements UpgradeableExce
|
||||
/**
|
||||
* Try to convert the given Exception to a FilePermissionsException
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Exception $exception
|
||||
* @return static|null
|
||||
*/
|
||||
public static function upgrade($exception)
|
||||
|
@ -42,7 +42,7 @@ class UnserializableRouteCache extends \Exception implements UpgradeableExceptio
|
||||
/**
|
||||
* Try to convert the given Exception to this exception
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Exception $exception
|
||||
* @return static|null
|
||||
*/
|
||||
public static function upgrade($exception)
|
||||
|
@ -32,11 +32,11 @@ class Fping
|
||||
/**
|
||||
* Run fping against a hostname/ip in count mode and collect stats.
|
||||
*
|
||||
* @param string $host
|
||||
* @param int $count (min 1)
|
||||
* @param int $interval (min 20)
|
||||
* @param int $timeout (not more than $interval)
|
||||
* @param string $address_family ipv4 or ipv6
|
||||
* @param string $host
|
||||
* @param int $count (min 1)
|
||||
* @param int $interval (min 20)
|
||||
* @param int $timeout (not more than $interval)
|
||||
* @param string $address_family ipv4 or ipv6
|
||||
* @return array
|
||||
*/
|
||||
public function ping($host, $count = 3, $interval = 1000, $timeout = 500, $address_family = 'ipv4')
|
||||
|
@ -29,8 +29,8 @@ interface Transport
|
||||
/**
|
||||
* Gets called when an alert is sent
|
||||
*
|
||||
* @param array $alert_data An array created by DescribeAlert
|
||||
* @param array|true $opts The options from the alert_transports transport_config column
|
||||
* @param array $alert_data An array created by DescribeAlert
|
||||
* @param array|true $opts The options from the alert_transports transport_config column
|
||||
* @return mixed Returns if the call was successful
|
||||
*/
|
||||
public function deliverAlert($alert_data, $opts);
|
||||
|
@ -10,7 +10,7 @@ interface Authorizer
|
||||
* Authenticate the user and password.
|
||||
* Some Authorizer methods may only check username.
|
||||
*
|
||||
* @param array $credentials
|
||||
* @param array $credentials
|
||||
* @return true throws an Exception on failure
|
||||
* @throws AuthenticationException thrown if the username or password is invalid
|
||||
*/
|
||||
@ -19,8 +19,8 @@ interface Authorizer
|
||||
/**
|
||||
* Check if a $username exists.
|
||||
*
|
||||
* @param string $username
|
||||
* @param bool $throw_exception Allows for a message to be sent to callers in case the user does not exist
|
||||
* @param string $username
|
||||
* @param bool $throw_exception Allows for a message to be sent to callers in case the user does not exist
|
||||
* @return bool
|
||||
*/
|
||||
public function userExists($username, $throw_exception = false);
|
||||
@ -28,7 +28,7 @@ interface Authorizer
|
||||
/**
|
||||
* Get the userlevel of $username
|
||||
*
|
||||
* @param string $username The username to check
|
||||
* @param string $username The username to check
|
||||
* @return int
|
||||
*/
|
||||
public function getUserlevel($username);
|
||||
@ -36,7 +36,7 @@ interface Authorizer
|
||||
/**
|
||||
* Get the user_id of $username
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $username
|
||||
* @return int
|
||||
*/
|
||||
public function getUserid($username);
|
||||
@ -53,7 +53,7 @@ interface Authorizer
|
||||
* level
|
||||
* can_modify_passwd
|
||||
*
|
||||
* @param int $user_id
|
||||
* @param int $user_id
|
||||
* @return array|false
|
||||
*/
|
||||
public function getUser($user_id);
|
||||
@ -61,13 +61,13 @@ interface Authorizer
|
||||
/**
|
||||
* Add a new user.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $level
|
||||
* @param string $email
|
||||
* @param string $realname
|
||||
* @param int $can_modify_passwd If this user is allowed to edit their password
|
||||
* @param string $description
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param int $level
|
||||
* @param string $email
|
||||
* @param string $realname
|
||||
* @param int $can_modify_passwd If this user is allowed to edit their password
|
||||
* @param string $description
|
||||
* @return int|false Returns the added user_id or false if adding failed
|
||||
*/
|
||||
public function addUser($username, $password, $level = 0, $email = '', $realname = '', $can_modify_passwd = 0, $description = '');
|
||||
@ -75,18 +75,18 @@ interface Authorizer
|
||||
/**
|
||||
* Update the some of the fields of a user
|
||||
*
|
||||
* @param int $user_id The user_id to update
|
||||
* @param string $realname
|
||||
* @param int $level
|
||||
* @param int $can_modify_passwd
|
||||
* @param string $email
|
||||
* @param int $user_id The user_id to update
|
||||
* @param string $realname
|
||||
* @param int $level
|
||||
* @param int $can_modify_passwd
|
||||
* @param string $email
|
||||
* @return bool If the update was successful
|
||||
*/
|
||||
public function updateUser($user_id, $realname, $level, $can_modify_passwd, $email);
|
||||
|
||||
/**
|
||||
* @param string $username The $username to update
|
||||
* @param string $newpassword
|
||||
* @param string $username The $username to update
|
||||
* @param string $newpassword
|
||||
* @return bool If the update was successful
|
||||
*/
|
||||
public function changePassword($username, $newpassword);
|
||||
@ -94,7 +94,7 @@ interface Authorizer
|
||||
/**
|
||||
* Delete a user.
|
||||
*
|
||||
* @param int $user_id
|
||||
* @param int $user_id
|
||||
* @return bool If the deletion was successful
|
||||
*/
|
||||
public function deleteUser($user_id);
|
||||
@ -126,7 +126,7 @@ interface Authorizer
|
||||
/**
|
||||
* Check if this Authorizer can set new passwords.
|
||||
*
|
||||
* @param string $username Optionally, check if $username can set their own password
|
||||
* @param string $username Optionally, check if $username can set their own password
|
||||
* @return bool
|
||||
*/
|
||||
public function canUpdatePasswords($username = '');
|
||||
|
@ -63,11 +63,11 @@ interface Datastore
|
||||
* rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name()
|
||||
* rrd_step int: rrd step, defaults to 300
|
||||
*
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
* @param array $device
|
||||
* @param string $measurement Name of this measurement
|
||||
* @param array $tags tags for the data (or to control rrdtool)
|
||||
* @param array|mixed $fields The data to update in an associative array, the order must be consistent with rrd_def,
|
||||
* single values are allowed and will be paired with $measurement
|
||||
*/
|
||||
public function put($device, $measurement, $tags, $fields);
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ interface DiscoveryItem
|
||||
* Generate an instance of this class from yaml data.
|
||||
* The data is processed and any snmp data is filled in
|
||||
*
|
||||
* @param OS $os
|
||||
* @param int $index the index of the current entry
|
||||
* @param array $data
|
||||
* @param OS $os
|
||||
* @param int $index the index of the current entry
|
||||
* @param array $data
|
||||
* @return static
|
||||
*/
|
||||
public static function fromYaml(OS $os, $index, array $data);
|
||||
|
@ -34,7 +34,7 @@ interface MplsDiscovery
|
||||
public function discoverMplsLsps();
|
||||
|
||||
/**
|
||||
* @param Collection $lsps collecton of synchronized lsp objects from discoverMplsLsps()
|
||||
* @param Collection $lsps collecton of synchronized lsp objects from discoverMplsLsps()
|
||||
* @return Collection MplsLspPath objects
|
||||
*/
|
||||
public function discoverMplsPaths($lsps);
|
||||
@ -50,14 +50,14 @@ interface MplsDiscovery
|
||||
public function discoverMplsServices();
|
||||
|
||||
/**
|
||||
* @param Collection $svcs collecton of synchronized lsp objects from discoverMplsServices()
|
||||
* @param Collection $svcs collecton of synchronized lsp objects from discoverMplsServices()
|
||||
* @return Collection MplsSap objects
|
||||
*/
|
||||
public function discoverMplsSaps($svcs);
|
||||
|
||||
/**
|
||||
* @param Collection $sdps collecton of synchronized sdp objects from discoverMplsSdps()
|
||||
* @param Collection $svcs collecton of synchronized service objects from discoverMplsServices()
|
||||
* @param Collection $sdps collecton of synchronized sdp objects from discoverMplsSdps()
|
||||
* @param Collection $svcs collecton of synchronized service objects from discoverMplsServices()
|
||||
* @return Collection MplsSdpBind objects
|
||||
*/
|
||||
public function discoverMplsSdpBinds($sdps, $svcs);
|
||||
|
@ -33,7 +33,7 @@ interface OSDetection
|
||||
* $device->sysObjectID and $device->sysDescr will be pre-populated
|
||||
* Please avoid additional snmp queries if possible
|
||||
*
|
||||
* @param Device $device
|
||||
* @param Device $device
|
||||
* @return bool
|
||||
*/
|
||||
public static function detectOS(Device $device): bool;
|
||||
|
@ -33,7 +33,7 @@ interface OSDiscovery
|
||||
* Discover additional information about the OS.
|
||||
* Primarily this is just version, hardware, features, serial, but could be anything
|
||||
*
|
||||
* @param \App\Models\Device $device
|
||||
* @param \App\Models\Device $device
|
||||
*/
|
||||
public function discoverOS(Device $device): void;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ interface UpgradeableException
|
||||
* Try to convert the given Exception to this exception
|
||||
* It should return null if the Exception cannot be upgraded.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param \Exception $exception
|
||||
* @return static|null
|
||||
*/
|
||||
public static function upgrade($exception);
|
||||
|
@ -30,7 +30,7 @@ interface Geocoder
|
||||
* Try to get the coordinates of a given address.
|
||||
* If unsuccessful, the returned array will be empty
|
||||
*
|
||||
* @param string $address
|
||||
* @param string $address
|
||||
* @return array ['lat' => 0, 'lng' => 0]
|
||||
*/
|
||||
public function getCoordinates($address);
|
||||
|
@ -32,7 +32,7 @@ interface Module
|
||||
* Discover this module. Heavier processes can be run here
|
||||
* Run infrequently (default 4 times a day)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function discover(OS $os);
|
||||
|
||||
@ -41,7 +41,7 @@ interface Module
|
||||
* Try to keep this efficient and only run if discovery has indicated there is a reason to run.
|
||||
* Run frequently (default every 5 minutes)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function poll(OS $os);
|
||||
|
||||
@ -49,7 +49,7 @@ interface Module
|
||||
* Remove all DB data for this module.
|
||||
* This will be run when the module is disabled.
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function cleanup(OS $os);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace LibreNMS\Interfaces\Polling;
|
||||
interface IsIsPolling
|
||||
{
|
||||
/**
|
||||
* @param \Illuminate\Support\Collection $adjacencies \App\Models\IsIsAdjacency
|
||||
* @param \Illuminate\Support\Collection $adjacencies \App\Models\IsIsAdjacency
|
||||
* @return \Illuminate\Support\Collection \App\Models\IsIsAdjacency
|
||||
*/
|
||||
public function pollIsIs($adjacencies);
|
||||
|
@ -28,7 +28,7 @@ namespace LibreNMS\Interfaces\Polling;
|
||||
interface MempoolsPolling
|
||||
{
|
||||
/**
|
||||
* @param \Illuminate\Support\Collection $mempools \App\Models\Mempool
|
||||
* @param \Illuminate\Support\Collection $mempools \App\Models\Mempool
|
||||
* @return \Illuminate\Support\Collection \App\Models\Mempool
|
||||
*/
|
||||
public function pollMempools($mempools);
|
||||
|
@ -34,7 +34,7 @@ interface MplsPolling
|
||||
public function pollMplsLsps();
|
||||
|
||||
/**
|
||||
* @param Collection $lsps collecton of synchronized lsp objects from pollMplsLsps()
|
||||
* @param Collection $lsps collecton of synchronized lsp objects from pollMplsLsps()
|
||||
* @return Collection MplsLspPath objects
|
||||
*/
|
||||
public function pollMplsPaths($lsps);
|
||||
@ -50,14 +50,14 @@ interface MplsPolling
|
||||
public function pollMplsServices();
|
||||
|
||||
/**
|
||||
* @param Collection $svcs collecton of synchronized service objects from pollMplsServices()
|
||||
* @param Collection $svcs collecton of synchronized service objects from pollMplsServices()
|
||||
* @return Collection MplsSap objects
|
||||
*/
|
||||
public function pollMplsSaps($svcs);
|
||||
|
||||
/**
|
||||
* @param Collection $sdps collecton of synchronized sdp objects from pollMplsSdps()
|
||||
* @param Collection $svcs collecton of synchronized service objects from pollMplsServices()
|
||||
* @param Collection $sdps collecton of synchronized sdp objects from pollMplsSdps()
|
||||
* @param Collection $svcs collecton of synchronized service objects from pollMplsServices()
|
||||
* @return Collection MplsSdpBind objects
|
||||
*/
|
||||
public function pollMplsSdpBinds($sdps, $svcs);
|
||||
|
@ -29,7 +29,7 @@ interface ProcessorPolling
|
||||
/**
|
||||
* Poll processor data. This can be implemented if custom polling is needed.
|
||||
*
|
||||
* @param array $processors Array of processor entries from the database that need to be polled
|
||||
* @param array $processors Array of processor entries from the database that need to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollProcessors(array $processors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessApCountPolling
|
||||
* Poll wireless AP count
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessApCount(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessCapacityPolling
|
||||
* Poll wireless capacity as a percent
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessCapacity(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessCcqPolling
|
||||
* Poll wireless client connection quality as a percent
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessCcq(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessCellPolling
|
||||
* Poll wireless Cellular Cell. Type is cell.
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessCell(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessChannelPolling
|
||||
* Poll Wireless Channel. Type is channel.
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessChannel(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessClientsPolling
|
||||
* Poll wireless client counts
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessClients(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessDistancePolling
|
||||
* Poll wireless frequency as kilometers
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessDistance(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessErrorRatePolling
|
||||
* Poll wireless bit error rate as bps
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessErrorRatio(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessErrorRatioPolling
|
||||
* Poll wireless bit/packet error ratio as percent
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessErrorRatio(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessErrorsPolling
|
||||
* Poll wireless bit errors as total bits
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessErrors(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessFrequencyPolling
|
||||
* Poll wireless frequency as MHz
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessFrequency(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessMsePolling
|
||||
* Poll wireless MSE in dB
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessMse(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessNoiseFloorPolling
|
||||
* Poll wireless noise floor
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessNoiseFloor(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessPowerPolling
|
||||
* Poll wireless tx or rx power
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessPower(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessQualityPolling
|
||||
* Poll wireless quality as a percent
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessQuality(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessRatePolling
|
||||
* Poll wireless rates in bps
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessRate(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessRsrpPolling
|
||||
* Poll wireless RSRP (Reference Signal Received Power) in dBm
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessRsrp(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessRsrqPolling
|
||||
* Poll wireless RSRQ (Quality of the received signal) in dB
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessRsrq(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessRssiPolling
|
||||
* Poll wireless RSSI (Received Signal Strength Indicator) in dBm
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessRssi(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessSinrPolling
|
||||
* Poll wireless SINR in dB
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessSinr(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessSnrPolling
|
||||
* Poll wireless SNR in dB
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessSnr(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessSsrPolling
|
||||
* Poll wireless SSR in dB
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessSsr(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessUtilizationPolling
|
||||
* Poll wireless utilization
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessUtilization(array $sensors);
|
||||
|
@ -30,7 +30,7 @@ interface WirelessXpiPolling
|
||||
* Poll wireless Cross Polar Interference.
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessApCount(array $sensors);
|
||||
|
@ -31,7 +31,7 @@ interface SlaPolling
|
||||
/**
|
||||
* Poll Sla data for Sla in database.
|
||||
*
|
||||
* @param Collection $slas
|
||||
* @param Collection $slas
|
||||
*/
|
||||
public function pollSlas(Collection $slas);
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ interface SnmptrapHandler
|
||||
* Handle snmptrap.
|
||||
* Data is pre-parsed and delivered as a Trap.
|
||||
*
|
||||
* @param Device $device
|
||||
* @param Trap $trap
|
||||
* @param Device $device
|
||||
* @param Trap $trap
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Device $device, Trap $trap);
|
||||
|
@ -30,7 +30,7 @@ interface DeviceTab
|
||||
{
|
||||
/**
|
||||
* Check if the tab is visible
|
||||
* @param Device $device
|
||||
* @param Device $device
|
||||
* @return bool
|
||||
*/
|
||||
public function visible(Device $device): bool;
|
||||
@ -55,7 +55,7 @@ interface DeviceTab
|
||||
|
||||
/**
|
||||
* Collect data to send to the view
|
||||
* @param Device $device
|
||||
* @param Device $device
|
||||
* @return array
|
||||
*/
|
||||
public function data(Device $device): array;
|
||||
|
@ -32,7 +32,7 @@ interface ValidationGroup
|
||||
* Validate this module.
|
||||
* To return ValidationResults, call ok, warn, fail, or result methods on the $validator
|
||||
*
|
||||
* @param Validator $validator
|
||||
* @param Validator $validator
|
||||
*/
|
||||
public function validate(Validator $validator);
|
||||
|
||||
|
@ -27,10 +27,10 @@ abstract class Model
|
||||
* This the sensors array should contain all the sensors of a specific class
|
||||
* It may contain sensors from multiple tables and devices, but that isn't the primary use
|
||||
*
|
||||
* @param int $device_id
|
||||
* @param array $models
|
||||
* @param array $unique_fields fields to search for an existing entry
|
||||
* @param array $ignored_update_fields Don't compare these field when updating
|
||||
* @param int $device_id
|
||||
* @param array $models
|
||||
* @param array $unique_fields fields to search for an existing entry
|
||||
* @param array $ignored_update_fields Don't compare these field when updating
|
||||
*/
|
||||
final public static function sync($device_id, array $models, $unique_fields = [], $ignored_update_fields = [])
|
||||
{
|
||||
@ -50,8 +50,8 @@ abstract class Model
|
||||
/**
|
||||
* Remove invalid Models. Passing an empty array will remove all models related to $device_id
|
||||
*
|
||||
* @param int $device_id
|
||||
* @param array $model_ids valid Model ids
|
||||
* @param int $device_id
|
||||
* @param array $model_ids valid Model ids
|
||||
*/
|
||||
protected static function clean($device_id, $model_ids)
|
||||
{
|
||||
@ -78,8 +78,8 @@ abstract class Model
|
||||
/**
|
||||
* Save this Model to the database.
|
||||
*
|
||||
* @param array $unique_fields fields to search for an existing entry
|
||||
* @param array $ignored_update_fields Don't compare these field when updating
|
||||
* @param array $unique_fields fields to search for an existing entry
|
||||
* @param array $ignored_update_fields Don't compare these field when updating
|
||||
* @return int the id of this model in the database
|
||||
*/
|
||||
final public function save($unique_fields = [], $ignored_update_fields = [])
|
||||
@ -112,7 +112,7 @@ abstract class Model
|
||||
* Fetch the sensor from the database.
|
||||
* If it doesn't exist, returns null.
|
||||
*
|
||||
* @param array $unique_fields fields to search for an existing entry
|
||||
* @param array $unique_fields fields to search for an existing entry
|
||||
* @return array|null
|
||||
*/
|
||||
protected function fetch($unique_fields = [])
|
||||
@ -153,7 +153,7 @@ abstract class Model
|
||||
/**
|
||||
* Convert this Model to an array with fields that match the database
|
||||
*
|
||||
* @param array $exclude Exclude the listed fields
|
||||
* @param array $exclude Exclude the listed fields
|
||||
* @return array
|
||||
*/
|
||||
abstract public function toArray($exclude = []);
|
||||
@ -166,7 +166,7 @@ abstract class Model
|
||||
abstract public function isValid();
|
||||
|
||||
/**
|
||||
* @param static $model
|
||||
* @param static $model
|
||||
*/
|
||||
public static function onDelete($model)
|
||||
{
|
||||
@ -176,7 +176,7 @@ abstract class Model
|
||||
}
|
||||
|
||||
/**
|
||||
* @param static $model
|
||||
* @param static $model
|
||||
*/
|
||||
public static function onCreate($model)
|
||||
{
|
||||
@ -186,7 +186,7 @@ abstract class Model
|
||||
}
|
||||
|
||||
/**
|
||||
* @param static $model
|
||||
* @param static $model
|
||||
*/
|
||||
public static function onUpdate($model)
|
||||
{
|
||||
|
@ -33,8 +33,8 @@ class Core
|
||||
/**
|
||||
* Detect the os of the given device.
|
||||
*
|
||||
* @param array $device device to check
|
||||
* @param bool $fetch fetch sysDescr and sysObjectID fresh from the device
|
||||
* @param array $device device to check
|
||||
* @param bool $fetch fetch sysDescr and sysObjectID fresh from the device
|
||||
* @return string the name of the os
|
||||
* @throws \Exception
|
||||
*/
|
||||
@ -95,9 +95,9 @@ class Core
|
||||
*
|
||||
* Appending _except to any condition will invert the match.
|
||||
*
|
||||
* @param array $device
|
||||
* @param array $array Array of items, keys should be sysObjectID, sysDescr, or sysDescr_regex
|
||||
* @param string|array $mibdir MIB directory for evaluated OS
|
||||
* @param array $device
|
||||
* @param array $array Array of items, keys should be sysObjectID, sysDescr, or sysDescr_regex
|
||||
* @param string|array $mibdir MIB directory for evaluated OS
|
||||
* @return bool the result (all items passed return true)
|
||||
*/
|
||||
protected static function checkDiscovery($device, $array, $mibdir)
|
||||
|
@ -108,8 +108,8 @@ class Mempools implements Module
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OS $os
|
||||
* @param \Illuminate\Support\Collection $mempools
|
||||
* @param OS $os
|
||||
* @param \Illuminate\Support\Collection $mempools
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
private function defaultPolling($os, $mempools)
|
||||
|
@ -41,7 +41,7 @@ class Mpls implements Module
|
||||
* Discover this module. Heavier processes can be run here
|
||||
* Run infrequently (default 4 times a day)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function discover(OS $os)
|
||||
{
|
||||
@ -87,7 +87,7 @@ class Mpls implements Module
|
||||
* Try to keep this efficient and only run if discovery has indicated there is a reason to run.
|
||||
* Run frequently (default every 5 minutes)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function poll(OS $os)
|
||||
{
|
||||
@ -150,7 +150,7 @@ class Mpls implements Module
|
||||
* Remove all DB data for this module.
|
||||
* This will be run when the module is disabled.
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function cleanup(OS $os)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ class Nac implements Module
|
||||
* Discover this module. Heavier processes can be run here
|
||||
* Run infrequently (default 4 times a day)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function discover(OS $os)
|
||||
{
|
||||
@ -48,7 +48,7 @@ class Nac implements Module
|
||||
* Try to keep this efficient and only run if discovery has indicated there is a reason to run.
|
||||
* Run frequently (default every 5 minutes)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function poll(OS $os)
|
||||
{
|
||||
@ -81,7 +81,7 @@ class Nac implements Module
|
||||
* Remove all DB data for this module.
|
||||
* This will be run when the module is disabled.
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function cleanup(OS $os)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class PrinterSupplies implements Module
|
||||
* Discover this module. Heavier processes can be run here
|
||||
* Run infrequently (default 4 times a day)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function discover(OS $os)
|
||||
{
|
||||
@ -58,7 +58,7 @@ class PrinterSupplies implements Module
|
||||
* Try to keep this efficient and only run if discovery has indicated there is a reason to run.
|
||||
* Run frequently (default every 5 minutes)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function poll(OS $os)
|
||||
{
|
||||
@ -114,7 +114,7 @@ class PrinterSupplies implements Module
|
||||
* Remove all DB data for this module.
|
||||
* This will be run when the module is disabled.
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function cleanup(OS $os)
|
||||
{
|
||||
@ -234,9 +234,9 @@ class PrinterSupplies implements Module
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $device
|
||||
* @param int|string $raw_value The value returned from snmp
|
||||
* @param int $capacity the normalized capacity
|
||||
* @param array $device
|
||||
* @param int|string $raw_value The value returned from snmp
|
||||
* @param int $capacity the normalized capacity
|
||||
* @return int|float|bool the toner level as a percentage
|
||||
*/
|
||||
private static function getTonerLevel($device, $raw_value, $capacity)
|
||||
@ -280,7 +280,7 @@ class PrinterSupplies implements Module
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $raw_capacity The value return from snmp
|
||||
* @param int $raw_capacity The value return from snmp
|
||||
* @return int normalized capacity value
|
||||
*/
|
||||
private static function getTonerCapacity($raw_capacity)
|
||||
|
@ -36,7 +36,7 @@ class Slas implements Module
|
||||
* Discover this module. Heavier processes can be run here
|
||||
* Run infrequently (default 4 times a day)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function discover(OS $os)
|
||||
{
|
||||
@ -52,7 +52,7 @@ class Slas implements Module
|
||||
* Try to keep this efficient and only run if discovery has indicated there is a reason to run.
|
||||
* Run frequently (default every 5 minutes)
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function poll(OS $os)
|
||||
{
|
||||
@ -73,7 +73,7 @@ class Slas implements Module
|
||||
* Remove all DB data for this module.
|
||||
* This will be run when the module is disabled.
|
||||
*
|
||||
* @param OS $os
|
||||
* @param OS $os
|
||||
*/
|
||||
public function cleanup(OS $os)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
/**
|
||||
* OS constructor. Not allowed to be created directly. Use OS::make()
|
||||
*
|
||||
* @param array $device
|
||||
* @param array $device
|
||||
*/
|
||||
private function __construct(&$device)
|
||||
{
|
||||
@ -101,7 +101,7 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
/**
|
||||
* Enable a graph for this device
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
*/
|
||||
public function enableGraph($name)
|
||||
{
|
||||
@ -135,9 +135,9 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
* If the data is cached, return the cached data.
|
||||
* DO NOT use numeric oids with this function! The snmp result must contain only one oid.
|
||||
*
|
||||
* @param string $oid textual oid
|
||||
* @param string $mib mib for this oid
|
||||
* @param string $snmpflags snmpflags for this oid
|
||||
* @param string $oid textual oid
|
||||
* @param string $mib mib for this oid
|
||||
* @param string $snmpflags snmpflags for this oid
|
||||
* @return array|null array indexed by the snmp index with the value as the data returned by snmp
|
||||
*/
|
||||
public function getCacheByIndex($oid, $mib = null, $snmpflags = '-OQUs')
|
||||
@ -161,9 +161,9 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
* If the data is cached, return the cached data.
|
||||
* DO NOT use numeric oids with this function! The snmp result must contain only one oid.
|
||||
*
|
||||
* @param string $oid textual oid
|
||||
* @param string $mib mib for this oid (optional)
|
||||
* @param int $depth depth for snmpwalk_group (optional)
|
||||
* @param string $oid textual oid
|
||||
* @param string $mib mib for this oid (optional)
|
||||
* @param int $depth depth for snmpwalk_group (optional)
|
||||
* @return array|null array indexed by the snmp index with the value as the data returned by snmp
|
||||
*/
|
||||
public function getCacheTable($oid, $mib = null, $depth = 1)
|
||||
@ -184,7 +184,7 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
/**
|
||||
* Check if an OID has been cached
|
||||
*
|
||||
* @param string $oid
|
||||
* @param string $oid
|
||||
* @return bool
|
||||
*/
|
||||
public function isCached($oid)
|
||||
@ -197,7 +197,7 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
* If no specific OS is found, Try the OS group.
|
||||
* Otherwise, returns Generic
|
||||
*
|
||||
* @param array $device device array, must have os set
|
||||
* @param array $device device array, must have os set
|
||||
* @return OS
|
||||
*/
|
||||
public static function make(&$device)
|
||||
@ -242,8 +242,8 @@ class OS implements ProcessorDiscovery, OSDiscovery, MempoolsDiscovery
|
||||
/**
|
||||
* Poll a channel based OID, but return data in MHz
|
||||
*
|
||||
* @param array $sensors
|
||||
* @param callable $callback Function to modify the value before converting it to a frequency
|
||||
* @param array $sensors
|
||||
* @param callable $callback Function to modify the value before converting it to a frequency
|
||||
* @return array
|
||||
*/
|
||||
protected function pollWirelessChannelAsFrequency($sensors, $callback = null)
|
||||
|
@ -270,7 +270,7 @@ class ArubaInstant extends OS implements
|
||||
* Poll wireless frequency as MHz
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessFrequency(array $sensors)
|
||||
@ -282,7 +282,7 @@ class ArubaInstant extends OS implements
|
||||
* Poll wireless clients
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessClients(array $sensors)
|
||||
@ -328,7 +328,7 @@ class ArubaInstant extends OS implements
|
||||
* Poll AP Count
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessApCount(array $sensors)
|
||||
|
@ -206,7 +206,7 @@ class Arubaos extends OS implements
|
||||
* Poll wireless frequency as MHz
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessFrequency(array $sensors)
|
||||
|
@ -94,12 +94,12 @@ class Dnos extends OS implements ProcessorDiscovery
|
||||
/**
|
||||
* Find processors and append them to the $processors array
|
||||
*
|
||||
* @param array $processors
|
||||
* @param string $oid Textual OIDf
|
||||
* @param string $mib MIB
|
||||
* @param string $num_oid Numerical OID
|
||||
* @param string $name Name prefix to display to user
|
||||
* @param string $type custom type (if there are multiple in one chassis)
|
||||
* @param array $processors
|
||||
* @param string $oid Textual OIDf
|
||||
* @param string $mib MIB
|
||||
* @param string $num_oid Numerical OID
|
||||
* @param string $name Name prefix to display to user
|
||||
* @param string $type custom type (if there are multiple in one chassis)
|
||||
*/
|
||||
private function findProcessors(&$processors, $oid, $mib, $num_oid, $name, $type = null)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ class Ekinops extends OS implements OSDiscovery
|
||||
|
||||
/**
|
||||
* Parses Ekinops inventory returned in a tabular format within a single OID
|
||||
* @param string $ekiInfo
|
||||
* @param string $ekiInfo
|
||||
* @return array $inv
|
||||
*/
|
||||
public static function ekinopsInfo($ekiInfo)
|
||||
|
@ -161,7 +161,7 @@ class HiveosWireless extends OS implements
|
||||
* Poll wireless noise floor
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessNoiseFloor(array $sensors)
|
||||
|
@ -49,7 +49,7 @@ class Lcos extends OS implements
|
||||
/**
|
||||
* Convert String to decimal encoded string notation
|
||||
*
|
||||
* @param string $index
|
||||
* @param string $index
|
||||
* @return string decimal encoded OID string
|
||||
*/
|
||||
private function strToDecOid($index)
|
||||
@ -97,7 +97,7 @@ class Lcos extends OS implements
|
||||
* Poll wireless frequency as MHz
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessFrequency(array $sensors)
|
||||
|
@ -93,7 +93,7 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling
|
||||
/**
|
||||
* Poll processor data. This can be implemented if custom polling is needed.
|
||||
*
|
||||
* @param array $processors Array of processor entries from the database that need to be polled
|
||||
* @param array $processors Array of processor entries from the database that need to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollProcessors(array $processors)
|
||||
|
@ -57,7 +57,7 @@ class Stellar extends OS implements
|
||||
* Poll wireless clients
|
||||
* The returned array should be sensor_id => value pairs
|
||||
*
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @param array $sensors Array of sensors needed to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollWirelessClients(array $sensors)
|
||||
|
@ -94,7 +94,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $tmnxEncapVal
|
||||
* @param mixed $tmnxEncapVal
|
||||
* @return string encapsulation
|
||||
* @see TIMETRA-TC-MIB::TmnxEncapVal
|
||||
*/
|
||||
@ -155,7 +155,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $lsps collecton of synchronized lsp objects from discoverMplsLsps()
|
||||
* @param Collection $lsps collecton of synchronized lsp objects from discoverMplsLsps()
|
||||
* @return Collection MplsLspPath objects
|
||||
*/
|
||||
public function discoverMplsPaths($lsps)
|
||||
@ -501,7 +501,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $lsps collecton of synchronized lsp objects from pollMplsLsps()
|
||||
* @param Collection $lsps collecton of synchronized lsp objects from pollMplsLsps()
|
||||
* @return Collection MplsLspPath objects
|
||||
*/
|
||||
public function pollMplsPaths($lsps)
|
||||
|
@ -33,7 +33,7 @@ trait VxworksProcessorUsage
|
||||
* Discover processors.
|
||||
* Returns an array of LibreNMS\Device\Processor objects that have been discovered
|
||||
*
|
||||
* @param string $oid Custom OID to fetch from
|
||||
* @param string $oid Custom OID to fetch from
|
||||
* @return array Processors
|
||||
*/
|
||||
public function discoverProcessors($oid = '.1.3.6.1.4.1.4413.1.1.1.1.4.9.0')
|
||||
@ -59,7 +59,7 @@ trait VxworksProcessorUsage
|
||||
/**
|
||||
* Poll processor data. This can be implemented if custom polling is needed.
|
||||
*
|
||||
* @param array $processors Array of processor entries from the database that need to be polled
|
||||
* @param array $processors Array of processor entries from the database that need to be polled
|
||||
* @return array of polled data
|
||||
*/
|
||||
public function pollProcessors(array $processors)
|
||||
@ -79,7 +79,7 @@ trait VxworksProcessorUsage
|
||||
* Parse the silly cpu usage string
|
||||
* " 5 Secs ( 96.4918%) 60 Secs ( 54.2271%) 300 Secs ( 38.2591%)"
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $data
|
||||
* @return mixed
|
||||
*/
|
||||
private function parseCpuUsage($data)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user