mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 02:18:39 +00:00
Sensors remove reliance on global variable (#16344)
* Sensors remove reliance on global variable * Apply fixes from StyleCI * Clear the instance instead of reset. Remove $valid['sensors'] from docs --------- Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
This commit is contained in:
parent
4efad1ae69
commit
f15f8fa63a
@ -25,8 +25,11 @@
|
|||||||
|
|
||||||
namespace LibreNMS\DB;
|
namespace LibreNMS\DB;
|
||||||
|
|
||||||
|
use App\Models\Device;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use LibreNMS\Interfaces\Models\Keyable;
|
||||||
|
|
||||||
trait SyncsModels
|
trait SyncsModels
|
||||||
{
|
{
|
||||||
@ -36,13 +39,13 @@ trait SyncsModels
|
|||||||
*
|
*
|
||||||
* @param \App\Models\Device $device
|
* @param \App\Models\Device $device
|
||||||
* @param string $relationship
|
* @param string $relationship
|
||||||
* @param \Illuminate\Support\Collection $models \LibreNMS\Interfaces\Models\Keyable
|
* @param \Illuminate\Support\Collection<Keyable> $models \LibreNMS\Interfaces\Models\Keyable
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
protected function syncModels($device, $relationship, $models): Collection
|
protected function syncModels($device, $relationship, $models, $existing = null): Collection
|
||||||
{
|
{
|
||||||
$models = $models->keyBy->getCompositeKey();
|
$models = $models->keyBy->getCompositeKey();
|
||||||
$existing = $device->$relationship->groupBy->getCompositeKey();
|
$existing = ($existing ?? $device->$relationship)->groupBy->getCompositeKey();
|
||||||
|
|
||||||
foreach ($existing as $exist_key => $existing_rows) {
|
foreach ($existing as $exist_key => $existing_rows) {
|
||||||
if ($models->offsetExists($exist_key)) {
|
if ($models->offsetExists($exist_key)) {
|
||||||
@ -75,6 +78,24 @@ trait SyncsModels
|
|||||||
return $existing->map->first()->merge($new);
|
return $existing->map->first()->merge($new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sync a sub-group of models to the database
|
||||||
|
*
|
||||||
|
* @param Collection<Keyable> $models
|
||||||
|
*/
|
||||||
|
public function syncModelsByGroup(Device $device, string $relationship, Collection $models, array $where): Collection
|
||||||
|
{
|
||||||
|
$filter = function ($models, $params) {
|
||||||
|
foreach ($params as $key => $value) {
|
||||||
|
$models = $models->where($key, '=', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $models;
|
||||||
|
};
|
||||||
|
|
||||||
|
return $this->syncModels($device, $relationship, $models->when($where, $filter), $device->$relationship->when($where, $filter));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combine a list of existing and potentially new models
|
* Combine a list of existing and potentially new models
|
||||||
* If the model exists fill any new data from the new models
|
* If the model exists fill any new data from the new models
|
||||||
|
79
app/Discovery/Sensor.php
Normal file
79
app/Discovery/Sensor.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Sensor.php
|
||||||
|
*
|
||||||
|
* Collects discovered sensors and allows the deletion of non-discovered sensors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @link https://www.librenms.org
|
||||||
|
*
|
||||||
|
* @copyright 2024 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Discovery;
|
||||||
|
|
||||||
|
use App\Models\Device;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use LibreNMS\DB\SyncsModels;
|
||||||
|
|
||||||
|
class Sensor
|
||||||
|
{
|
||||||
|
use SyncsModels;
|
||||||
|
|
||||||
|
private Collection $models;
|
||||||
|
/** @var bool[] */
|
||||||
|
private array $discovered = [];
|
||||||
|
private string $relationship = 'sensors';
|
||||||
|
private Device $device;
|
||||||
|
|
||||||
|
public function __construct(Device $device)
|
||||||
|
{
|
||||||
|
$this->device = $device;
|
||||||
|
$this->models = new Collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function discover(\App\Models\Sensor $sensor): static
|
||||||
|
{
|
||||||
|
$this->models->push($sensor);
|
||||||
|
$this->discovered[$sensor->syncGroup()] = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDiscovered(string $type): bool
|
||||||
|
{
|
||||||
|
return $this->discovered[$type] ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sync(...$params): Collection
|
||||||
|
{
|
||||||
|
$type = implode('-', $params);
|
||||||
|
|
||||||
|
if (! $this->isDiscovered($type)) {
|
||||||
|
$synced = $this->syncModelsByGroup($this->device, 'sensors', $this->getModels(), $params);
|
||||||
|
$this->discovered[$type] = true;
|
||||||
|
|
||||||
|
return $synced;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModels(): Collection
|
||||||
|
{
|
||||||
|
return $this->models;
|
||||||
|
}
|
||||||
|
}
|
@ -5,13 +5,35 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||||
|
use LibreNMS\Interfaces\Models\Keyable;
|
||||||
|
|
||||||
class Sensor extends DeviceRelatedModel
|
class Sensor extends DeviceRelatedModel implements Keyable
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
protected $primaryKey = 'sensor_id';
|
protected $primaryKey = 'sensor_id';
|
||||||
|
protected $fillable = [
|
||||||
|
'poller_type',
|
||||||
|
'sensor_class',
|
||||||
|
'device_id',
|
||||||
|
'sensor_oid',
|
||||||
|
'sensor_index',
|
||||||
|
'sensor_type',
|
||||||
|
'sensor_descr',
|
||||||
|
'sensor_divisor',
|
||||||
|
'sensor_multiplier',
|
||||||
|
'sensor_limit',
|
||||||
|
'sensor_limit_warn',
|
||||||
|
'sensor_limit_low',
|
||||||
|
'sensor_limit_low_warn',
|
||||||
|
'sensor_current',
|
||||||
|
'entPhysicalIndex',
|
||||||
|
'entPhysicalIndex_measured',
|
||||||
|
'user_func',
|
||||||
|
'group',
|
||||||
|
'rrd_type',
|
||||||
|
];
|
||||||
protected static $icons = [
|
protected static $icons = [
|
||||||
'airflow' => 'angle-double-right',
|
'airflow' => 'angle-double-right',
|
||||||
'ber' => 'sort-amount-desc',
|
'ber' => 'sort-amount-desc',
|
||||||
@ -75,6 +97,32 @@ class Sensor extends DeviceRelatedModel
|
|||||||
return self::$icons;
|
return self::$icons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function guessLimits(): void
|
||||||
|
{
|
||||||
|
$this->sensor_limit = match ($this->sensor_class) {
|
||||||
|
'temperature' => $this->sensor_current - 10,
|
||||||
|
'voltage' => $this->sensor_current * 0.85,
|
||||||
|
'humidity' => 30,
|
||||||
|
'fanspeed' => $this->sensor_current * 0.80,
|
||||||
|
'power_factor' => -1,
|
||||||
|
'signal' => -80,
|
||||||
|
'airflow', 'snr', 'frequency', 'pressure', 'cooling' => $this->sensor_current * 0.95,
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
|
|
||||||
|
$this->sensor_limit_low = match ($this->sensor_class) {
|
||||||
|
'temperature' => $this->sensor_current + 20,
|
||||||
|
'voltage' => $this->sensor_current * 1.15,
|
||||||
|
'humidity' => 70,
|
||||||
|
'fanspeed' => $this->sensor_current * 1.80,
|
||||||
|
'power_factor' => 1,
|
||||||
|
'signal' => -30,
|
||||||
|
'load' => 80,
|
||||||
|
'airflow', 'snr', 'frequency', 'pressure', 'cooling' => $this->sensor_current * 1.05,
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// ---- Define Relationships ----
|
// ---- Define Relationships ----
|
||||||
public function events(): MorphMany
|
public function events(): MorphMany
|
||||||
{
|
{
|
||||||
@ -85,4 +133,14 @@ class Sensor extends DeviceRelatedModel
|
|||||||
{
|
{
|
||||||
return $this->belongsToMany(StateTranslation::class, 'sensors_to_state_indexes', 'sensor_id', 'state_index_id');
|
return $this->belongsToMany(StateTranslation::class, 'sensors_to_state_indexes', 'sensor_id', 'state_index_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCompositeKey(): string
|
||||||
|
{
|
||||||
|
return "$this->poller_type-$this->sensor_class-$this->device_id-$this->sensor_type-$this->sensor_index";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncGroup(): string
|
||||||
|
{
|
||||||
|
return "$this->sensor_class-$this->poller_type";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
121
app/Observers/SensorObserver.php
Normal file
121
app/Observers/SensorObserver.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Observers;
|
||||||
|
|
||||||
|
use App\Models\Eventlog;
|
||||||
|
use App\Models\Sensor;
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
|
|
||||||
|
class SensorObserver
|
||||||
|
{
|
||||||
|
private bool $runningInConsole;
|
||||||
|
|
||||||
|
public function __construct(Application $app)
|
||||||
|
{
|
||||||
|
$this->runningInConsole = $app->runningInConsole();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saving(Sensor $sensor): void
|
||||||
|
{
|
||||||
|
// fix inverted limits
|
||||||
|
if ($sensor->sensor_limit !== null && $sensor->sensor_limit_low !== null && $sensor->sensor_limit_low > $sensor->sensor_limit) {
|
||||||
|
// Fix high/low thresholds (i.e. on negative numbers)
|
||||||
|
[$sensor->sensor_limit, $sensor->sensor_limit_low] = [$sensor->sensor_limit_low, $sensor->sensor_limit];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->runningInConsole && ! $sensor->isDirty()) {
|
||||||
|
echo '.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the service "created" event.
|
||||||
|
*
|
||||||
|
* @param Sensor $sensor
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function created(Sensor $sensor): void
|
||||||
|
{
|
||||||
|
$guess_limits = \LibreNMS\Config::get('sensors.guess_limits', true);
|
||||||
|
if ($guess_limits && $sensor->sensor_current !== null && $sensor->sensor_limit === null && $sensor->sensor_limit_low === null) {
|
||||||
|
$sensor->guessLimits();
|
||||||
|
}
|
||||||
|
|
||||||
|
EventLog::log('Sensor Added: ' . $sensor->sensor_class . ' ' . $sensor->sensor_type . ' ' . $sensor->sensor_index . ' ' . $sensor->sensor_descr, $sensor->device_id, 'sensor', Severity::Notice, $sensor->sensor_id);
|
||||||
|
|
||||||
|
if ($this->runningInConsole) {
|
||||||
|
echo '+';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the Stp "updating" event.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Sensor $sensor
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updating(Sensor $sensor)
|
||||||
|
{
|
||||||
|
// prevent update of limits
|
||||||
|
if ($sensor->sensor_custom !== 'Yes') {
|
||||||
|
if ($sensor->getOriginal('sensor_limit') !== null) {
|
||||||
|
$sensor->sensor_limit = $sensor->getOriginal('sensor_limit');
|
||||||
|
}
|
||||||
|
if ($sensor->getOriginal('sensor_limit_low') !== null) {
|
||||||
|
$sensor->sensor_limit_low = $sensor->getOriginal('sensor_limit_low');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updated(Sensor $sensor): void
|
||||||
|
{
|
||||||
|
// log limit changes
|
||||||
|
if ($sensor->sensor_custom == 'No') {
|
||||||
|
if ($sensor->isDirty('sensor_limit')) {
|
||||||
|
EventLog::log('Sensor High Limit Updated: ' . $sensor->sensor_class . ' ' . $sensor->sensor_type . ' ' . $sensor->sensor_index . ' ' . $sensor->sensor_descr . ' (' . $sensor->sensor_limit . ')', $sensor->device_id, 'sensor', Severity::Notice, $sensor->sensor_id);
|
||||||
|
|
||||||
|
if ($this->runningInConsole) {
|
||||||
|
echo 'H';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sensor->isDirty('sensor_limit_low')) {
|
||||||
|
EventLog::log('Sensor Low Limit Updated: ' . $sensor->sensor_class . ' ' . $sensor->sensor_type . ' ' . $sensor->sensor_index . ' ' . $sensor->sensor_descr . ' (' . $sensor->sensor_limit_low . ')', $sensor->device_id, 'sensor', Severity::Notice, $sensor->sensor_id);
|
||||||
|
|
||||||
|
if ($this->runningInConsole) {
|
||||||
|
echo 'L';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sensor->isDirty('sensor_limit_warn')) {
|
||||||
|
EventLog::log('Sensor Warn High Limit Updated: ' . $sensor->sensor_class . ' ' . $sensor->sensor_type . ' ' . $sensor->sensor_index . ' ' . $sensor->sensor_descr . ' (' . $sensor->sensor_limit_warn . ')', $sensor->device_id, 'sensor', Severity::Notice, $sensor->sensor_id);
|
||||||
|
|
||||||
|
if ($this->runningInConsole) {
|
||||||
|
echo 'WH';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sensor->isDirty('sensor_limit_low_warn')) {
|
||||||
|
EventLog::log('Sensor Warn Low Limit Updated: ' . $sensor->sensor_class . ' ' . $sensor->sensor_type . ' ' . $sensor->sensor_index . ' ' . $sensor->sensor_descr . ' (' . $sensor->sensor_limit_low_warn . ')', $sensor->device_id, 'sensor', Severity::Notice, $sensor->sensor_id);
|
||||||
|
|
||||||
|
if ($this->runningInConsole) {
|
||||||
|
echo 'WL';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->runningInConsole) {
|
||||||
|
echo 'U';
|
||||||
|
}
|
||||||
|
|
||||||
|
EventLog::log('Sensor Updated: ' . $sensor->sensor_class . ' ' . $sensor->sensor_type . ' ' . $sensor->sensor_index . ' ' . $sensor->sensor_descr, $sensor->device_id, 'sensor', Severity::Notice, $sensor->sensor_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleted(): void
|
||||||
|
{
|
||||||
|
if ($this->runningInConsole) {
|
||||||
|
echo '-';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Models\Sensor;
|
use App\Models\Sensor;
|
||||||
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@ -25,22 +26,26 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->registerFacades();
|
$this->registerFacades();
|
||||||
$this->registerGeocoder();
|
$this->registerGeocoder();
|
||||||
|
|
||||||
$this->app->singleton('permissions', function ($app) {
|
$this->app->singleton('permissions', function () {
|
||||||
return new PermissionsCache();
|
return new PermissionsCache();
|
||||||
});
|
});
|
||||||
$this->app->singleton('device-cache', function ($app) {
|
$this->app->singleton('device-cache', function () {
|
||||||
return new \LibreNMS\Cache\Device();
|
return new \LibreNMS\Cache\Device();
|
||||||
});
|
});
|
||||||
$this->app->singleton('git', function ($app) {
|
$this->app->singleton('git', function () {
|
||||||
return new \LibreNMS\Util\Git();
|
return new \LibreNMS\Util\Git();
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->app->bind(\App\Models\Device::class, function () {
|
$this->app->bind(\App\Models\Device::class, function (Application $app) {
|
||||||
/** @var \LibreNMS\Cache\Device $cache */
|
/** @var \LibreNMS\Cache\Device $cache */
|
||||||
$cache = $this->app->make('device-cache');
|
$cache = $app->make('device-cache');
|
||||||
|
|
||||||
return $cache->hasPrimary() ? $cache->getPrimary() : new \App\Models\Device;
|
return $cache->hasPrimary() ? $cache->getPrimary() : new \App\Models\Device;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->app->singleton('sensor-discovery', function (Application $app) {
|
||||||
|
return new \App\Discovery\Sensor($app->make('device-cache')->getPrimary());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,6 +142,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
\App\Models\Device::observe(\App\Observers\DeviceObserver::class);
|
\App\Models\Device::observe(\App\Observers\DeviceObserver::class);
|
||||||
\App\Models\Package::observe(\App\Observers\PackageObserver::class);
|
\App\Models\Package::observe(\App\Observers\PackageObserver::class);
|
||||||
|
\App\Models\Sensor::observe(\App\Observers\SensorObserver::class);
|
||||||
\App\Models\Service::observe(\App\Observers\ServiceObserver::class);
|
\App\Models\Service::observe(\App\Observers\ServiceObserver::class);
|
||||||
\App\Models\Stp::observe(\App\Observers\StpObserver::class);
|
\App\Models\Stp::observe(\App\Observers\StpObserver::class);
|
||||||
\App\Models\User::observe(\App\Observers\UserObserver::class);
|
\App\Models\User::observe(\App\Observers\UserObserver::class);
|
||||||
|
@ -105,6 +105,7 @@ global $device;
|
|||||||
foreach (dbFetchRows("SELECT * FROM `devices` WHERE disabled = 0 $where ORDER BY device_id DESC", $sqlparams) as $device) {
|
foreach (dbFetchRows("SELECT * FROM `devices` WHERE disabled = 0 $where ORDER BY device_id DESC", $sqlparams) as $device) {
|
||||||
$device_start = microtime(true);
|
$device_start = microtime(true);
|
||||||
DeviceCache::setPrimary($device['device_id']);
|
DeviceCache::setPrimary($device['device_id']);
|
||||||
|
App::forgetInstance('sensor-discovery');
|
||||||
|
|
||||||
if (discover_device($device, $module_override)) {
|
if (discover_device($device, $module_override)) {
|
||||||
$discovered_devices++;
|
$discovered_devices++;
|
||||||
|
@ -138,7 +138,7 @@ if (!empty($oids)) {
|
|||||||
$num_oid = '.1.3.6.1.4.1.9.9.13.1.5.1.3.';
|
$num_oid = '.1.3.6.1.4.1.9.9.13.1.5.1.3.';
|
||||||
foreach ($oids as $index => $entry) {
|
foreach ($oids as $index => $entry) {
|
||||||
//Discover Sensors
|
//Discover Sensors
|
||||||
discover_sensor($valid['sensor'], 'state', $device, $num_oid.$index, $index, $state_name, $entry['ciscoEnvMonSupplyStatusDescr'], '1', '1', null, null, null, null, $entry['ciscoEnvMonSupplyState'], 'snmp', $index);
|
discover_sensor(null, 'state', $device, $num_oid.$index, $index, $state_name, $entry['ciscoEnvMonSupplyStatusDescr'], '1', '1', null, null, null, null, $entry['ciscoEnvMonSupplyState'], 'snmp', $index);
|
||||||
|
|
||||||
//Create Sensor To State Index
|
//Create Sensor To State Index
|
||||||
create_sensor_to_state_index($device, $state_name, $index);
|
create_sensor_to_state_index($device, $state_name, $index);
|
||||||
|
@ -240,7 +240,7 @@ then passed to `discover_sensor()`.
|
|||||||
|
|
||||||
`discover_sensor()` Accepts the following arguments:
|
`discover_sensor()` Accepts the following arguments:
|
||||||
|
|
||||||
- &$valid = This is always $valid['sensor'], do not pass any other values.
|
- &$valid = This is always null. This is unused.
|
||||||
- $class = Required. This is the sensor class from the table above (i.e humidity).
|
- $class = Required. This is the sensor class from the table above (i.e humidity).
|
||||||
- $device = Required. This is the $device array.
|
- $device = Required. This is the $device array.
|
||||||
- $oid = Required. This must be the numerical OID for where the data
|
- $oid = Required. This must be the numerical OID for where the data
|
||||||
@ -374,7 +374,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$descrRx = dbFetchCell('SELECT `ifName` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$entry['cmEthernetTrafficPortIfIndex'], $device['device_id']]) . ' Rx Power';
|
$descrRx = dbFetchCell('SELECT `ifName` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$entry['cmEthernetTrafficPortIfIndex'], $device['device_id']]) . ' Rx Power';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidRx,
|
$oidRx,
|
||||||
@ -396,7 +396,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$descrTx = dbFetchCell('SELECT `ifName` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$entry['cmEthernetTrafficPortIfIndex'], $device['device_id']]) . ' Tx Power';
|
$descrTx = dbFetchCell('SELECT `ifName` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$entry['cmEthernetTrafficPortIfIndex'], $device['device_id']]) . ' Tx Power';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidTx,
|
$oidTx,
|
||||||
|
@ -197,10 +197,8 @@ function discover_device(&$device, $force_module = false)
|
|||||||
//end discover_device()
|
//end discover_device()
|
||||||
|
|
||||||
// Discover sensors
|
// Discover sensors
|
||||||
function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr, $divisor = 1, $multiplier = 1, $low_limit = null, $low_warn_limit = null, $warn_limit = null, $high_limit = null, $current = null, $poller_type = 'snmp', $entPhysicalIndex = null, $entPhysicalIndex_measured = null, $user_func = null, $group = null, $rrd_type = 'GAUGE')
|
function discover_sensor($unused, $class, $device, $oid, $index, $type, $descr, $divisor = 1, $multiplier = 1, $low_limit = null, $low_warn_limit = null, $warn_limit = null, $high_limit = null, $current = null, $poller_type = 'snmp', $entPhysicalIndex = null, $entPhysicalIndex_measured = null, $user_func = null, $group = null, $rrd_type = 'GAUGE'): bool
|
||||||
{
|
{
|
||||||
$guess_limits = Config::get('sensors.guess_limits', true);
|
|
||||||
|
|
||||||
$low_limit = set_null($low_limit);
|
$low_limit = set_null($low_limit);
|
||||||
$low_warn_limit = set_null($low_warn_limit);
|
$low_warn_limit = set_null($low_warn_limit);
|
||||||
$warn_limit = set_null($warn_limit);
|
$warn_limit = set_null($warn_limit);
|
||||||
@ -216,257 +214,31 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
|
|||||||
|
|
||||||
d_echo("Discover sensor: $oid, $index, $type, $descr, $poller_type, $divisor, $multiplier, $entPhysicalIndex, $current, (limits: LL: $low_limit, LW: $low_warn_limit, W: $warn_limit, H: $high_limit), rrd_type = $rrd_type \n");
|
d_echo("Discover sensor: $oid, $index, $type, $descr, $poller_type, $divisor, $multiplier, $entPhysicalIndex, $current, (limits: LL: $low_limit, LW: $low_warn_limit, W: $warn_limit, H: $high_limit), rrd_type = $rrd_type \n");
|
||||||
|
|
||||||
if (isset($warn_limit, $low_warn_limit) && $low_warn_limit > $warn_limit) {
|
app('sensor-discovery')->discover(new \App\Models\Sensor([
|
||||||
// Fix high/low thresholds (i.e. on negative numbers)
|
'poller_type' => $poller_type,
|
||||||
[$warn_limit, $low_warn_limit] = [$low_warn_limit, $warn_limit];
|
'sensor_class' => $class,
|
||||||
}
|
'device_id' => $device['device_id'],
|
||||||
|
'sensor_oid' => $oid,
|
||||||
|
'sensor_index' => $index,
|
||||||
|
'sensor_type' => $type,
|
||||||
|
'sensor_descr' => $descr,
|
||||||
|
'sensor_divisor' => $divisor,
|
||||||
|
'sensor_multiplier' => $multiplier,
|
||||||
|
'sensor_limit' => $high_limit,
|
||||||
|
'sensor_limit_warn' => $warn_limit,
|
||||||
|
'sensor_limit_low' => $low_limit,
|
||||||
|
'sensor_limit_low_warn' => $low_warn_limit,
|
||||||
|
'sensor_current' => $current,
|
||||||
|
'entPhysicalIndex' => $entPhysicalIndex,
|
||||||
|
'entPhysicalIndex_measured' => $entPhysicalIndex_measured,
|
||||||
|
'user_func' => $user_func,
|
||||||
|
'group' => $group,
|
||||||
|
'rrd_type' => $rrd_type,
|
||||||
|
]));
|
||||||
|
|
||||||
if (dbFetchCell('SELECT COUNT(sensor_id) FROM `sensors` WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND sensor_type = ? AND `sensor_index` = ?', [$poller_type, $class, $device['device_id'], $type, (string) $index]) == '0') {
|
return true;
|
||||||
if ($guess_limits && is_null($high_limit)) {
|
|
||||||
$high_limit = sensor_limit($class, $current);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($guess_limits && is_null($low_limit)) {
|
|
||||||
$low_limit = sensor_low_limit($class, $current);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! is_null($high_limit) && $low_limit > $high_limit) {
|
|
||||||
// Fix high/low thresholds (i.e. on negative numbers)
|
|
||||||
[$high_limit, $low_limit] = [$low_limit, $high_limit];
|
|
||||||
}
|
|
||||||
|
|
||||||
$insert = [
|
|
||||||
'poller_type' => $poller_type,
|
|
||||||
'sensor_class' => $class,
|
|
||||||
'device_id' => $device['device_id'],
|
|
||||||
'sensor_oid' => $oid,
|
|
||||||
'sensor_index' => $index,
|
|
||||||
'sensor_type' => $type,
|
|
||||||
'sensor_descr' => $descr,
|
|
||||||
'sensor_divisor' => $divisor,
|
|
||||||
'sensor_multiplier' => $multiplier,
|
|
||||||
'sensor_limit' => $high_limit,
|
|
||||||
'sensor_limit_warn' => $warn_limit,
|
|
||||||
'sensor_limit_low' => $low_limit,
|
|
||||||
'sensor_limit_low_warn' => $low_warn_limit,
|
|
||||||
'sensor_current' => $current,
|
|
||||||
'entPhysicalIndex' => $entPhysicalIndex,
|
|
||||||
'entPhysicalIndex_measured' => $entPhysicalIndex_measured,
|
|
||||||
'user_func' => $user_func,
|
|
||||||
'group' => $group,
|
|
||||||
'rrd_type' => $rrd_type,
|
|
||||||
];
|
|
||||||
|
|
||||||
$inserted = dbInsert($insert, 'sensors');
|
|
||||||
|
|
||||||
d_echo("( $inserted inserted )\n");
|
|
||||||
|
|
||||||
echo '+';
|
|
||||||
log_event('Sensor Added: ' . $class . ' ' . $type . ' ' . $index . ' ' . $descr, $device, 'sensor', 3, $inserted);
|
|
||||||
} else {
|
|
||||||
$sensor_entry = dbFetchRow('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? AND `sensor_type` = ? AND `sensor_index` = ?', [$class, $device['device_id'], $type, (string) $index]);
|
|
||||||
|
|
||||||
if (! isset($high_limit)) {
|
|
||||||
if ($guess_limits && ! $sensor_entry['sensor_limit']) {
|
|
||||||
// Calculate a reasonable limit
|
|
||||||
$high_limit = sensor_limit($class, $current);
|
|
||||||
} else {
|
|
||||||
// Use existing limit
|
|
||||||
$high_limit = $sensor_entry['sensor_limit'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! isset($low_limit)) {
|
|
||||||
if ($guess_limits && ! $sensor_entry['sensor_limit_low']) {
|
|
||||||
// Calculate a reasonable limit
|
|
||||||
$low_limit = sensor_low_limit($class, $current);
|
|
||||||
} else {
|
|
||||||
// Use existing limit
|
|
||||||
$low_limit = $sensor_entry['sensor_limit_low'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fix high/low thresholds (i.e. on negative numbers)
|
|
||||||
if (isset($high_limit) && $low_limit > $high_limit) {
|
|
||||||
[$high_limit, $low_limit] = [$low_limit, $high_limit];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((string) $high_limit != (string) $sensor_entry['sensor_limit'] && $sensor_entry['sensor_custom'] == 'No') {
|
|
||||||
$update = ['sensor_limit' => $high_limit];
|
|
||||||
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', [$sensor_entry['sensor_id']]);
|
|
||||||
d_echo("( $updated updated )\n");
|
|
||||||
|
|
||||||
echo 'H';
|
|
||||||
log_event('Sensor High Limit Updated: ' . $class . ' ' . $type . ' ' . $index . ' ' . $descr . ' (' . $high_limit . ')', $device, 'sensor', 3, $sensor_entry['sensor_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((string) $sensor_entry['sensor_limit_low'] != (string) $low_limit && $sensor_entry['sensor_custom'] == 'No') {
|
|
||||||
$update = ['sensor_limit_low' => $low_limit];
|
|
||||||
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', [$sensor_entry['sensor_id']]);
|
|
||||||
d_echo("( $updated updated )\n");
|
|
||||||
|
|
||||||
echo 'L';
|
|
||||||
log_event('Sensor Low Limit Updated: ' . $class . ' ' . $type . ' ' . $index . ' ' . $descr . ' (' . $low_limit . ')', $device, 'sensor', 3, $sensor_entry['sensor_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((string) $warn_limit != (string) $sensor_entry['sensor_limit_warn'] && $sensor_entry['sensor_custom'] == 'No') {
|
|
||||||
$update = ['sensor_limit_warn' => $warn_limit];
|
|
||||||
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', [$sensor_entry['sensor_id']]);
|
|
||||||
d_echo("( $updated updated )\n");
|
|
||||||
|
|
||||||
echo 'WH';
|
|
||||||
log_event('Sensor Warn High Limit Updated: ' . $class . ' ' . $type . ' ' . $index . ' ' . $descr . ' (' . $warn_limit . ')', $device, 'sensor', 3, $sensor_entry['sensor_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((string) $sensor_entry['sensor_limit_low_warn'] != (string) $low_warn_limit && $sensor_entry['sensor_custom'] == 'No') {
|
|
||||||
$update = ['sensor_limit_low_warn' => $low_warn_limit];
|
|
||||||
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', [$sensor_entry['sensor_id']]);
|
|
||||||
d_echo("( $updated updated )\n");
|
|
||||||
|
|
||||||
echo 'WL';
|
|
||||||
log_event('Sensor Warn Low Limit Updated: ' . $class . ' ' . $type . ' ' . $index . ' ' . $descr . ' (' . $low_warn_limit . ')', $device, 'sensor', 3, $sensor_entry['sensor_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($oid == $sensor_entry['sensor_oid'] &&
|
|
||||||
$descr == $sensor_entry['sensor_descr'] &&
|
|
||||||
$multiplier == $sensor_entry['sensor_multiplier'] &&
|
|
||||||
$divisor == $sensor_entry['sensor_divisor'] &&
|
|
||||||
$entPhysicalIndex_measured == $sensor_entry['entPhysicalIndex_measured'] &&
|
|
||||||
$entPhysicalIndex == $sensor_entry['entPhysicalIndex'] &&
|
|
||||||
$user_func == $sensor_entry['user_func'] &&
|
|
||||||
$group == $sensor_entry['group']
|
|
||||||
|
|
||||||
) {
|
|
||||||
echo '.';
|
|
||||||
} else {
|
|
||||||
$update = [
|
|
||||||
'sensor_oid' => $oid,
|
|
||||||
'sensor_descr' => $descr,
|
|
||||||
'sensor_multiplier' => $multiplier,
|
|
||||||
'sensor_divisor' => $divisor,
|
|
||||||
'entPhysicalIndex' => $entPhysicalIndex,
|
|
||||||
'entPhysicalIndex_measured' => $entPhysicalIndex_measured,
|
|
||||||
'user_func' => $user_func,
|
|
||||||
'group' => $group,
|
|
||||||
];
|
|
||||||
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', [$sensor_entry['sensor_id']]);
|
|
||||||
echo 'U';
|
|
||||||
log_event('Sensor Updated: ' . $class . ' ' . $type . ' ' . $index . ' ' . $descr, $device, 'sensor', 3, $sensor_entry['sensor_id']);
|
|
||||||
d_echo("( $updated updated )\n");
|
|
||||||
}
|
|
||||||
}//end if
|
|
||||||
$valid[$class][$type][$index] = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//end discover_sensor()
|
|
||||||
|
|
||||||
function sensor_low_limit($class, $current)
|
|
||||||
{
|
|
||||||
// matching an empty case executes code until a break is reached
|
|
||||||
switch ($class) {
|
|
||||||
case 'temperature':
|
|
||||||
$limit = $current - 10;
|
|
||||||
break;
|
|
||||||
case 'voltage':
|
|
||||||
$limit = $current * 0.85;
|
|
||||||
break;
|
|
||||||
case 'humidity':
|
|
||||||
$limit = 30;
|
|
||||||
break;
|
|
||||||
case 'fanspeed':
|
|
||||||
$limit = $current * 0.80;
|
|
||||||
break;
|
|
||||||
case 'power_factor':
|
|
||||||
$limit = -1;
|
|
||||||
break;
|
|
||||||
case 'signal':
|
|
||||||
$limit = -80;
|
|
||||||
break;
|
|
||||||
case 'airflow':
|
|
||||||
case 'snr':
|
|
||||||
case 'frequency':
|
|
||||||
case 'pressure':
|
|
||||||
case 'cooling':
|
|
||||||
$limit = $current * 0.95;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}//end switch
|
|
||||||
|
|
||||||
return round($limit, 11);
|
|
||||||
}
|
|
||||||
|
|
||||||
//end sensor_low_limit()
|
|
||||||
|
|
||||||
function sensor_limit($class, $current)
|
|
||||||
{
|
|
||||||
// matching an empty case executes code until a break is reached
|
|
||||||
switch ($class) {
|
|
||||||
case 'temperature':
|
|
||||||
$limit = $current + 20;
|
|
||||||
break;
|
|
||||||
case 'voltage':
|
|
||||||
$limit = $current * 1.15;
|
|
||||||
break;
|
|
||||||
case 'humidity':
|
|
||||||
$limit = 70;
|
|
||||||
break;
|
|
||||||
case 'fanspeed':
|
|
||||||
$limit = $current * 1.80;
|
|
||||||
break;
|
|
||||||
case 'power_factor':
|
|
||||||
$limit = 1;
|
|
||||||
break;
|
|
||||||
case 'signal':
|
|
||||||
$limit = -30;
|
|
||||||
break;
|
|
||||||
case 'load':
|
|
||||||
$limit = 80;
|
|
||||||
break;
|
|
||||||
case 'airflow':
|
|
||||||
case 'snr':
|
|
||||||
case 'frequency':
|
|
||||||
case 'pressure':
|
|
||||||
case 'cooling':
|
|
||||||
$limit = $current * 1.05;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}//end switch
|
|
||||||
|
|
||||||
return round($limit, 11);
|
|
||||||
}
|
|
||||||
|
|
||||||
//end sensor_limit()
|
|
||||||
|
|
||||||
function check_valid_sensors($device, $class, $valid, $poller_type = 'snmp')
|
|
||||||
{
|
|
||||||
$entries = dbFetchRows('SELECT * FROM sensors AS S, devices AS D WHERE S.sensor_class=? AND S.device_id = D.device_id AND D.device_id = ? AND S.poller_type = ?', [$class, $device['device_id'], $poller_type]);
|
|
||||||
|
|
||||||
if (count($entries)) {
|
|
||||||
foreach ($entries as $entry) {
|
|
||||||
$index = $entry['sensor_index'];
|
|
||||||
$type = $entry['sensor_type'];
|
|
||||||
$class = $entry['sensor_class'];
|
|
||||||
d_echo($index . ' -> ' . $type . "\n");
|
|
||||||
|
|
||||||
if (! $valid[$class][$type][$index]) {
|
|
||||||
echo '-';
|
|
||||||
if ($class == 'state') {
|
|
||||||
dbDelete('sensors_to_state_indexes', '`sensor_id` = ?', [$entry['sensor_id']]);
|
|
||||||
}
|
|
||||||
dbDelete('sensors', '`sensor_id` = ?', [$entry['sensor_id']]);
|
|
||||||
log_event('Sensor Deleted: ' . $entry['sensor_class'] . ' ' . $entry['sensor_type'] . ' ' . $entry['sensor_index'] . ' ' . $entry['sensor_descr'], $device, 'sensor', 3, $entry['sensor_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($oid);
|
|
||||||
unset($type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//end check_valid_sensors()
|
|
||||||
|
|
||||||
function discover_juniAtmVp(&$valid, $device, $port_id, $vp_id, $vp_descr)
|
function discover_juniAtmVp(&$valid, $device, $port_id, $vp_id, $vp_descr)
|
||||||
{
|
{
|
||||||
d_echo("Discover Juniper ATM VP: $port_id, $vp_id, $vp_descr\n");
|
d_echo("Discover Juniper ATM VP: $port_id, $vp_id, $vp_descr\n");
|
||||||
@ -854,12 +626,11 @@ function ignore_storage($os, $descr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $valid
|
|
||||||
* @param OS $os
|
* @param OS $os
|
||||||
* @param $sensor_type
|
* @param $sensor_type
|
||||||
* @param $pre_cache
|
* @param $pre_cache
|
||||||
*/
|
*/
|
||||||
function discovery_process(&$valid, $os, $sensor_class, $pre_cache)
|
function discovery_process($os, $sensor_class, $pre_cache)
|
||||||
{
|
{
|
||||||
$discovery = $os->getDiscovery('sensors');
|
$discovery = $os->getDiscovery('sensors');
|
||||||
$device = $os->getDeviceArray();
|
$device = $os->getDeviceArray();
|
||||||
@ -998,7 +769,7 @@ function discovery_process(&$valid, $os, $sensor_class, $pre_cache)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], $sensor_class, $device, $oid, $uindex, $sensor_name, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_function, $group, $data['rrd_type'] ?? 'GAUGE');
|
discover_sensor(null, $sensor_class, $device, $oid, $uindex, $sensor_name, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_function, $group, $data['rrd_type'] ?? 'GAUGE');
|
||||||
|
|
||||||
if ($sensor_class === 'state') {
|
if ($sensor_class === 'state') {
|
||||||
create_sensor_to_state_index($device, $sensor_name, $uindex);
|
create_sensor_to_state_index($device, $sensor_name, $uindex);
|
||||||
@ -1014,7 +785,7 @@ function discovery_process(&$valid, $os, $sensor_class, $pre_cache)
|
|||||||
* @param OS $os
|
* @param OS $os
|
||||||
* @param array $pre_cache
|
* @param array $pre_cache
|
||||||
*/
|
*/
|
||||||
function sensors($types, $os, $valid, $pre_cache = [])
|
function sensors($types, $os, $pre_cache = [])
|
||||||
{
|
{
|
||||||
$device = &$os->getDeviceArray();
|
$device = &$os->getDeviceArray();
|
||||||
foreach ((array) $types as $sensor_class) {
|
foreach ((array) $types as $sensor_class) {
|
||||||
@ -1032,9 +803,8 @@ function sensors($types, $os, $valid, $pre_cache = [])
|
|||||||
include $dir . '/rfc1628.inc.php';
|
include $dir . '/rfc1628.inc.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
discovery_process($valid, $os, $sensor_class, $pre_cache);
|
discovery_process($os, $sensor_class, $pre_cache);
|
||||||
d_echo($valid['sensor'][$sensor_class] ?? []);
|
app('sensor-discovery')->sync(sensor_class: $sensor_class, poller_type: 'snmp');
|
||||||
check_valid_sensors($device, $sensor_class, $valid['sensor']);
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
use LibreNMS\OS;
|
use LibreNMS\OS;
|
||||||
|
|
||||||
$valid['sensor'] = [];
|
|
||||||
|
|
||||||
/** @var OS $os */
|
/** @var OS $os */
|
||||||
$pre_cache = $os->preCache();
|
$pre_cache = $os->preCache();
|
||||||
|
|
||||||
@ -84,7 +82,7 @@ $run_sensors = [
|
|||||||
// filter submodules
|
// filter submodules
|
||||||
$run_sensors = array_intersect($run_sensors, Config::get('discovery_submodules.sensors', $run_sensors));
|
$run_sensors = array_intersect($run_sensors, Config::get('discovery_submodules.sensors', $run_sensors));
|
||||||
|
|
||||||
sensors($run_sensors, $os, $valid, $pre_cache);
|
sensors($run_sensors, $os, $pre_cache);
|
||||||
unset(
|
unset(
|
||||||
$pre_cache,
|
$pre_cache,
|
||||||
$run_sensors,
|
$run_sensors,
|
||||||
|
@ -28,6 +28,6 @@ foreach ($pre_cache['cooling_unit_analog'] as $index => $data) {
|
|||||||
$scale = $data['coolingUnitStatusAnalogScale'] ?? null;
|
$scale = $data['coolingUnitStatusAnalogScale'] ?? null;
|
||||||
$value = $data['coolingUnitStatusAnalogValue'] ?? null;
|
$value = $data['coolingUnitStatusAnalogValue'] ?? null;
|
||||||
if (preg_match('/Airflow/', $descr) && $data['coolingUnitStatusAnalogUnits'] == 'CFM' && $value >= 0) {
|
if (preg_match('/Airflow/', $descr) && $data['coolingUnitStatusAnalogUnits'] == 'CFM' && $value >= 0) {
|
||||||
discover_sensor($valid['sensor'], 'airflow', $device, $cur_oid, $cur_oid, 'apc', $descr, $scale, 1, null, null, null, null, $value);
|
discover_sensor(null, 'airflow', $device, $cur_oid, $cur_oid, 'apc', $descr, $scale, 1, null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,5 @@ $value = snmp_get($device, 'climateAirflow', '-Oqv', 'GEIST-MIB-V3');
|
|||||||
$current_oid = '.1.3.6.1.4.1.21239.2.2.1.9.1';
|
$current_oid = '.1.3.6.1.4.1.21239.2.2.1.9.1';
|
||||||
$descr = 'Airflow';
|
$descr = 'Airflow';
|
||||||
if (is_numeric($value)) {
|
if (is_numeric($value)) {
|
||||||
discover_sensor($valid['sensor'], 'airflow', $device, $current_oid, 'climateAirflow', 'geist-watchdog', $descr, 1, 1, null, null, null, null, $value);
|
discover_sensor(null, 'airflow', $device, $current_oid, 'climateAirflow', 'geist-watchdog', $descr, 1, 1, null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,6 @@ foreach ($pre_cache['infineragroove_portTable'] as $index => $data) {
|
|||||||
$oid = '.1.3.6.1.4.1.42229.1.2.4.1.19.1.1.26.' . $index;
|
$oid = '.1.3.6.1.4.1.42229.1.2.4.1.19.1.1.26.' . $index;
|
||||||
$value = $data['ochOsPreFecBer'];
|
$value = $data['ochOsPreFecBer'];
|
||||||
$divisor = 1;
|
$divisor = 1;
|
||||||
discover_sensor($valid['sensor'], 'ber', $device, $oid, 'ochOsPreFecBer.' . $index, 'infinera-groove', $descr, $divisor, '1', null, null, null, null, $value);
|
discover_sensor(null, 'ber', $device, $oid, 'ochOsPreFecBer.' . $index, 'infinera-groove', $descr, $divisor, '1', null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ if (is_array($pre_cache['transfer'])) {
|
|||||||
$limitwarn = $defrate * 0.8; //80%
|
$limitwarn = $defrate * 0.8; //80%
|
||||||
$lowlimit = 0;
|
$lowlimit = 0;
|
||||||
$lowwarnlimit = $defrate * 0.1; //10%
|
$lowwarnlimit = $defrate * 0.1; //10%
|
||||||
discover_sensor($valid['sensor'], 'bitrate', $device, $oid, $key, $type, $descr, $divisor, 1, $lowlimit, $lowwarnlimit, $limitwarn, $limit, $value, 'snmp', null, null, null, $group);
|
discover_sensor(null, 'bitrate', $device, $oid, $key, $type, $descr, $divisor, 1, $lowlimit, $lowwarnlimit, $limitwarn, $limit, $value, 'snmp', null, null, null, $group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ if (is_array($pre_cache['sdi410cstatus'])) {
|
|||||||
$value = $br * $multiplier;
|
$value = $br * $multiplier;
|
||||||
$group = 'Streams';
|
$group = 'Streams';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'bitrate',
|
'bitrate',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -42,7 +42,7 @@ if (is_array($pre_cache['sdi480status'])) {
|
|||||||
$value = $br * $multiplier;
|
$value = $br * $multiplier;
|
||||||
$group = 'Inputs';
|
$group = 'Inputs';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'bitrate',
|
'bitrate',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -75,7 +75,7 @@ if (is_array($pre_cache['sdi480status'])) {
|
|||||||
$value = $br * $multiplier;
|
$value = $br * $multiplier;
|
||||||
$group = 'Streams';
|
$group = 'Streams';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'bitrate',
|
'bitrate',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -19,7 +19,7 @@ if (! empty($oids)) {
|
|||||||
$warnlimit = 10;
|
$warnlimit = 10;
|
||||||
$descr = 'Battery Charge';
|
$descr = 'Battery Charge';
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'charge', $device, $current_oid, $index, $sensorType, $descr, $precision, 1, $lowlimit, $warnlimit, null, $limit, $current_val);
|
discover_sensor(null, 'charge', $device, $current_oid, $index, $sensorType, $descr, $precision, 1, $lowlimit, $warnlimit, null, $limit, $current_val);
|
||||||
} else {
|
} else {
|
||||||
// Try to just get capacity
|
// Try to just get capacity
|
||||||
$oids = snmp_get($device, '.1.3.6.1.4.1.318.1.1.1.2.2.1.0', '-OsqnU');
|
$oids = snmp_get($device, '.1.3.6.1.4.1.318.1.1.1.2.2.1.0', '-OsqnU');
|
||||||
@ -40,6 +40,6 @@ if (! empty($oids)) {
|
|||||||
$warnlimit = 10;
|
$warnlimit = 10;
|
||||||
$descr = 'Battery Charge';
|
$descr = 'Battery Charge';
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'charge', $device, $current_oid, $index, $sensorType, $descr, $precision, 1, $lowlimit, $warnlimit, null, $limit, $current_val);
|
discover_sensor(null, 'charge', $device, $current_oid, $index, $sensorType, $descr, $precision, 1, $lowlimit, $warnlimit, null, $limit, $current_val);
|
||||||
}
|
}
|
||||||
}//end if
|
}//end if
|
||||||
|
@ -28,5 +28,5 @@ $index = 0;
|
|||||||
if (is_numeric($chargeCapacity)) {
|
if (is_numeric($chargeCapacity)) {
|
||||||
$sensorType = 'compas';
|
$sensorType = 'compas';
|
||||||
$descr = 'Battery Charge';
|
$descr = 'Battery Charge';
|
||||||
discover_sensor($valid['sensor'], 'charge', $device, $curOID, $index, $sensorType, $descr, '1', '1', null, null, null, null, $chargeCapacity);
|
discover_sensor(null, 'charge', $device, $curOID, $index, $sensorType, $descr, '1', '1', null, null, null, null, $chargeCapacity);
|
||||||
}
|
}
|
||||||
|
@ -24,5 +24,5 @@ $ups_device_model = str_replace('"', '', snmp_get($device, $ups_device_model_oid
|
|||||||
$ups_charge_oid = '.1.3.6.1.4.1.6574.4.3.1.1.0';
|
$ups_charge_oid = '.1.3.6.1.4.1.6574.4.3.1.1.0';
|
||||||
$ups_charge = snmp_get($device, $ups_charge_oid, '-Oqv');
|
$ups_charge = snmp_get($device, $ups_charge_oid, '-Oqv');
|
||||||
if (is_numeric($ups_charge)) {
|
if (is_numeric($ups_charge)) {
|
||||||
discover_sensor($valid['sensor'], 'charge', $device, $ups_charge_oid, 'UPSChargeValue', $ups_device_manufacturer . ' ' . $ups_device_model, 'UPS Charge Value', 1, 1, 0, 10, null, 100, $ups_charge);
|
discover_sensor(null, 'charge', $device, $ups_charge_oid, 'UPSChargeValue', $ups_device_manufacturer . ' ' . $ups_device_model, 'UPS Charge Value', 1, 1, 0, 10, null, 100, $ups_charge);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ if (! empty($charge)) {
|
|||||||
$descr = 'Battery Charge';
|
$descr = 'Battery Charge';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'charge',
|
'charge',
|
||||||
$device,
|
$device,
|
||||||
$charge_oid,
|
$charge_oid,
|
||||||
|
@ -40,7 +40,7 @@ if ($oids) {
|
|||||||
$lowwarnlimit = 10;
|
$lowwarnlimit = 10;
|
||||||
$descr = 'Battery Charge';
|
$descr = 'Battery Charge';
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'charge', $device, $oid, $index, $type, $descr, 1, 1, $lowlimit, $lowwarnlimit, $limitwarn, $limit, $value);
|
discover_sensor(null, 'charge', $device, $oid, $index, $type, $descr, 1, 1, $lowlimit, $lowwarnlimit, $limitwarn, $limit, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ if (preg_match('/(Linux).+(ntc)/', $device['sysDescr'])) {
|
|||||||
$index = '116.8';
|
$index = '116.8';
|
||||||
$value = snmp_get($device, $oid . $index, '-Oqv');
|
$value = snmp_get($device, $oid . $index, '-Oqv');
|
||||||
if (is_numeric($value)) {
|
if (is_numeric($value)) {
|
||||||
discover_sensor($valid['sensor'], 'charge', $device, $oid . $index, $index, $sensor_type, $descr, 1, 1, $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value);
|
discover_sensor(null, 'charge', $device, $oid . $index, $index, $sensor_type, $descr, 1, 1, $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ if (! empty($charge)) {
|
|||||||
$descr = 'Battery Charge';
|
$descr = 'Battery Charge';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'charge',
|
'charge',
|
||||||
$device,
|
$device,
|
||||||
$charge_oid,
|
$charge_oid,
|
||||||
|
@ -7,7 +7,7 @@ $value = snmp_get($device, 'upsEstimatedChargeRemaining.0', '-OvqU', 'UPS-MIB');
|
|||||||
|
|
||||||
if (is_numeric($value)) {
|
if (is_numeric($value)) {
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'charge',
|
'charge',
|
||||||
$device,
|
$device,
|
||||||
'.1.3.6.1.2.1.33.1.2.4.0',
|
'.1.3.6.1.2.1.33.1.2.4.0',
|
||||||
|
@ -34,7 +34,7 @@ if (! empty($charge)) {
|
|||||||
$descr = 'Battery Charge';
|
$descr = 'Battery Charge';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'charge',
|
'charge',
|
||||||
$device,
|
$device,
|
||||||
$charge_oid,
|
$charge_oid,
|
||||||
|
@ -36,7 +36,7 @@ if (! empty($snmpData)) {
|
|||||||
if (! empty($value)) {
|
if (! empty($value)) {
|
||||||
$oid = Oid::toNumeric('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut".' . $index);
|
$oid = Oid::toNumeric('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut".' . $index);
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'charge',
|
'charge',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -27,6 +27,6 @@ foreach ($pre_cache['infineragroove_portTable'] as $index => $data) {
|
|||||||
$descr = $data['portAlias'] . ' CD';
|
$descr = $data['portAlias'] . ' CD';
|
||||||
$oid = '.1.3.6.1.4.1.42229.1.2.4.1.19.1.1.23.' . $index;
|
$oid = '.1.3.6.1.4.1.42229.1.2.4.1.19.1.1.23.' . $index;
|
||||||
$value = $data['ochOsCD'];
|
$value = $data['ochOsCD'];
|
||||||
discover_sensor($valid['sensor'], 'chromatic_dispersion', $device, $oid, 'ochOsCD.' . $index, 'infinera-groove', $descr, null, '1', null, null, null, null, $value);
|
discover_sensor(null, 'chromatic_dispersion', $device, $oid, 'ochOsCD.' . $index, 'infinera-groove', $descr, null, '1', null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', ucwords($descr), $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity'], null);
|
discover_sensor(null, $type, $device, $oid, $index, 'cisco-entity-sensor', ucwords($descr), $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity'], null);
|
||||||
//Cisco IOS-XR : add a fake sensor to graph as dbm
|
//Cisco IOS-XR : add a fake sensor to graph as dbm
|
||||||
if ($type == 'power' and $device['os'] == 'iosxr' and (preg_match('/power (R|T)x/i', $descr) or preg_match('/(R|T)x Power/i', $descr) or preg_match('/(R|T)x Lane/i', $descr))) {
|
if ($type == 'power' and $device['os'] == 'iosxr' and (preg_match('/power (R|T)x/i', $descr) or preg_match('/(R|T)x Power/i', $descr) or preg_match('/(R|T)x Lane/i', $descr))) {
|
||||||
// convert Watts to dbm
|
// convert Watts to dbm
|
||||||
@ -235,7 +235,7 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
$limit = isset($limit_low) ? round(mw_to_dbm($limit * $multiplier), 3) : null;
|
$limit = isset($limit_low) ? round(mw_to_dbm($limit * $multiplier), 3) : null;
|
||||||
$current = mw_to_dbm($current * $multiplier);
|
$current = mw_to_dbm($current * $multiplier);
|
||||||
//echo("\n".$valid['sensor'].", $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, $user_func");
|
//echo("\n".$valid['sensor'].", $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, $user_func");
|
||||||
discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity'], $user_func);
|
discover_sensor(null, $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity'], $user_func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,4 +247,8 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
unset(
|
unset(
|
||||||
$entity_array
|
$entity_array
|
||||||
);
|
);
|
||||||
|
|
||||||
|
foreach (array_flip($entitysensor) as $type) {
|
||||||
|
app('sensor-discovery')->sync(sensor_class: $type, poller_type: 'snmp');
|
||||||
|
}
|
||||||
}//end if
|
}//end if
|
||||||
|
@ -19,7 +19,7 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.25766')) {
|
if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.25766')) {
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'count',
|
'count',
|
||||||
$device,
|
$device,
|
||||||
'.1.3.6.1.4.1.25766.1.12.1.1.3.5.1.6.1',
|
'.1.3.6.1.4.1.25766.1.12.1.1.3.5.1.6.1',
|
||||||
|
@ -31,6 +31,6 @@ foreach ($tables as $tablevalue) {
|
|||||||
} else {
|
} else {
|
||||||
$descr = ucwords($temp[$index][$tablevalue['descr']]);
|
$descr = ucwords($temp[$index][$tablevalue['descr']]);
|
||||||
}
|
}
|
||||||
discover_sensor($valid['sensor'], 'count', $device, $cur_oid . $index, $index, $state_name, $descr, 1, 1, null, null, null, null, $temp[$index][$tablevalue['state_name']], 'snmp', $index);
|
discover_sensor(null, 'count', $device, $cur_oid . $index, $index, $state_name, $descr, 1, 1, null, null, null, null, $temp[$index][$tablevalue['state_name']], 'snmp', $index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ foreach ($oids as $index => $entry) {
|
|||||||
|
|
||||||
if (! empty($current) && $current !== 'FULL:0') {
|
if (! empty($current) && $current !== 'FULL:0') {
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
$class,
|
$class,
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -19,7 +19,7 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.1248.4.1')) {
|
if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.1248.4.1')) {
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'count',
|
'count',
|
||||||
$device,
|
$device,
|
||||||
'.1.3.6.1.4.1.1248.4.1.1.1.1.0',
|
'.1.3.6.1.4.1.1248.4.1.1.1.1.0',
|
||||||
|
@ -24,7 +24,7 @@ if (! empty($licenseOids)) {
|
|||||||
$descr = $entry['fgLicContractDesc'];
|
$descr = $entry['fgLicContractDesc'];
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'count',
|
'count',
|
||||||
$device,
|
$device,
|
||||||
'.1.3.6.1.4.1.12356.101.4.6.3.1.2.1.2.' . $index,
|
'.1.3.6.1.4.1.12356.101.4.6.3.1.2.1.2.' . $index,
|
||||||
@ -64,7 +64,7 @@ foreach ($session_rate as $descr => $oid) {
|
|||||||
$result = str_replace(' Sessions Per Second', '', $result);
|
$result = str_replace(' Sessions Per Second', '', $result);
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'count',
|
'count',
|
||||||
$device,
|
$device,
|
||||||
$oid_num . '.0',
|
$oid_num . '.0',
|
||||||
@ -97,7 +97,7 @@ if ($systemMode == 'activePassive' || $systemMode == 'activeActive') {
|
|||||||
|
|
||||||
// Create a count sensor and set warning to current cluster count
|
// Create a count sensor and set warning to current cluster count
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'count',
|
'count',
|
||||||
$device,
|
$device,
|
||||||
$fgHaStatsIndex_num,
|
$fgHaStatsIndex_num,
|
||||||
|
@ -15,7 +15,7 @@ $walk = snmpwalk_cache_oid($device, 'prtMarkerTable', [], 'Printer-MIB');
|
|||||||
|
|
||||||
foreach ($walk as $index => $data) {
|
foreach ($walk as $index => $data) {
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'count',
|
'count',
|
||||||
$device,
|
$device,
|
||||||
'.1.3.6.1.2.1.43.10.2.1.4.' . $index, // Printer-MIB::prtMarkerLifeCount.1.1
|
'.1.3.6.1.2.1.43.10.2.1.4.' . $index, // Printer-MIB::prtMarkerLifeCount.1.1
|
||||||
@ -32,7 +32,7 @@ foreach ($walk as $index => $data) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'count',
|
'count',
|
||||||
$device,
|
$device,
|
||||||
'.1.3.6.1.2.1.43.10.2.1.5.' . $index, // Printer-MIB::prtMarkerPowerOnCount.1.1
|
'.1.3.6.1.2.1.43.10.2.1.5.' . $index, // Printer-MIB::prtMarkerPowerOnCount.1.1
|
||||||
@ -68,7 +68,7 @@ if ($device['os'] == 'konica') {
|
|||||||
$oidArray = explode('.', $oid);
|
$oidArray = explode('.', $oid);
|
||||||
$maxKey = max(array_keys($oidArray));
|
$maxKey = max(array_keys($oidArray));
|
||||||
$index = str_replace(' ', '', ucwords($cntName)) . '.' . $oidArray[$maxKey - 1] . '.' . $oidArray[$maxKey];
|
$index = str_replace(' ', '', ucwords($cntName)) . '.' . $oidArray[$maxKey - 1] . '.' . $oidArray[$maxKey];
|
||||||
discover_sensor($valid['sensor'], 'count', $device, $oid, $index, $device['os'], $cntName, 1, 1, null, null, null, null, $value, 'snmp', null, null, null, 'Konica MIB');
|
discover_sensor(null, 'count', $device, $oid, $index, $device['os'], $cntName, 1, 1, null, null, null, null, $value, 'snmp', null, null, null, 'Konica MIB');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.8741.6')) {
|
|||||||
$current = snmp_get($device, '.1.3.6.1.4.1.8741.6.2.1.9.0', '-Ovq');
|
$current = snmp_get($device, '.1.3.6.1.4.1.8741.6.2.1.9.0', '-Ovq');
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'count',
|
'count',
|
||||||
$device,
|
$device,
|
||||||
'.1.3.6.1.4.1.8741.6.2.1.9.0', // SNWL-SSLVPN-MIB::activeUserLicense.0
|
'.1.3.6.1.4.1.8741.6.2.1.9.0', // SNWL-SSLVPN-MIB::activeUserLicense.0
|
||||||
|
@ -42,7 +42,7 @@ foreach ($prefixes as $prefix => $numOidPrefix) {
|
|||||||
if ($oid[$prefix . 'Units']) {
|
if ($oid[$prefix . 'Units']) {
|
||||||
$descr .= '(' . $oid[$prefix . 'Units'] . ')';
|
$descr .= '(' . $oid[$prefix . 'Units'] . ')';
|
||||||
}
|
}
|
||||||
discover_sensor($valid['sensor'], 'count', $device, $num_oid, $prefix . 'LiveRaw.' . $index, 'webmon', $descr, '1', '1', $lowLimit, $lowWarnLimit, $highWarnLimit, $highLimit, $value, 'snmp', null, null, null, $group);
|
discover_sensor(null, 'count', $device, $num_oid, $prefix . 'LiveRaw.' . $index, 'webmon', $descr, '1', '1', $lowLimit, $lowWarnLimit, $highWarnLimit, $highLimit, $value, 'snmp', null, null, null, $group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ foreach (array_keys($pre_cache['adva_fsp150']) as $index) {
|
|||||||
$current = $pre_cache['adva_fsp150'][$index][$entry['sensor_name']] / $divisor;
|
$current = $pre_cache['adva_fsp150'][$index][$entry['sensor_name']] / $divisor;
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -73,7 +73,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$descr = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetNetPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetNetPortIfIndex']) . ' BIAS';
|
$descr = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetNetPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetNetPortIfIndex']) . ' BIAS';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -102,7 +102,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
$descr = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetAccPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetAccPortIfIndex']) . ' BIAS';
|
$descr = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetAccPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetAccPortIfIndex']) . ' BIAS';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -132,7 +132,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$descr = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetTrafficPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetTrafficPortIfIndex']) . ' BIAS';
|
$descr = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetTrafficPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetTrafficPortIfIndex']) . ' BIAS';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -31,7 +31,7 @@ if (is_array($pre_cache['adva_fsp3kr7_Card'])) {
|
|||||||
$current = $pre_cache['adva_fsp3kr7_Card'][$index]['eqptPhysInstValuePsuAmpere'] / $divisor;
|
$current = $pre_cache['adva_fsp3kr7_Card'][$index]['eqptPhysInstValuePsuAmpere'] / $divisor;
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -39,7 +39,7 @@ if (isset($oids) && $oids) {
|
|||||||
} else {
|
} else {
|
||||||
$descr = 'Output';
|
$descr = 'Output';
|
||||||
}
|
}
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ if (isset($oids) && $oids) {
|
|||||||
} else {
|
} else {
|
||||||
$descr = 'Output';
|
$descr = 'Output';
|
||||||
}
|
}
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ if (isset($oids) && $oids) {
|
|||||||
$lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', '');
|
$lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', '');
|
||||||
$warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', '');
|
$warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', '');
|
||||||
if ($limit != -1 && $lowlimit != -1 && $warnlimit != -1) {
|
if ($limit != -1 && $lowlimit != -1 && $warnlimit != -1) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ if (isset($oids) && $oids) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$descr = 'Outlet ' . $index . ' - ' . snmp_get($device, $name_oid, '-Oqv', '');
|
$descr = 'Outlet ' . $index . ' - ' . snmp_get($device, $name_oid, '-Oqv', '');
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ if (isset($oids) && $oids) {
|
|||||||
$warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', '');
|
$warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', '');
|
||||||
// No / $precision here! Nice, APC!
|
// No / $precision here! Nice, APC!
|
||||||
$descr = 'Output Feed';
|
$descr = 'Output Feed';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, $warnlimit, $limit, $current);
|
||||||
}
|
}
|
||||||
unset($oids);
|
unset($oids);
|
||||||
|
|
||||||
@ -231,10 +231,10 @@ if (isset($in_oids)) {
|
|||||||
$in_index = '3.1.4.' . $index;
|
$in_index = '3.1.4.' . $index;
|
||||||
if (substr($index, 0, 1) == 2 && $data['upsPhaseInputCurrent'] != -1) {
|
if (substr($index, 0, 1) == 2 && $data['upsPhaseInputCurrent'] != -1) {
|
||||||
$descr = 'Phase ' . substr($index, -1) . ' Bypass Input';
|
$descr = 'Phase ' . substr($index, -1) . ' Bypass Input';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $in_index, $type, $descr, $divisor, 0, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $in_index, $type, $descr, $divisor, 0, null, null, null, null, $current);
|
||||||
} elseif (substr($index, 0, 1) == 1) {
|
} elseif (substr($index, 0, 1) == 1) {
|
||||||
$descr = 'Phase ' . substr($index, -1) . ' Input';
|
$descr = 'Phase ' . substr($index, -1) . ' Input';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $in_index, $type, $descr, $divisor, 0, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $in_index, $type, $descr, $divisor, 0, null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ foreach ($oids as $index => $data) {
|
|||||||
$current = $data['upsPhaseOutputCurrent'] / $divisor;
|
$current = $data['upsPhaseOutputCurrent'] / $divisor;
|
||||||
}
|
}
|
||||||
if ($current >= -1) {
|
if ($current >= -1) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, 1, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, $divisor, 1, null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($index);
|
unset($index);
|
||||||
|
@ -15,7 +15,7 @@ if ($pre_cache['awplus-sfpddm']) {
|
|||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.3.1.3.' . $index;
|
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.3.1.3.' . $index;
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -27,7 +27,7 @@ foreach ($pre_cache['ciscosb_rlPhyTestGetResult'] as $index => $ciscosb_data) {
|
|||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
if (is_numeric($current)) {
|
if (is_numeric($current)) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $index, $sensor_type, $descr, $divisor, $multiplier, null, null, null, null, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'current', $device, $oid, $index, $sensor_type, $descr, $divisor, $multiplier, null, null, null, null, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ $oid = '.1.3.6.1.4.1.18642.1.2.2.1.0';
|
|||||||
$descr = 'Battery current';
|
$descr = 'Battery current';
|
||||||
$divisor = 1;
|
$divisor = 1;
|
||||||
$multiplier = 1;
|
$multiplier = 1;
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'batteryCurrent', 'commander-plus', $descr, $divisor, $multiplier, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $oid, 'batteryCurrent', 'commander-plus', $descr, $divisor, $multiplier, null, null, null, null, $current);
|
||||||
|
|
||||||
$current = snmp_get($device, 'rectifierLoadCurrent.0', '-Oqv', 'CCPOWER-MIB');
|
$current = snmp_get($device, 'rectifierLoadCurrent.0', '-Oqv', 'CCPOWER-MIB');
|
||||||
$oid = '.1.3.6.1.4.1.18642.1.2.1.2.0';
|
$oid = '.1.3.6.1.4.1.18642.1.2.1.2.0';
|
||||||
@ -36,4 +36,4 @@ $divisor = 1;
|
|||||||
$multiplier = 1;
|
$multiplier = 1;
|
||||||
$limit_low = 0;
|
$limit_low = 0;
|
||||||
$limit = 5000;
|
$limit = 5000;
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'rectifierLoadCurrent', 'commander-plus', $descr, $divisor, $multiplier, $limit_low, null, null, $limit, $current);
|
discover_sensor(null, 'current', $device, $oid, 'rectifierLoadCurrent', 'commander-plus', $descr, $divisor, $multiplier, $limit_low, null, null, $limit, $current);
|
||||||
|
@ -29,7 +29,7 @@ $index = 'es1dc1DataRectifiersRectifiersOutCurrent';
|
|||||||
if (is_numeric($rectifiersOutputCurrent) && is_numeric($rectifiersOutputCurrentMax)) {
|
if (is_numeric($rectifiersOutputCurrent) && is_numeric($rectifiersOutputCurrentMax)) {
|
||||||
$sensorType = 'compas';
|
$sensorType = 'compas';
|
||||||
$descr = 'Output Current';
|
$descr = 'Output Current';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $curOID, $index, $sensorType, $descr, '1', '1', null, null, null, $rectifiersOutputCurrentMax, $rectifiersOutputCurrent);
|
discover_sensor(null, 'current', $device, $curOID, $index, $sensorType, $descr, '1', '1', null, null, null, $rectifiersOutputCurrentMax, $rectifiersOutputCurrent);
|
||||||
}
|
}
|
||||||
$loadCurrent = snmp_get($device, 'es1dc1DataLoadLoadCurrent.0', '-Ovqe', 'SITE-MONITORING-MIB');
|
$loadCurrent = snmp_get($device, 'es1dc1DataLoadLoadCurrent.0', '-Ovqe', 'SITE-MONITORING-MIB');
|
||||||
$curOID = '.1.3.6.1.4.1.26854.3.2.1.20.1.20.1.13.3.52.0';
|
$curOID = '.1.3.6.1.4.1.26854.3.2.1.20.1.20.1.13.3.52.0';
|
||||||
@ -37,7 +37,7 @@ $index = 'es1dc1DataLoadLoadCurrent';
|
|||||||
if (is_numeric($loadCurrent)) {
|
if (is_numeric($loadCurrent)) {
|
||||||
$sensorType = 'compas';
|
$sensorType = 'compas';
|
||||||
$descr = 'Load Current';
|
$descr = 'Load Current';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $curOID, $index, $sensorType, $descr, '1', '1', null, null, null, null, $loadCurrent);
|
discover_sensor(null, 'current', $device, $curOID, $index, $sensorType, $descr, '1', '1', null, null, null, null, $loadCurrent);
|
||||||
}
|
}
|
||||||
$batteryInputCurrent = snmp_get($device, 'es1dc1DataBatBatInputCurrent.0', '-Ovqe', 'SITE-MONITORING-MIB');
|
$batteryInputCurrent = snmp_get($device, 'es1dc1DataBatBatInputCurrent.0', '-Ovqe', 'SITE-MONITORING-MIB');
|
||||||
$curOID = '.1.3.6.1.4.1.26854.3.2.1.20.1.20.1.13.3.61.0';
|
$curOID = '.1.3.6.1.4.1.26854.3.2.1.20.1.20.1.13.3.61.0';
|
||||||
@ -45,5 +45,5 @@ $index = 'es1dc1DataBatBatInputCurrent';
|
|||||||
if (is_numeric($batteryInputCurrent)) {
|
if (is_numeric($batteryInputCurrent)) {
|
||||||
$sensorType = 'compas';
|
$sensorType = 'compas';
|
||||||
$descr = 'Battery Input Current';
|
$descr = 'Battery Input Current';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $curOID, $index, $sensorType, $descr, '1', '1', null, null, null, null, $batteryInputCurrent);
|
discover_sensor(null, 'current', $device, $curOID, $index, $sensorType, $descr, '1', '1', null, null, null, null, $batteryInputCurrent);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,6 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
|||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
|
|
||||||
$descr = makeshortif($interface['ifDescr']) . ' Bias Current';
|
$descr = makeshortif($interface['ifDescr']) . ' Bias Current';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'bias-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'current', $device, $oid, 'bias-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,5 @@ if ($oids) {
|
|||||||
$type = 'cyberpower';
|
$type = 'cyberpower';
|
||||||
$descr = 'Input';
|
$descr = 'Input';
|
||||||
$current = $current / 10;
|
$current = $current / 10;
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, '0', $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $oid, '0', $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,5 @@ if ($oids) {
|
|||||||
$type = 'digipower';
|
$type = 'digipower';
|
||||||
$descr = 'Input';
|
$descr = 'Input';
|
||||||
$current = $current / 10;
|
$current = $current / 10;
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 0, $type, $descr, $divisor, 1, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $oid, 0, $type, $descr, $divisor, 1, null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@ if (is_array($data)) {
|
|||||||
$cur_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.3.';
|
$cur_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.3.';
|
||||||
foreach ($data as $index => $entry) {
|
foreach ($data as $index => $entry) {
|
||||||
$i++;
|
$i++;
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $cur_oid . $index, $i, 'eatonpdu', $descr[$index]['outletName'], '1000', '1', null, null, null, null, $data[$index]['outletCurrent'], 'snmp', $index);
|
discover_sensor(null, 'current', $device, $cur_oid . $index, $i, 'eatonpdu', $descr[$index]['outletName'], '1000', '1', null, null, null, null, $data[$index]['outletCurrent'], 'snmp', $index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ foreach ($oids as $current_id => $data) {
|
|||||||
$type = 'xups';
|
$type = 'xups';
|
||||||
$index = '1.2.3.' . $current_id;
|
$index = '1.2.3.' . $current_id;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oids = snmpwalk_cache_oid($device, 'xupsOutputCurrent', [], 'XUPS-MIB');
|
$oids = snmpwalk_cache_oid($device, 'xupsOutputCurrent', [], 'XUPS-MIB');
|
||||||
@ -28,7 +28,7 @@ foreach ($oids as $current_id => $data) {
|
|||||||
$divisor = 1;
|
$divisor = 1;
|
||||||
$index = '4.4.1.3.' . $current_id;
|
$index = '4.4.1.3.' . $current_id;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oids = snmpwalk_cache_oid($device, 'xupsInputCurrent', [], 'XUPS-MIB');
|
$oids = snmpwalk_cache_oid($device, 'xupsInputCurrent', [], 'XUPS-MIB');
|
||||||
@ -44,5 +44,5 @@ foreach ($oids as $current_id => $data) {
|
|||||||
$divisor = 1;
|
$divisor = 1;
|
||||||
$index = '3.4.1.3.' . $current_id;
|
$index = '3.4.1.3.' . $current_id;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ if ($oids) {
|
|||||||
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'], 'current', $device, $split, 'txbias' . $ifIndex, 'rlPhyTestTableTxBias', 'SfpTxBias-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value
|
null, 'current', $device, $split, 'txbias' . $ifIndex, 'rlPhyTestTableTxBias', 'SfpTxBias-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ if ($pre_cache['eltex-mes23xx-sfp']) {
|
|||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
$oid = '.1.3.6.1.4.1.89.90.1.2.1.3.' . $ifIndex . '.7';
|
$oid = '.1.3.6.1.4.1.89.90.1.2.1.3.' . $ifIndex . '.7';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -46,7 +46,7 @@ if (! empty($eltexPhyTransceiverDiagnosticTable['txBiasCurrent'])) {
|
|||||||
$descr = get_port_by_index_cache($device['device_id'], $ifIndex)['ifName'];
|
$descr = get_port_by_index_cache($device['device_id'], $ifIndex)['ifName'];
|
||||||
$oid = Oid::toNumeric('ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.' . $ifIndex . '.3.1');
|
$oid = Oid::toNumeric('ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.' . $ifIndex . '.3.1');
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -35,7 +35,7 @@ foreach ($pre_cache['enlogic_pdu_input'] as $index => $data) {
|
|||||||
$high_warn = $data['pduInputPhaseConfigCurrentUpperWarningThreshold'];
|
$high_warn = $data['pduInputPhaseConfigCurrentUpperWarningThreshold'];
|
||||||
$current = $data['pduInputPhaseStatusCurrent'];
|
$current = $data['pduInputPhaseStatusCurrent'];
|
||||||
if ($current > 0) {
|
if ($current > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $tmp_index, $type, $descr, $divisor, '1', $low_limit, $low_warn, $high_warn, $high_limit, $current);
|
discover_sensor(null, 'current', $device, $oid, $tmp_index, $type, $descr, $divisor, '1', $low_limit, $low_warn, $high_warn, $high_limit, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ foreach ($pre_cache['enlogic_pdu_circuit'] as $index => $data) {
|
|||||||
$high_warn = $data['pduCircuitBreakerConfigUpperWarningThreshold'];
|
$high_warn = $data['pduCircuitBreakerConfigUpperWarningThreshold'];
|
||||||
$current = $data['pduCircuitBreakerStatusCurrent'];
|
$current = $data['pduCircuitBreakerStatusCurrent'];
|
||||||
if ($current > 0) {
|
if ($current > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $tmp_index, $type, $descr, $divisor, '1', $low_limit, $low_warn, $high_warn, $high_limit, $current);
|
discover_sensor(null, 'current', $device, $oid, $tmp_index, $type, $descr, $divisor, '1', $low_limit, $low_warn, $high_warn, $high_limit, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,5 @@
|
|||||||
$oid = '.1.3.6.1.4.1.30966.10.3.2.4.0';
|
$oid = '.1.3.6.1.4.1.30966.10.3.2.4.0';
|
||||||
$current = snmp_get($device, $oid, '-Oqv') / 10;
|
$current = snmp_get($device, $oid, '-Oqv') / 10;
|
||||||
if ($current > 0) {
|
if ($current > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 0, 'PDU L1', 'Current', 10, 1, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $oid, 0, 'PDU L1', 'Current', 10, 1, null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ for ($i = 1; $i <= 3; $i++) {
|
|||||||
$warnlimit = null;
|
$warnlimit = null;
|
||||||
$limit = null;
|
$limit = null;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 1; $i <= 3; $i++) {
|
for ($i = 1; $i <= 3; $i++) {
|
||||||
@ -25,5 +25,5 @@ for ($i = 1; $i <= 3; $i++) {
|
|||||||
$warnlimit = null;
|
$warnlimit = null;
|
||||||
$limit = null;
|
$limit = null;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ foreach ($pre_cache['geist_pdu_iec'] as $index => $data) {
|
|||||||
$descr = $data['ctrl3ChIECName'] . ' Phase A';
|
$descr = $data['ctrl3ChIECName'] . ' Phase A';
|
||||||
$oid = $current_oid . $index;
|
$oid = $current_oid . $index;
|
||||||
if ($value > 0) {
|
if ($value > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'ctrl3ChIECDeciAmpsA', 'geist-pdu', $descr, $divisor, 1, null, null, null, null, $value);
|
discover_sensor(null, 'current', $device, $oid, 'ctrl3ChIECDeciAmpsA', 'geist-pdu', $descr, $divisor, 1, null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$divisor = 10;
|
$divisor = 10;
|
||||||
@ -38,7 +38,7 @@ foreach ($pre_cache['geist_pdu_iec'] as $index => $data) {
|
|||||||
$descr = $data['ctrl3ChIECName'] . ' Phase B';
|
$descr = $data['ctrl3ChIECName'] . ' Phase B';
|
||||||
$oid = $current_oid . $index;
|
$oid = $current_oid . $index;
|
||||||
if ($value > 0) {
|
if ($value > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'ctrl3ChIECDeciAmpsB', 'geist-pdu', $descr, $divisor, 1, null, null, null, null, $value);
|
discover_sensor(null, 'current', $device, $oid, 'ctrl3ChIECDeciAmpsB', 'geist-pdu', $descr, $divisor, 1, null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$divisor = 10;
|
$divisor = 10;
|
||||||
@ -47,6 +47,6 @@ foreach ($pre_cache['geist_pdu_iec'] as $index => $data) {
|
|||||||
$descr = $data['ctrl3ChIECName'] . ' Phase C';
|
$descr = $data['ctrl3ChIECName'] . ' Phase C';
|
||||||
$oid = $current_oid . $index;
|
$oid = $current_oid . $index;
|
||||||
if ($value > 0) {
|
if ($value > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'ctrl3ChIECDeciAmpsC', 'geist-pdu', $descr, $divisor, 1, null, null, null, null, $value);
|
discover_sensor(null, 'current', $device, $oid, 'ctrl3ChIECDeciAmpsC', 'geist-pdu', $descr, $divisor, 1, null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ foreach ($oids as $index => $entry) {
|
|||||||
$type = 'ict-pdu';
|
$type = 'ict-pdu';
|
||||||
$current = (float) $entry['outputCurrent'] / $divisor;
|
$current = (float) $entry['outputCurrent'] / $divisor;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
// System Current
|
// System Current
|
||||||
@ -52,5 +52,5 @@ if (! empty($systemCurrent)) {
|
|||||||
$oid = '.1.3.6.1.4.1.39145.10.7.0';
|
$oid = '.1.3.6.1.4.1.39145.10.7.0';
|
||||||
$current = $systemCurrent / $divisor;
|
$current = $systemCurrent / $divisor;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -35,5 +35,5 @@ if (! empty($outputCurrent)) {
|
|||||||
$type = 'ict-psu';
|
$type = 'ict-psu';
|
||||||
$currentValue = $outputCurrent / $divisor;
|
$currentValue = $outputCurrent / $divisor;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $currentValue);
|
discover_sensor(null, 'current', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $currentValue);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ if (is_array($oids_in)) {
|
|||||||
$current = ($entry['inletStatusCurrent'] / $divisor);
|
$current = ($entry['inletStatusCurrent'] / $divisor);
|
||||||
$high_limit = ($entry['inletConfigCurrentHigh'] / 10);
|
$high_limit = ($entry['inletConfigCurrentHigh'] / 10);
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $cur_oid, '1.3.1.3.' . $index, 'ipoman', $descr, $divisor, '1', null, null, null, $high_limit, $current);
|
discover_sensor(null, 'current', $device, $cur_oid, '1.3.1.3.' . $index, 'ipoman', $descr, $divisor, '1', null, null, null, $high_limit, $current);
|
||||||
// FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
|
// FIXME: iPoMan 1201 also says it has 2 inlets, at least until firmware 1.06 - wtf?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,6 +35,6 @@ if (is_array($oids_out)) {
|
|||||||
$current = ($entry['outletStatusCurrent'] / $divisor);
|
$current = ($entry['outletStatusCurrent'] / $divisor);
|
||||||
$high_limit = ($entry['outletConfigCurrentHigh'] / 10);
|
$high_limit = ($entry['outletConfigCurrentHigh'] / 10);
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $cur_oid, '2.3.1.3.' . $index, 'ipoman', $descr, $divisor, '1', null, null, null, $high_limit, $current);
|
discover_sensor(null, 'current', $device, $cur_oid, '2.3.1.3.' . $index, 'ipoman', $descr, $divisor, '1', null, null, null, $high_limit, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ foreach (array_keys($psline_data) as $index) {
|
|||||||
$current = $psline_data[$index]['lgpPduPsLineEntryEcHundredths'];
|
$current = $psline_data[$index]['lgpPduPsLineEntryEcHundredths'];
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
$class,
|
$class,
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -94,7 +94,7 @@ foreach (array_keys($ps_data) as $index) {
|
|||||||
$current = $ps_data[$index]['lgpPduPsEntryEcNeutral'];
|
$current = $ps_data[$index]['lgpPduPsEntryEcNeutral'];
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
$class,
|
$class,
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -139,7 +139,7 @@ foreach (array_keys($rb_data) as $index) {
|
|||||||
$group = 'Line to Neutral';
|
$group = 'Line to Neutral';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
$class,
|
$class,
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -11,18 +11,18 @@ if (preg_match('/(Linux).+(ntc)/', $device['sysDescr'])) {
|
|||||||
$current = '116.3';
|
$current = '116.3';
|
||||||
$value = snmp_get($device, $oid . $current, '-Oqv');
|
$value = snmp_get($device, $oid . $current, '-Oqv');
|
||||||
if (is_numeric($value)) {
|
if (is_numeric($value)) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid . $current, $current, $sensor_type, $descr, '1', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value);
|
discover_sensor(null, 'current', $device, $oid . $current, $current, $sensor_type, $descr, '1', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value);
|
||||||
}
|
}
|
||||||
$descr = 'VBUS current';
|
$descr = 'VBUS current';
|
||||||
$current = '116.5';
|
$current = '116.5';
|
||||||
$value = snmp_get($device, $oid . $current, '-Oqv');
|
$value = snmp_get($device, $oid . $current, '-Oqv');
|
||||||
if (is_numeric($value)) {
|
if (is_numeric($value)) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid . $current, $current, $sensor_type, $descr, '1', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value);
|
discover_sensor(null, 'current', $device, $oid . $current, $current, $sensor_type, $descr, '1', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value);
|
||||||
}
|
}
|
||||||
$descr = 'Battery current';
|
$descr = 'Battery current';
|
||||||
$current = '116.7';
|
$current = '116.7';
|
||||||
$value = snmp_get($device, $oid . $current, '-Oqv');
|
$value = snmp_get($device, $oid . $current, '-Oqv');
|
||||||
if (is_numeric($value)) {
|
if (is_numeric($value)) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid . $current, $current, $sensor_type, $descr, '1', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value);
|
discover_sensor(null, 'current', $device, $oid . $current, $current, $sensor_type, $descr, '1', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ for ($i = 1; $i <= $numPhase; $i++) {
|
|||||||
$limit = null;
|
$limit = null;
|
||||||
$lowwarnlimit = null;
|
$lowwarnlimit = null;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
|
||||||
}//end for
|
}//end for
|
||||||
|
|
||||||
$oids = trim(snmp_walk($device, '.1.3.6.1.4.1.705.1.6.2.1.6', '-OsqnU')); // OID: mginputCurrent
|
$oids = trim(snmp_walk($device, '.1.3.6.1.4.1.705.1.6.2.1.6', '-OsqnU')); // OID: mginputCurrent
|
||||||
@ -58,5 +58,5 @@ for ($i = 1; $i <= $numPhase; $i++) {
|
|||||||
$limit = null;
|
$limit = null;
|
||||||
$lowwarnlimit = null;
|
$lowwarnlimit = null;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current);
|
||||||
}//end for
|
}//end for
|
||||||
|
@ -37,7 +37,7 @@ if (! empty($battery_current) || $battery_current == 0) {
|
|||||||
$descr = 'Battery Current';
|
$descr = 'Battery Current';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$battery_current_oid,
|
$battery_current_oid,
|
||||||
|
@ -30,5 +30,5 @@ $descr = 'DC Input Current';
|
|||||||
$divisor = 10;
|
$divisor = 10;
|
||||||
|
|
||||||
if (is_numeric($dcinput_value) && $dcinput_value > 0) {
|
if (is_numeric($dcinput_value) && $dcinput_value > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $dcinput_oid, 0, $device['os'], $descr, $divisor, 1, null, null, null, null, $dcinput_value / $divisor);
|
discover_sensor(null, 'current', $device, $dcinput_oid, 0, $device['os'], $descr, $divisor, 1, null, null, null, null, $dcinput_value / $divisor);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ for ($i = 1; $i <= 3; $i++) {
|
|||||||
$warnlimit = null;
|
$warnlimit = null;
|
||||||
$limit = null;
|
$limit = null;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 1; $i <= 3; $i++) {
|
for ($i = 1; $i <= 3; $i++) {
|
||||||
@ -25,5 +25,5 @@ for ($i = 1; $i <= 3; $i++) {
|
|||||||
$warnlimit = null;
|
$warnlimit = null;
|
||||||
$limit = null;
|
$limit = null;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,6 @@ foreach ($pre_cache['pbn_oids'] as $index => $entry) {
|
|||||||
$value = $entry['curr'] / $divisor;
|
$value = $entry['curr'] / $divisor;
|
||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, '' . $index, 'pbn', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'current', $device, $oid, '' . $index, 'pbn', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ if (is_numeric($data['lcIa'][1])) {
|
|||||||
$index = 'lcIa';
|
$index = 'lcIa';
|
||||||
$descr = 'Phase A';
|
$descr = 'Phase A';
|
||||||
$current = $data['lcIa'][1];
|
$current = $data['lcIa'][1];
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, 'powerlogic', $descr, 1, 1, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, 'powerlogic', $descr, 1, 1, null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($data['lcIb'][1])) {
|
if (is_numeric($data['lcIb'][1])) {
|
||||||
@ -37,7 +37,7 @@ if (is_numeric($data['lcIb'][1])) {
|
|||||||
$index = 'lcIb';
|
$index = 'lcIb';
|
||||||
$descr = 'Phase B';
|
$descr = 'Phase B';
|
||||||
$current = $data['lcIb'][1];
|
$current = $data['lcIb'][1];
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, 'powerlogic', $descr, 1, 1, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, 'powerlogic', $descr, 1, 1, null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($data['lcIc'][1])) {
|
if (is_numeric($data['lcIc'][1])) {
|
||||||
@ -45,7 +45,7 @@ if (is_numeric($data['lcIc'][1])) {
|
|||||||
$index = 'lcIc';
|
$index = 'lcIc';
|
||||||
$descr = 'Phase C';
|
$descr = 'Phase C';
|
||||||
$current = $data['lcIc'][1];
|
$current = $data['lcIc'][1];
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, 'powerlogic', $descr, 1, 1, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, 'powerlogic', $descr, 1, 1, null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data);
|
unset($data);
|
||||||
|
@ -16,7 +16,7 @@ foreach ($pre_cache['procurve_hpicfXcvrInfoTable'] as $index => $entry) {
|
|||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
foreach ($dbquery as $dbindex => $dbresult) {
|
foreach ($dbquery as $dbindex => $dbresult) {
|
||||||
$descr = makeshortif($dbresult['ifDescr']) . ' Port Bias Current';
|
$descr = makeshortif($dbresult['ifDescr']) . ' Port Bias Current';
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'hpicfXcvrBias.' . $index, 'procurve', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'current', $device, $oid, 'hpicfXcvrBias.' . $index, 'procurve', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ if ($inlet_oids) {
|
|||||||
$inlet_divisor = pow(10, snmp_get($device, "inletSensorDecimalDigits.$inlet_index.rmsCurrent", '-Ovq', 'PDU2-MIB'));
|
$inlet_divisor = pow(10, snmp_get($device, "inletSensorDecimalDigits.$inlet_index.rmsCurrent", '-Ovq', 'PDU2-MIB'));
|
||||||
$inlet_current = (snmp_get($device, "measurementsInletSensorValue.$inlet_index.1", '-Ovq', 'PDU2-MIB') / $inlet_divisor);
|
$inlet_current = (snmp_get($device, "measurementsInletSensorValue.$inlet_index.1", '-Ovq', 'PDU2-MIB') / $inlet_divisor);
|
||||||
if ($inlet_current >= 0) {
|
if ($inlet_current >= 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $inlet_oid, $inlet_index, 'raritan', $inlet_descr, $inlet_divisor, $multiplier, null, null, null, null, $inlet_current);
|
discover_sensor(null, 'current', $device, $inlet_oid, $inlet_index, 'raritan', $inlet_descr, $inlet_divisor, $multiplier, null, null, null, null, $inlet_current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ if ($outlet_oids) {
|
|||||||
$outlet_high_limit = snmp_get($device, "outletCurrentUpperCritical.$outletsuffix", '-Ovq', 'PDU-MIB') / $divisor;
|
$outlet_high_limit = snmp_get($device, "outletCurrentUpperCritical.$outletsuffix", '-Ovq', 'PDU-MIB') / $divisor;
|
||||||
$outlet_current = snmp_get($device, "outletCurrent.$outletsuffix", '-Ovq', 'PDU-MIB') / $divisor;
|
$outlet_current = snmp_get($device, "outletCurrent.$outletsuffix", '-Ovq', 'PDU-MIB') / $divisor;
|
||||||
if ($outlet_current >= 0) {
|
if ($outlet_current >= 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $outlet_oid, $outlet_insert_index, 'raritan', $outlet_descr, $divisor, $multiplier, $outlet_low_limit, $outlet_low_warn_limit, $outlet_high_warn_limit, $outlet_high_limit, $outlet_current);
|
discover_sensor(null, 'current', $device, $outlet_oid, $outlet_insert_index, 'raritan', $outlet_descr, $divisor, $multiplier, $outlet_low_limit, $outlet_low_warn_limit, $outlet_high_warn_limit, $outlet_high_limit, $outlet_current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ if ($outlet_oids) {
|
|||||||
$outlet_divisor = pow(10, snmp_get($device, "outletSensorDecimalDigits.1.$outlet_index.rmsCurrent", '-Ovq', 'PDU2-MIB'));
|
$outlet_divisor = pow(10, snmp_get($device, "outletSensorDecimalDigits.1.$outlet_index.rmsCurrent", '-Ovq', 'PDU2-MIB'));
|
||||||
$outlet_power = (snmp_get($device, "measurementsOutletSensorValue.1.$outlet_index.1", '-Ovq', 'PDU2-MIB') / $outlet_divisor);
|
$outlet_power = (snmp_get($device, "measurementsOutletSensorValue.1.$outlet_index.1", '-Ovq', 'PDU2-MIB') / $outlet_divisor);
|
||||||
if ($outlet_power >= 0) {
|
if ($outlet_power >= 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $outlet_oid, $outlet_insert_index, 'raritan', $outlet_descr, $outlet_divisor, $multiplier, $outlet_low_limit, $outlet_low_warn_limit, $outlet_high_warn_limit, $outlet_high_limit, $outlet_power);
|
discover_sensor(null, 'current', $device, $outlet_oid, $outlet_insert_index, 'raritan', $outlet_descr, $outlet_divisor, $multiplier, $outlet_low_limit, $outlet_low_warn_limit, $outlet_high_warn_limit, $outlet_high_limit, $outlet_power);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,6 +118,6 @@ foreach ($pre_cache['raritan_inletTable'] as $index => $raritan_data) {
|
|||||||
$warn_limit = $raritan_data['inletCurrentLowerWarning'] / $divisor;
|
$warn_limit = $raritan_data['inletCurrentLowerWarning'] / $divisor;
|
||||||
$high_limit = $raritan_data['inletCurrentLowerCritical'] / $divisor;
|
$high_limit = $raritan_data['inletCurrentLowerCritical'] / $divisor;
|
||||||
$current = $pre_cache['raritan_inletPoleTable'][$index][$x]['inletPoleCurrent'] / $divisor;
|
$current = $pre_cache['raritan_inletPoleTable'][$index][$x]['inletPoleCurrent'] / $divisor;
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $tmp_index, 'raritan', $descr, $divisor, 1, $low_limit, $low_limit, $warn_limit, $high_limit, $current);
|
discover_sensor(null, 'current', $device, $oid, $tmp_index, 'raritan', $descr, $divisor, 1, $low_limit, $low_limit, $warn_limit, $high_limit, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ if (is_numeric($battery_current)) {
|
|||||||
$divisor = get_device_divisor($device, $pre_cache['poweralert_serial'] ?? '', 'current', $oid);
|
$divisor = get_device_divisor($device, $pre_cache['poweralert_serial'] ?? '', 'current', $oid);
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -43,7 +43,7 @@ foreach ($output_current as $index => $data) {
|
|||||||
$data['upsOutputCurrent'] = Number::cast($data['upsOutputCurrent']);
|
$data['upsOutputCurrent'] = Number::cast($data['upsOutputCurrent']);
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -75,7 +75,7 @@ foreach ($input_current as $index => $data) {
|
|||||||
$data['upsInputCurrent'] = Number::cast($data['upsInputCurrent']);
|
$data['upsInputCurrent'] = Number::cast($data['upsInputCurrent']);
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -107,7 +107,7 @@ foreach ($bypass_current as $index => $data) {
|
|||||||
$data['upsBypassCurrent'] = Number::cast($data['upsBypassCurrent']);
|
$data['upsBypassCurrent'] = Number::cast($data['upsBypassCurrent']);
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'current',
|
'current',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -16,7 +16,7 @@ foreach ($pre_cache['sdbMgmtCtrlDevUnitAddress'] ?? [] as $sdbMgmtCtrlDevUnitAdd
|
|||||||
// See includes/discovery/entity-physical/schleifenbauer.inc.php for an explanation why we set this as the entPhysicalIndex.
|
// See includes/discovery/entity-physical/schleifenbauer.inc.php for an explanation why we set this as the entPhysicalIndex.
|
||||||
$entPhysicalIndex = $sdbMgmtCtrlDevUnitAddress * 1000000 + 100000 + $sdbDevInIndex * 1000 + 120;
|
$entPhysicalIndex = $sdbMgmtCtrlDevUnitAddress * 1000000 + 100000 + $sdbDevInIndex * 1000 + 120;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $serial_input, 'schleifenbauer', $descr, $divisor, '1', null, null, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex);
|
discover_sensor(null, 'current', $device, $current_oid, $serial_input, 'schleifenbauer', $descr, $divisor, '1', null, null, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,5 +33,5 @@ foreach ($pre_cache['sdbDevOutMtActualCurrent'] ?? [] as $sdbDevOutMtIndex => $s
|
|||||||
// See includes/discovery/entity-physical/schleifenbauer.inc.php for an explanation why we set this as the entPhysicalIndex.
|
// See includes/discovery/entity-physical/schleifenbauer.inc.php for an explanation why we set this as the entPhysicalIndex.
|
||||||
$entPhysicalIndex = $sdbMgmtCtrlDevUnitAddress * 1000000 + 200000 + $sdbDevOutMtIndex * 1000 + 120;
|
$entPhysicalIndex = $sdbMgmtCtrlDevUnitAddress * 1000000 + 200000 + $sdbDevOutMtIndex * 1000 + 120;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $serial_output, 'schleifenbauer', $descr, $divisor, '1', null, null, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex);
|
discover_sensor(null, 'current', $device, $current_oid, $serial_output, 'schleifenbauer', $descr, $divisor, '1', null, null, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ if (! empty($battery_current) || $battery_current == 0) {
|
|||||||
$type = 'sinetica';
|
$type = 'sinetica';
|
||||||
$index = '2.6.0';
|
$index = '2.6.0';
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $battery_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $battery_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.3', []);
|
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.4.4.1.3', []);
|
||||||
@ -50,7 +50,7 @@ foreach ($oids as $oid => $data) {
|
|||||||
$type = 'sinetica';
|
$type = 'sinetica';
|
||||||
$index = '4.4.1.3.' . $current_id;
|
$index = '4.4.1.3.' . $current_id;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.4', []);
|
$oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.4', []);
|
||||||
@ -68,5 +68,5 @@ foreach ($oids as $oid => $data) {
|
|||||||
$type = 'sinetica';
|
$type = 'sinetica';
|
||||||
$index = '3.3.1.3.' . $current_id;
|
$index = '3.3.1.3.' . $current_id;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,5 @@
|
|||||||
$oid = '.1.3.6.1.4.1.32050.2.1.27.5.4';
|
$oid = '.1.3.6.1.4.1.32050.2.1.27.5.4';
|
||||||
$current = (snmp_get($device, $oid, '-Oqv') / 10);
|
$current = (snmp_get($device, $oid, '-Oqv') / 10);
|
||||||
if ($current > 0) {
|
if ($current > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 0, 'sitemonitor', 'Current', 10, 1, null, null, null, null, $current);
|
discover_sensor(null, 'current', $device, $oid, 0, 'sitemonitor', 'Current', 10, 1, null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ $tpdin_oids = [
|
|||||||
|
|
||||||
foreach ($tpdin_oids as $data) {
|
foreach ($tpdin_oids as $data) {
|
||||||
if ($data['current'] > 0) {
|
if ($data['current'] > 0) {
|
||||||
discover_sensor($valid['sensor'], 'current', $device, $data['oid'], $data['index'], $device['os'], $data['descr'], 10, '1', null, null, null, null, $data['current']);
|
discover_sensor(null, 'current', $device, $data['oid'], $data['index'], $device['os'], $data['descr'], 10, '1', null, null, null, null, $data['current']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
$descrRx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetNetPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetNetPortIfIndex']) . ' Rx Power';
|
$descrRx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetNetPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetNetPortIfIndex']) . ' Rx Power';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidRx,
|
$oidRx,
|
||||||
@ -72,7 +72,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
// Discover transmit power level
|
// Discover transmit power level
|
||||||
$descrTx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetNetPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetNetPortIfIndex']) . ' Tx Power';
|
$descrTx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetNetPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetNetPortIfIndex']) . ' Tx Power';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidTx,
|
$oidTx,
|
||||||
@ -107,7 +107,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$descrRx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetAccPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetAccPortIfIndex']) . ' Rx Power';
|
$descrRx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetAccPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetAccPortIfIndex']) . ' Rx Power';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidRx,
|
$oidRx,
|
||||||
@ -129,7 +129,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$descrTx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetAccPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetAccPortIfIndex']) . ' Tx Power';
|
$descrTx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetAccPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetAccPortIfIndex']) . ' Tx Power';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidTx,
|
$oidTx,
|
||||||
@ -163,7 +163,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
$descrRx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetTrafficPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetTrafficPortIfIndex']) . ' Rx Power';
|
$descrRx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetTrafficPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetTrafficPortIfIndex']) . ' Rx Power';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidRx,
|
$oidRx,
|
||||||
@ -184,7 +184,7 @@ foreach ($pre_cache['adva_fsp150_ports'] as $index => $entry) {
|
|||||||
|
|
||||||
$descrTx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetTrafficPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetTrafficPortIfIndex']) . ' Tx Power';
|
$descrTx = ($pre_cache['adva_fsp150_ifName'][$entry['cmEthernetTrafficPortIfIndex']]['ifName'] ?? 'ifIndex ' . $entry['cmEthernetTrafficPortIfIndex']) . ' Tx Power';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidTx,
|
$oidTx,
|
||||||
|
@ -29,7 +29,7 @@ foreach ($pre_cache['adva_fsp3kr7'] as $index => $entry) {
|
|||||||
$descr = $entry['entityFacilityAidString'] . ' RX';
|
$descr = $entry['entityFacilityAidString'] . ' RX';
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidRX,
|
$oidRX,
|
||||||
@ -52,7 +52,7 @@ foreach ($pre_cache['adva_fsp3kr7'] as $index => $entry) {
|
|||||||
$currentTX = $entry['pmSnapshotCurrentOutputPower'] / $divisor;
|
$currentTX = $entry['pmSnapshotCurrentOutputPower'] / $divisor;
|
||||||
|
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oidTX,
|
$oidTX,
|
||||||
|
@ -15,7 +15,7 @@ if ($pre_cache['awplus-sfpddm']) {
|
|||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.4.1.3.' . $index;
|
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.4.1.3.' . $index;
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -51,7 +51,7 @@ if ($pre_cache['awplus-sfpddm']) {
|
|||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.5.1.3.' . $index;
|
$oid = '.1.3.6.1.4.1.207.8.4.4.3.28.1.5.1.3.' . $index;
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -28,6 +28,6 @@ foreach ($pre_cache['ciscoepc_docsIfDownstreamChannelTable'] as $index => $data)
|
|||||||
$oid = '.1.3.6.1.2.1.10.127.1.1.1.1.6.' . $index;
|
$oid = '.1.3.6.1.2.1.10.127.1.1.1.1.6.' . $index;
|
||||||
$divisor = 10;
|
$divisor = 10;
|
||||||
$value = $data['docsIfDownChannelPower'];
|
$value = $data['docsIfDownChannelPower'];
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'docsIfDownChannelPower.' . $index, 'ciscoepc', $descr, $divisor, '1', null, null, null, null, $value);
|
discover_sensor(null, 'dbm', $device, $oid, 'docsIfDownChannelPower.' . $index, 'ciscoepc', $descr, $divisor, '1', null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ foreach ($pre_cache['ciscosb_rlPhyTestGetResult'] as $index => $ciscosb_data) {
|
|||||||
$dbm = $value['rlPhyTestTableTxOutput'] / $divisor;
|
$dbm = $value['rlPhyTestTableTxOutput'] / $divisor;
|
||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, $sensor_type, $descr, $divisor, $multiplier, null, null, null, null, $dbm, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'tx-' . $index, $sensor_type, $descr, $divisor, $multiplier, null, null, null, null, $dbm, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
if (isset($value['rlPhyTestTableRxOpticalPower']) && is_numeric($value['rlPhyTestTableRxOpticalPower']) && ($value['rlPhyTestTableTxOutput'] != 0)) {
|
if (isset($value['rlPhyTestTableRxOpticalPower']) && is_numeric($value['rlPhyTestTableRxOpticalPower']) && ($value['rlPhyTestTableTxOutput'] != 0)) {
|
||||||
$oid = '.1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.' . $index . '.9';
|
$oid = '.1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.' . $index . '.9';
|
||||||
@ -34,7 +34,7 @@ foreach ($pre_cache['ciscosb_rlPhyTestGetResult'] as $index => $ciscosb_data) {
|
|||||||
$dbm = $value['rlPhyTestTableRxOpticalPower'] / $divisor;
|
$dbm = $value['rlPhyTestTableRxOpticalPower'] / $divisor;
|
||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, $sensor_type, $descr, $divisor, $multiplier, null, null, null, null, $dbm, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'rx-' . $index, $sensor_type, $descr, $divisor, $multiplier, null, null, null, null, $dbm, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
|||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
$descr = makeshortif($interface['ifDescr']) . ' Receive Power';
|
$descr = makeshortif($interface['ifDescr']) . ' Receive Power';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'rx-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($entry['hh3cTransceiverCurTXPower']) && $entry['hh3cTransceiverCurTXPower'] != 2147483647 && isset($entry['hh3cTransceiverDiagnostic'])) {
|
if (is_numeric($entry['hh3cTransceiverCurTXPower']) && $entry['hh3cTransceiverCurTXPower'] != 2147483647 && isset($entry['hh3cTransceiverDiagnostic'])) {
|
||||||
@ -46,7 +46,7 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
|||||||
$interface = get_port_by_index_cache($device['device_id'], $index);
|
$interface = get_port_by_index_cache($device['device_id'], $index);
|
||||||
if ($interface['ifAdminStatus'] == 'up') {
|
if ($interface['ifAdminStatus'] == 'up') {
|
||||||
$descr = makeshortif($interface['ifDescr']) . ' Transmit Power';
|
$descr = makeshortif($interface['ifDescr']) . ' Transmit Power';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'tx-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ foreach ($pre_cache['datacom_oids'] as $index => $entry) {
|
|||||||
$current = $entry['ddTransceiversRxPower'];
|
$current = $entry['ddTransceiversRxPower'];
|
||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, 'datacom', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'rx-' . $index, 'datacom', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric(str_replace('dBm', '', $entry['ddTransceiversTxPower']))) {
|
if (is_numeric(str_replace('dBm', '', $entry['ddTransceiversTxPower']))) {
|
||||||
@ -30,6 +30,6 @@ foreach ($pre_cache['datacom_oids'] as $index => $entry) {
|
|||||||
$current = $entry['ddTransceiversTxPower'];
|
$current = $entry['ddTransceiversTxPower'];
|
||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, 'datacom', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'tx-' . $index, 'datacom', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ if ($oids) {
|
|||||||
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'], 'dbm', $device, $split, 'txdbm' . $ifIndex, 'rlPhyTestTableTxOutput', 'SfpTxdBm-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value
|
null, 'dbm', $device, $split, 'txdbm' . $ifIndex, 'rlPhyTestTableTxOutput', 'SfpTxdBm-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ if ($oids) {
|
|||||||
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
$tmp = get_port_by_index_cache($device['device_id'], $ifIndex);
|
||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'], 'dbm', $device, $split, 'rxdbm' . $ifIndex, 'rlPhyTestTableRxOpticalPower', 'SfpRxdBm-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value
|
null, 'dbm', $device, $split, 'rxdbm' . $ifIndex, 'rlPhyTestTableRxOpticalPower', 'SfpRxdBm-' . $descr, $divisor, '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ if ($pre_cache['eltex-mes23xx-sfp']) {
|
|||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
$oid = '.1.3.6.1.4.1.89.90.1.2.1.3.' . $ifIndex . '.8';
|
$oid = '.1.3.6.1.4.1.89.90.1.2.1.3.' . $ifIndex . '.8';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -72,7 +72,7 @@ if ($pre_cache['eltex-mes23xx-sfp']) {
|
|||||||
$descr = $tmp['ifName'];
|
$descr = $tmp['ifName'];
|
||||||
$oid = '.1.3.6.1.4.1.89.90.1.2.1.3.' . $ifIndex . '.9';
|
$oid = '.1.3.6.1.4.1.89.90.1.2.1.3.' . $ifIndex . '.9';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -47,7 +47,7 @@ if (! empty($eltexPhyTransceiverDiagnosticTable['txOpticalPower'])) {
|
|||||||
$descr = get_port_by_index_cache($device['device_id'], $ifIndex)['ifName'];
|
$descr = get_port_by_index_cache($device['device_id'], $ifIndex)['ifName'];
|
||||||
$oid = Oid::toNumeric('ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.' . $ifIndex . '.4.1');
|
$oid = Oid::toNumeric('ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.' . $ifIndex . '.4.1');
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
@ -82,7 +82,7 @@ if (! empty($eltexPhyTransceiverDiagnosticTable['rxOpticalPower'])) {
|
|||||||
$descr = get_port_by_index_cache($device['device_id'], $ifIndex)['ifName'];
|
$descr = get_port_by_index_cache($device['device_id'], $ifIndex)['ifName'];
|
||||||
$oid = Oid::toNumeric('ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.' . $ifIndex . '.5.1');
|
$oid = Oid::toNumeric('ELTEX-PHY-MIB::eltexPhyTransceiverDiagnosticCurrentValue.' . $ifIndex . '.5.1');
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -13,7 +13,7 @@ foreach ($fabosSfpRxPower as $oid => $entry) {
|
|||||||
$ifIndex = $index + 1073741823;
|
$ifIndex = $index + 1073741823;
|
||||||
if ($ifAdminStatus[$ifIndex] == '1') {
|
if ($ifAdminStatus[$ifIndex] == '1') {
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
".$oid.$index",
|
".$oid.$index",
|
||||||
@ -44,7 +44,7 @@ foreach ($fabosSfpTxPower as $oid => $entry) {
|
|||||||
$ifIndex = $index + 1073741823;
|
$ifIndex = $index + 1073741823;
|
||||||
if ($ifAdminStatus[$ifIndex] == '1') {
|
if ($ifAdminStatus[$ifIndex] == '1') {
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
".$oid.$index",
|
".$oid.$index",
|
||||||
|
@ -72,7 +72,7 @@ if (is_numeric($a1_tx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_a1_tx,
|
$oid_a1_tx,
|
||||||
@ -97,7 +97,7 @@ if (is_numeric($a1_rx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_a1_rx,
|
$oid_a1_rx,
|
||||||
@ -122,7 +122,7 @@ if (is_numeric($a2_tx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_a2_tx,
|
$oid_a2_tx,
|
||||||
@ -147,7 +147,7 @@ if (is_numeric($a2_rx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_a2_rx,
|
$oid_a2_rx,
|
||||||
@ -170,7 +170,7 @@ if (is_numeric($b1_tx)) {
|
|||||||
$descr = 'B1 Tx Power';
|
$descr = 'B1 Tx Power';
|
||||||
$index = 'vSFPB1TxPower.0';
|
$index = 'vSFPB1TxPower.0';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_b1_tx,
|
$oid_b1_tx,
|
||||||
@ -195,7 +195,7 @@ if (is_numeric($b1_rx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_b1_rx,
|
$oid_b1_rx,
|
||||||
@ -220,7 +220,7 @@ if (is_numeric($b2_tx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_b2_tx,
|
$oid_b2_tx,
|
||||||
@ -245,7 +245,7 @@ if (is_numeric($b2_rx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_b2_rx,
|
$oid_b2_rx,
|
||||||
@ -270,7 +270,7 @@ if (is_numeric($c1_tx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_c1_tx,
|
$oid_c1_tx,
|
||||||
@ -295,7 +295,7 @@ if (is_numeric($c1_rx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_c1_rx,
|
$oid_c1_rx,
|
||||||
@ -320,7 +320,7 @@ if (is_numeric($c2_tx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_c2_tx,
|
$oid_c2_tx,
|
||||||
@ -345,7 +345,7 @@ if (is_numeric($c2_rx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_c2_rx,
|
$oid_c2_rx,
|
||||||
@ -368,7 +368,7 @@ if (is_numeric($d1_tx)) {
|
|||||||
$descr = 'D1 Tx Power';
|
$descr = 'D1 Tx Power';
|
||||||
$index = 'vSFPD1TxPower.0';
|
$index = 'vSFPD1TxPower.0';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_d1_tx,
|
$oid_d1_tx,
|
||||||
@ -393,7 +393,7 @@ if (is_numeric($d1_rx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_d1_rx,
|
$oid_d1_rx,
|
||||||
@ -418,7 +418,7 @@ if (is_numeric($d2_tx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_d2_tx,
|
$oid_d2_tx,
|
||||||
@ -443,7 +443,7 @@ if (is_numeric($d2_rx)) {
|
|||||||
$divisor = '100';
|
$divisor = '100';
|
||||||
$multiplier = '1';
|
$multiplier = '1';
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid_d2_rx,
|
$oid_d2_rx,
|
||||||
|
@ -27,6 +27,6 @@ foreach ($pre_cache['infineragroove_portTable'] as $index => $data) {
|
|||||||
$descr = $data['portAlias'] . ' Receive Power';
|
$descr = $data['portAlias'] . ' Receive Power';
|
||||||
$oid = '.1.3.6.1.4.1.42229.1.2.3.6.1.1.4.' . $index;
|
$oid = '.1.3.6.1.4.1.42229.1.2.3.6.1.1.4.' . $index;
|
||||||
$value = $data['portRxOpticalPower'];
|
$value = $data['portRxOpticalPower'];
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'portRxOpticalPower.' . $index, 'infinera-groove', $descr, null, '1', null, null, null, null, $value);
|
discover_sensor(null, 'dbm', $device, $oid, 'portRxOpticalPower.' . $index, 'infinera-groove', $descr, null, '1', null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ foreach ($pre_cache['nokiaIsamSfpPort'] as $slotId => $slot) {
|
|||||||
$limit = ($port['sfpDiagRSSIRxPowerAlmHigh'] / $divisor) ?: -3;
|
$limit = ($port['sfpDiagRSSIRxPowerAlmHigh'] / $divisor) ?: -3;
|
||||||
$warn_limit = ($port['sfpDiagRSSIRxPowerWarnHigh'] / $divisor) ?: -5;
|
$warn_limit = ($port['sfpDiagRSSIRxPowerWarnHigh'] / $divisor) ?: -5;
|
||||||
$value = $port['sfpDiagRxPower'] / $divisor;
|
$value = $port['sfpDiagRxPower'] / $divisor;
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, $portName . '-rx', 'nokia-isam', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, $portName . '-rx', 'nokia-isam', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
if (is_numeric($port['sfpDiagTxPower'])) {
|
if (is_numeric($port['sfpDiagTxPower'])) {
|
||||||
$oid = '.1.3.6.1.4.1.637.61.1.56.5.1.6.' . $slotId . '.' . $portId;
|
$oid = '.1.3.6.1.4.1.637.61.1.56.5.1.6.' . $slotId . '.' . $portId;
|
||||||
@ -24,7 +24,7 @@ foreach ($pre_cache['nokiaIsamSfpPort'] as $slotId => $slot) {
|
|||||||
$limit = ($port['sfpDiagRSSITxPowerAlmHigh'] / $divisor) ?: -3;
|
$limit = ($port['sfpDiagRSSITxPowerAlmHigh'] / $divisor) ?: -3;
|
||||||
$warn_limit = ($port['sfpDiagRSSITxPowerWarnHigh'] / $divisor) ?: -4;
|
$warn_limit = ($port['sfpDiagRSSITxPowerWarnHigh'] / $divisor) ?: -4;
|
||||||
$value = $port['sfpDiagTxPower'] / $divisor;
|
$value = $port['sfpDiagTxPower'] / $divisor;
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, $portName . '-tx', 'nokia-isam', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, $portName . '-tx', 'nokia-isam', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ foreach ($pre_cache['pbn_oids'] as $index => $entry) {
|
|||||||
$value = $entry['rxPower'] / $divisor;
|
$value = $entry['rxPower'] / $divisor;
|
||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, 'pbn', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'rx-' . $index, 'pbn', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($entry['txPower']) && ($entry['txPower'] !== '-65535')) {
|
if (is_numeric($entry['txPower']) && ($entry['txPower'] !== '-65535')) {
|
||||||
@ -40,6 +40,6 @@ foreach ($pre_cache['pbn_oids'] as $index => $entry) {
|
|||||||
$value = $entry['txPower'] / $divisor;
|
$value = $entry['txPower'] / $divisor;
|
||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, 'pbn', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'tx-' . $index, 'pbn', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ foreach ($pre_cache['procurve_hpicfXcvrInfoTable'] as $index => $entry) {
|
|||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
foreach ($dbquery as $dbindex => $dbresult) {
|
foreach ($dbquery as $dbindex => $dbresult) {
|
||||||
$descr = makeshortif($dbresult['ifDescr']) . ' Port Receive Power';
|
$descr = makeshortif($dbresult['ifDescr']) . ' Port Receive Power';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'hpicfXcvrRxPower.' . $index, 'procurve', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'hpicfXcvrRxPower.' . $index, 'procurve', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ foreach ($pre_cache['procurve_hpicfXcvrInfoTable'] as $index => $entry) {
|
|||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
foreach ($dbquery as $dbindex => $dbresult) {
|
foreach ($dbquery as $dbindex => $dbresult) {
|
||||||
$descr = makeshortif($dbresult['ifDescr']) . ' Port Transmit Power';
|
$descr = makeshortif($dbresult['ifDescr']) . ' Port Transmit Power';
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'hpicfXcvrTxPower.-' . $index, 'procurve', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'hpicfXcvrTxPower.-' . $index, 'procurve', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ foreach ($pre_cache['rosMgmtOpticalTransceiverDDMTable'] as $index => $data) {
|
|||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
if ($port['ifAdminStatus'] == 'up') {
|
if ($port['ifAdminStatus'] == 'up') {
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, $sensor_type, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'tx-' . $index, $sensor_type, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($key == 'rxPower') && is_numeric($value['rosMgmtOpticalTransceiverParameterValue']) && ($value['rosMgmtOpticalTransceiverDDMValidStatus'] != 0)) {
|
if (($key == 'rxPower') && is_numeric($value['rosMgmtOpticalTransceiverParameterValue']) && ($value['rosMgmtOpticalTransceiverDDMValidStatus'] != 0)) {
|
||||||
@ -35,7 +35,7 @@ foreach ($pre_cache['rosMgmtOpticalTransceiverDDMTable'] as $index => $data) {
|
|||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
if ($port['ifAdminStatus'] == 'up') {
|
if ($port['ifAdminStatus'] == 'up') {
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, $sensor_type, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'rx-' . $index, $sensor_type, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ foreach ($pre_cache['raisecomOpticalTransceiverDDMTable'] as $index => $data) {
|
|||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
if ($port['ifAdminStatus'] == 'up') {
|
if ($port['ifAdminStatus'] == 'up') {
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, $sensor_type, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'tx-' . $index, $sensor_type, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($key == 'rxPower') && is_numeric($value['raisecomOpticalTransceiverParameterValue']) && ($value['raisecomOpticalTransceiverDDMValidStatus'] != 0)) {
|
if (($key == 'rxPower') && is_numeric($value['raisecomOpticalTransceiverParameterValue']) && ($value['raisecomOpticalTransceiverDDMValidStatus'] != 0)) {
|
||||||
@ -35,7 +35,7 @@ foreach ($pre_cache['raisecomOpticalTransceiverDDMTable'] as $index => $data) {
|
|||||||
$entPhysicalIndex = $index;
|
$entPhysicalIndex = $index;
|
||||||
$entPhysicalIndex_measured = 'ports';
|
$entPhysicalIndex_measured = 'ports';
|
||||||
if ($port['ifAdminStatus'] == 'up') {
|
if ($port['ifAdminStatus'] == 'up') {
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, $sensor_type, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
discover_sensor(null, 'dbm', $device, $oid, 'rx-' . $index, $sensor_type, $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ foreach ($pre_cache['timos_oids'] as $index => $entry) {
|
|||||||
$port_descr = get_port_by_index_cache($device['device_id'], str_replace('1.', '', $index));
|
$port_descr = get_port_by_index_cache($device['device_id'], str_replace('1.', '', $index));
|
||||||
$descr = $port_descr['ifName'] . ' RX Power ' . $int_ext;
|
$descr = $port_descr['ifName'] . ' RX Power ' . $int_ext;
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, 'timos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_func);
|
discover_sensor(null, 'dbm', $device, $oid, 'rx-' . $index, 'timos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_func);
|
||||||
}
|
}
|
||||||
if (is_numeric($entry['tmnxDDMTxOutputPower']) && $entry['tmnxDDMTxOutputPower'] != 0 && $entry['tmnxDDMRxOpticalPower'] != 0) {
|
if (is_numeric($entry['tmnxDDMTxOutputPower']) && $entry['tmnxDDMTxOutputPower'] != 0 && $entry['tmnxDDMRxOpticalPower'] != 0) {
|
||||||
$oid = '.1.3.6.1.4.1.6527.3.1.2.2.4.31.1.16.' . $index;
|
$oid = '.1.3.6.1.4.1.6527.3.1.2.2.4.31.1.16.' . $index;
|
||||||
@ -44,6 +44,6 @@ foreach ($pre_cache['timos_oids'] as $index => $entry) {
|
|||||||
$port_descr = get_port_by_index_cache($device['device_id'], str_replace('1.', '', $index));
|
$port_descr = get_port_by_index_cache($device['device_id'], str_replace('1.', '', $index));
|
||||||
$descr = $port_descr['ifName'] . ' TX Power';
|
$descr = $port_descr['ifName'] . ' TX Power';
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, 'timos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_func);
|
discover_sensor(null, 'dbm', $device, $oid, 'tx-' . $index, 'timos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $value, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured, $user_func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ foreach ($pre_cache['wipipe_oids'] as $index => $entry) {
|
|||||||
$currentsignal = $entry['mdmSignalStrength'];
|
$currentsignal = $entry['mdmSignalStrength'];
|
||||||
// Discover Sensor
|
// Discover Sensor
|
||||||
discover_sensor(
|
discover_sensor(
|
||||||
$valid['sensor'],
|
null,
|
||||||
'dbm',
|
'dbm',
|
||||||
$device,
|
$device,
|
||||||
$oid,
|
$oid,
|
||||||
|
@ -30,6 +30,6 @@ foreach ($pre_cache['infineragroove_portTable'] as $index => $data) {
|
|||||||
$oid = '.1.3.6.1.4.1.42229.1.2.4.1.19.1.1.22.' . $index;
|
$oid = '.1.3.6.1.4.1.42229.1.2.4.1.19.1.1.22.' . $index;
|
||||||
$value = $data['ochOsDGD'];
|
$value = $data['ochOsDGD'];
|
||||||
$divisor = 1000000000000;
|
$divisor = 1000000000000;
|
||||||
discover_sensor($valid['sensor'], 'delay', $device, $oid, 'ochOsOSNR.' . $index, 'infinera-groove', $descr, $divisor, '1', null, null, null, null, $value);
|
discover_sensor(null, 'delay', $device, $oid, 'ochOsOSNR.' . $index, 'infinera-groove', $descr, $divisor, '1', null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ if (! empty($entity_oids)) {
|
|||||||
// End grouping sensors
|
// End grouping sensors
|
||||||
}
|
}
|
||||||
$descr = trim($descr);
|
$descr = trim($descr);
|
||||||
discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'entity-sensor', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity'] ?? null, null, $group);
|
discover_sensor(null, $type, $device, $oid, $index, 'entity-sensor', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $warn_limit, $high_limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity'] ?? null, null, $group);
|
||||||
}
|
}
|
||||||
}//end if
|
}//end if
|
||||||
}//end foreach
|
}//end foreach
|
||||||
|
@ -28,6 +28,6 @@ foreach ($pre_cache['cooling_unit_analog'] as $index => $data) {
|
|||||||
$scale = $data['coolingUnitStatusAnalogScale'] ?? null;
|
$scale = $data['coolingUnitStatusAnalogScale'] ?? null;
|
||||||
$value = $data['coolingUnitStatusAnalogValue'] ?? null;
|
$value = $data['coolingUnitStatusAnalogValue'] ?? null;
|
||||||
if (preg_match('/Fan Speed/', $descr) && $data['coolingUnitStatusAnalogUnits'] == '%' && $value >= 0) {
|
if (preg_match('/Fan Speed/', $descr) && $data['coolingUnitStatusAnalogUnits'] == '%' && $value >= 0) {
|
||||||
discover_sensor($valid['sensor'], 'fanspeed', $device, $cur_oid, $cur_oid, 'apc', $descr, $scale, 1, null, null, null, null, $value);
|
discover_sensor(null, 'fanspeed', $device, $cur_oid, $cur_oid, 'apc', $descr, $scale, 1, null, null, null, null, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@ foreach (explode("\n", $oids) as $data) {
|
|||||||
$oid = '.1.3.6.1.4.1.18928.1.2.2.1.9.1.3.' . $index;
|
$oid = '.1.3.6.1.4.1.18928.1.2.2.1.9.1.3.' . $index;
|
||||||
$current = snmp_get($device, $oid, '-Oqv', '');
|
$current = snmp_get($device, $oid, '-Oqv', '');
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'areca', trim($descr, '"'), '1', '1', null, null, null, null, $current);
|
discover_sensor(null, 'fanspeed', $device, $oid, $index, 'areca', trim($descr, '"'), '1', '1', null, null, null, null, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@ for ($index = 4; $index <= 9; $index++) { //Benu Fans are index 4 thru 9
|
|||||||
$sensor_oid = ".1.3.6.1.4.1.39406.1.1.1.4.1.1.5.1.$index";
|
$sensor_oid = ".1.3.6.1.4.1.39406.1.1.1.4.1.1.5.1.$index";
|
||||||
$descr = $data["1.$index"]['benuSensorName'] ?? null;
|
$descr = $data["1.$index"]['benuSensorName'] ?? null;
|
||||||
$current = $data["1.$index"]['benuSensorValue'] ?? null;
|
$current = $data["1.$index"]['benuSensorValue'] ?? null;
|
||||||
discover_sensor($valid['sensor'], 'fanspeed', $device, $sensor_oid, $sensor_index, 'benuos', $descr, '1', '1', null, null, null, null, $current);
|
discover_sensor(null, 'fanspeed', $device, $sensor_oid, $sensor_index, 'benuos', $descr, '1', '1', null, null, null, null, $current);
|
||||||
$sensor_index++;
|
$sensor_index++;
|
||||||
}//end loop
|
}//end loop
|
||||||
|
@ -22,6 +22,6 @@ if (is_array($temp)) {
|
|||||||
$warnlimit = $temp[$index]['coolingDeviceUpperNonCriticalThreshold'];
|
$warnlimit = $temp[$index]['coolingDeviceUpperNonCriticalThreshold'];
|
||||||
$limit = $temp[$index]['coolingDeviceUpperCriticalThreshold'];
|
$limit = $temp[$index]['coolingDeviceUpperCriticalThreshold'];
|
||||||
|
|
||||||
discover_sensor($valid['sensor'], 'fanspeed', $device, $cur_oid . $index, $index, 'dell', $descr, '0', '1', $lowlimit, $low_warn_limit, $warnlimit, $limit, $value, 'snmp', $index);
|
discover_sensor(null, 'fanspeed', $device, $cur_oid . $index, $index, 'dell', $descr, '0', '1', $lowlimit, $low_warn_limit, $warnlimit, $limit, $value, 'snmp', $index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,6 @@ foreach (explode("\n", $oids) as $data) {
|
|||||||
$current = snmp_get($device, $fan_oid, '-Oqv', 'IDRAC-MIB-SMIv2');
|
$current = snmp_get($device, $fan_oid, '-Oqv', 'IDRAC-MIB-SMIv2');
|
||||||
$low_limit = snmp_get($device, $limit_oid, '-Oqv', 'IDRAC-MIB-SMIv2');
|
$low_limit = snmp_get($device, $limit_oid, '-Oqv', 'IDRAC-MIB-SMIv2');
|
||||||
$divisor = '1';
|
$divisor = '1';
|
||||||
discover_sensor($valid['sensor'], 'fanspeed', $device, $fan_oid, $index, 'drac', $descr, $divisor, '1', $low_limit, null, null, null, $current);
|
discover_sensor(null, 'fanspeed', $device, $fan_oid, $index, 'drac', $descr, $divisor, '1', $low_limit, null, null, null, $current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user