mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	docs: Updated Support-New-OS doc to provide clearer information (#6492)
* docs: Updated Support-New-OS doc to provide clearer information * Update Custom-Graphs.md * Update Custom-Graphs.md * Update Health-Information.md * Update Initial-Detection.md
This commit is contained in:
		
				
					committed by
					
						
						Tony Murray
					
				
			
			
				
	
			
			
			
						parent
						
							dcc6c96ec4
						
					
				
				
					commit
					2361541e33
				
			
							
								
								
									
										75
									
								
								doc/Developing/os/Mem-CPU-Information.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								doc/Developing/os/Mem-CPU-Information.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,75 @@
 | 
			
		||||
source: Developing/os/Mem-CPU-Information.md
 | 
			
		||||
 | 
			
		||||
This document will guide you through adding detection for Memory / Processor for your new device.
 | 
			
		||||
 | 
			
		||||
#### Memory
 | 
			
		||||
 | 
			
		||||
Detection for memory is done via two php scripts, one for discovery and the other for polling:
 | 
			
		||||
 | 
			
		||||
`includes/discovery/mempools/pulse.inc.php`
 | 
			
		||||
 | 
			
		||||
```php
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if ($device['os'] === 'pulse') {
 | 
			
		||||
    echo 'PULSE-MEMORY-POOL: ';
 | 
			
		||||
 | 
			
		||||
    $usage = str_replace('"', "", snmp_get($device, 'iveMemoryUtil.0', '-OvQ', 'PULSESECURE-PSG-MIB'));
 | 
			
		||||
 | 
			
		||||
    if (is_numeric($usage)) {
 | 
			
		||||
        discover_mempool($valid_mempool, $device, 0, 'pulse-mem', 'Main Memory', '100', null, null);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
`includes/polling/mempools/pulse.inc.php`
 | 
			
		||||
 | 
			
		||||
```php
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
echo 'Pulse Secure MemPool\n';
 | 
			
		||||
 | 
			
		||||
$perc = str_replace('"', "", snmp_get($device, "iveMemoryUtil.0", '-OvQ', 'PULSESECURE-PSG-MIB'));
 | 
			
		||||
 | 
			
		||||
if (is_numeric($perc)) {
 | 
			
		||||
    $memory_available = str_replace('"', "", snmp_get($device, "memTotalReal.0", '-OvQ', 'UCD-SNMP-MIB'));
 | 
			
		||||
    $mempool['total'] = $memory_available;
 | 
			
		||||
    $mempool['used'] = ($memory_available / 100 * $perc);
 | 
			
		||||
    $mempool['free'] = ($memory_available - $mempool['used']);
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Processor
 | 
			
		||||
 | 
			
		||||
Detection for processors is done via a single script unless custom processing of data is required (as in this example).
 | 
			
		||||
 | 
			
		||||
`includes/discovery/processors/pulse.inc.php`
 | 
			
		||||
 | 
			
		||||
```php
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if ($device['os'] === 'pulse') {
 | 
			
		||||
    echo 'Pulse Secure : ';
 | 
			
		||||
 | 
			
		||||
    $descr = 'Processor';
 | 
			
		||||
    $usage = str_replace('"', "", snmp_get($device, 'iveCpuUtil.0', '-OvQ', 'PULSESECURE-PSG-MIB'));
 | 
			
		||||
 | 
			
		||||
    if (is_numeric($usage)) {
 | 
			
		||||
        discover_processor($valid['processor'], $device, 'iveCpuUtil.0', '0', 'pulse-cpu', $descr, '100', $usage, null, null);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
`includes/polling/processors/pulse.inc.php`
 | 
			
		||||
 | 
			
		||||
```php
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
echo 'Pulse Secure CPU Usage';
 | 
			
		||||
 | 
			
		||||
$usage = str_replace('"', "", snmp_get($device, 'iveCpuUtil.0', '-OvQ', 'PULSESECURE-PSG-MIB'));
 | 
			
		||||
 | 
			
		||||
if (is_numeric($usage)) {
 | 
			
		||||
    $proc = ($usage * 100);
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
		Reference in New Issue
	
	Block a user