mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	* Added discovery and graphing for JunOS (SRX) RPM probes * Proposed changes for a percent based sensor type * Fixed missing MIB declaration in JunOS YAML discovery file * Updated Health-information.md to reflect the new percentage value type * Added separate test data for junos_rpm type * Update sensors.php * Update sensors.php * Update functions.inc.php * test re-run * Update junos_rpm.json * percentage -> loss * add ifSpeed prev test data * mis-merge * update sensors * and bgp... Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com> Co-authored-by: Tony Murray <murraytony@gmail.com>
		
			
				
	
	
		
			74 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Models;
 | 
						|
 | 
						|
class Sensor extends DeviceRelatedModel
 | 
						|
{
 | 
						|
    public $timestamps = false;
 | 
						|
    protected $primaryKey = 'sensor_id';
 | 
						|
    protected static $icons = [
 | 
						|
        'airflow'              => 'angle-double-right',
 | 
						|
        'ber'                  => 'sort-amount-desc',
 | 
						|
        'charge'               => 'battery-half',
 | 
						|
        'chromatic_dispersion' => 'indent',
 | 
						|
        'cooling'              => 'thermometer-full',
 | 
						|
        'count'                => 'hashtag',
 | 
						|
        'current'              => 'bolt fa-flip-horizontal',
 | 
						|
        'dbm'                  => 'sun-o',
 | 
						|
        'delay'                => 'clock-o',
 | 
						|
        'eer'                  => 'snowflake-o',
 | 
						|
        'fanspeed'             => 'refresh',
 | 
						|
        'frequency'            => 'line-chart',
 | 
						|
        'humidity'             => 'tint',
 | 
						|
        'load'                 => 'percent',
 | 
						|
        'loss'                 => 'percentage',
 | 
						|
        'power'                => 'power-off',
 | 
						|
        'power_consumed'       => 'plug',
 | 
						|
        'power_factor'         => 'calculator',
 | 
						|
        'pressure'             => 'thermometer-empty',
 | 
						|
        'quality_factor'       => 'arrows',
 | 
						|
        'runtime'              => 'hourglass-half',
 | 
						|
        'signal'               => 'wifi',
 | 
						|
        'snr'                  => 'signal',
 | 
						|
        'state'                => 'bullseye',
 | 
						|
        'temperature'          => 'thermometer-three-quarters',
 | 
						|
        'voltage'              => 'bolt',
 | 
						|
        'waterflow'            => 'tint',
 | 
						|
    ];
 | 
						|
 | 
						|
    // ---- Helper Functions ----
 | 
						|
 | 
						|
    public function classDescr()
 | 
						|
    {
 | 
						|
        $nice = collect([
 | 
						|
            'ber' => 'BER',
 | 
						|
            'dbm' => 'dBm',
 | 
						|
            'eer' => 'EER',
 | 
						|
            'snr' => 'SNR',
 | 
						|
        ]);
 | 
						|
        return $nice->get($this->sensor_class, ucwords(str_replace('_', ' ', $this->sensor_class)));
 | 
						|
    }
 | 
						|
 | 
						|
    public function icon()
 | 
						|
    {
 | 
						|
        return collect(self::$icons)->get($this->sensor_class, 'delicius');
 | 
						|
    }
 | 
						|
 | 
						|
    public static function getTypes()
 | 
						|
    {
 | 
						|
        return array_keys(self::$icons);
 | 
						|
    }
 | 
						|
 | 
						|
    // for the legacy menu
 | 
						|
    public static function getIconMap()
 | 
						|
    {
 | 
						|
        return self::$icons;
 | 
						|
    }
 | 
						|
 | 
						|
    // ---- Define Relationships ----
 | 
						|
    public function events()
 | 
						|
    {
 | 
						|
        return $this->morphMany(Eventlog::class, 'events', 'type', 'reference');
 | 
						|
    }
 | 
						|
}
 |