mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Detection, sensors and zpool/dataset usage for FreeNAS, TrueNAS (#11474)
It's also possible to do zpool IO from the MIB, but diskIO on LibreNMS makes a lot of assumptions about it coming from the UCD MIB. This changeset adds detection for FreeNAS and TrueNAS - despite having their own enterprise number, the snmpd uses the FreeBSD one. The naming is a bit all over the place, because this reflects reality - IXSystems produce FreeNAS and TrueNAS, the product lines have merged to eliminate FreeNAS, but TrueNAS still calls itself FreeNAS everywhere except the GUI.
This commit is contained in:
128
includes/definitions/discovery/truenas.yaml
Normal file
128
includes/definitions/discovery/truenas.yaml
Normal file
@@ -0,0 +1,128 @@
|
||||
mib: FREENAS-MIB
|
||||
modules:
|
||||
sensors:
|
||||
count:
|
||||
data:
|
||||
-
|
||||
oid: zfsArcSize
|
||||
value: zfsArcSize
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.1.{{ $index }}
|
||||
descr: 'ARC Size'
|
||||
index: zfsArcSize.{{ $index }}
|
||||
-
|
||||
oid: zfsArcMeta
|
||||
value: zfsArcMeta
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.2.{{ $index }}
|
||||
descr: 'ARC Metadata'
|
||||
index: zfsArcMeta.{{ $index }}
|
||||
-
|
||||
oid: zfsArcData
|
||||
value: zfsArcData
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.3.{{ $index }}
|
||||
descr: 'ARC Data'
|
||||
index: zfsArcData.{{ $index }}
|
||||
-
|
||||
oid: zfsArcHits
|
||||
value: zfsArcHits
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.4.{{ $index }}
|
||||
descr: 'ARC Hits'
|
||||
index: zfsArcHits.{{ $index }}
|
||||
-
|
||||
oid: zfsArcMisses
|
||||
value: zfsArcMisses
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.5.{{ $index }}
|
||||
descr: 'ARC Misses'
|
||||
index: zfsArcMisses.{{ $index }}
|
||||
-
|
||||
oid: zfsArcC
|
||||
value: zfsArcC
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.6.{{ $index }}
|
||||
descr: 'ARC C'
|
||||
index: zfsArcC.{{ $index }}
|
||||
-
|
||||
oid: zfsArcP
|
||||
value: zfsArcP
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.7.{{ $index }}
|
||||
descr: 'ARC P'
|
||||
index: zfsArcP.{{ $index }}
|
||||
-
|
||||
oid: zfsArcMissPercent
|
||||
value: zfsArcMissPercent
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.8.{{ $index }}
|
||||
descr: 'ARC Miss Percent'
|
||||
index: zfsArcMissPercent.{{ $index }}
|
||||
-
|
||||
oid: zfsArcHitRatio
|
||||
value: zfsArcHitRatio
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.9.{{ $index }}
|
||||
descr: 'ARC Hit Ratio'
|
||||
index: zfsArcHitRatio.{{ $index }}
|
||||
-
|
||||
oid: zfsArcMissRatio
|
||||
value: zfsArcMissRatio
|
||||
num_oid: .1.3.6.1.4.1.50536.1.4.10.{{ $index }}
|
||||
descr: 'ARC Miss Ratio'
|
||||
index: zfsArcMissRatio.{{ $index }}
|
||||
-
|
||||
oid: zfsL2ArcHits
|
||||
value: zfsL2ArcHits
|
||||
num_oid: .1.3.6.1.4.1.50536.1.5.1.{{ $index }}
|
||||
descr: 'L2ARC Hits'
|
||||
index: zfsL2ArcHits.{{ $index }}
|
||||
-
|
||||
oid: zfsL2ArcMisses
|
||||
value: zfsL2ArcMisses
|
||||
num_oid: .1.3.6.1.4.1.50536.1.5.2.{{ $index }}
|
||||
descr: 'L2ARC Misses'
|
||||
index: zfsL2ArcMisses.{{ $index }}
|
||||
-
|
||||
oid: zfsL2ArcRead
|
||||
value: zfsL2ArcRead
|
||||
num_oid: .1.3.6.1.4.1.50536.1.5.3.{{ $index }}
|
||||
descr: 'L2ARC Reads'
|
||||
index: zfsL2ArcRead.{{ $index }}
|
||||
-
|
||||
oid: zfsL2ArcWrite
|
||||
value: zfsL2ArcWrite
|
||||
num_oid: .1.3.6.1.4.1.50536.1.5.4.{{ $index }}
|
||||
descr: 'L2ARC Writes'
|
||||
index: zfsL2ArcWrite.{{ $index }}
|
||||
-
|
||||
oid: zfsL2ArcSize
|
||||
value: zfsL2ArcSize
|
||||
num_oid: .1.3.6.1.4.1.50536.1.5.5.{{ $index }}
|
||||
descr: 'L2ARC Size'
|
||||
index: zfsL2ArcSize.{{ $index }}
|
||||
-
|
||||
oid: zfsZilstatOps1sec
|
||||
value: zfsZilstatOps1sec
|
||||
num_oid: .1.3.6.1.4.1.50536.1.6.1.{{ $index }}
|
||||
descr: 'ZIL Operations last second'
|
||||
index: zfsZilstatOps1sec.{{ $index }}
|
||||
-
|
||||
oid: zfsZilstatOps5sec
|
||||
value: zfsZilstatOps5sec
|
||||
num_oid: .1.3.6.1.4.1.50536.1.6.2.{{ $index }}
|
||||
descr: 'ZIL Operations last 5 seconds'
|
||||
index: zfsZilstatOps5sec.{{ $index }}
|
||||
-
|
||||
oid: zfsZilstatOps10sec
|
||||
value: zfsZilstatOps10sec
|
||||
num_oid: .1.3.6.1.4.1.50536.1.6.3.{{ $index }}
|
||||
descr: 'ZIL Operations last 10 seconds'
|
||||
index: zfsZilstatOps10sec.{{ $index }}
|
||||
state:
|
||||
data:
|
||||
-
|
||||
oid: zpoolTable
|
||||
value: zpoolHealth
|
||||
num_oid: .1.3.6.1.4.1.50536.1.1.1.1.7.{{ $index }}
|
||||
descr: 'ZPool: {{ $zpoolDescr }}'
|
||||
index: zpoolHealth.{{ $index }}
|
||||
states:
|
||||
- { value: 0, descr: online, graph: 1, generic: 0 }
|
||||
- { value: 1, descr: degraded, graph: 1, generic: 1 }
|
||||
- { value: 2, descr: faulted, graph: 1, generic: 2 }
|
||||
- { value: 3, descr: offline, graph: 1, generic: 2 }
|
||||
- { value: 4, descr: unavail, graph: 1, generic: 2 }
|
||||
- { value: 5, descr: removed, graph: 1, generic: 2 }
|
@@ -9,4 +9,8 @@ over:
|
||||
discovery_modules:
|
||||
applications: true
|
||||
discovery:
|
||||
- sysDescr: FreeBSD
|
||||
-
|
||||
sysDescr: FreeBSD
|
||||
sysDescr_except:
|
||||
- FreeNAS
|
||||
- TrueNAS
|
||||
|
29
includes/definitions/truenas.yaml
Normal file
29
includes/definitions/truenas.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
os: truenas
|
||||
type: storage
|
||||
text: TrueNAS
|
||||
processor_stacked: true
|
||||
mib_dir:
|
||||
- ixsystems
|
||||
over:
|
||||
- { graph: device_processor, text: 'Processor Usage' }
|
||||
- { graph: device_ucd_memory, text: 'Memory Usage' }
|
||||
- { graph: device_storage, text: 'Storage Usage' }
|
||||
poller_modules:
|
||||
applications: false
|
||||
bgp-peers: false
|
||||
mpls: false
|
||||
ospf: false
|
||||
stp: false
|
||||
wireless: false
|
||||
discovery_modules:
|
||||
applications: false
|
||||
bgp-peers: false
|
||||
mpls: false
|
||||
stp: false
|
||||
wireless: false
|
||||
discovery:
|
||||
-
|
||||
sysObjectID: .1.3.6.1.4.1.8072.3.2.8
|
||||
sysDescr:
|
||||
- FreeNAS
|
||||
- TrueNAS
|
21
includes/discovery/storage/freenas-dataset.inc.php
Normal file
21
includes/discovery/storage/freenas-dataset.inc.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$datasetTable_array = snmpwalk_cache_oid($device, 'datasetTable', null, 'FREENAS-MIB');
|
||||
|
||||
$sql = "SELECT `storage_descr` FROM `storage` WHERE `device_id` = '".$device['device_id']."' AND `storage_type` != 'dataset'";
|
||||
$tmp_storage = dbFetchColumn($sql);
|
||||
|
||||
if (is_array($datasetTable_array)) {
|
||||
foreach ($datasetTable_array as $index => $dataset) {
|
||||
if (isset($dataset['datasetDescr'])) {
|
||||
if (!in_array($dataset['datasetDescr'], $tmp_storage)) {
|
||||
$dataset['datasetIndex'] = $index;
|
||||
$dataset['datasetTotal'] = $dataset['datasetSize'] * $dataset['datasetAllocationUnits'];
|
||||
$dataset['datasetAvail'] = ($dataset['datasetAvailable'] * $dataset['datasetAllocationUnits']);
|
||||
$dataset['datasetUsed'] = $dataset['datasetTotal'] - $dataset['datasetAvail'];
|
||||
|
||||
discover_storage($valid_storage, $device, $dataset['datasetIndex'], 'dataset', 'freenas-dataset', $dataset['datasetDescr'], $dataset['datasetTotal'], $dataset['datasetAllocationUnits'], $dataset['datasetUsed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
includes/discovery/storage/freenas-zpool.inc.php
Normal file
21
includes/discovery/storage/freenas-zpool.inc.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$zpooltable_array = snmpwalk_cache_oid($device, 'zpoolTable', null, 'FREENAS-MIB');
|
||||
|
||||
$sql = "SELECT `storage_descr` FROM `storage` WHERE `device_id` = '".$device['device_id']."' AND `storage_type` != 'zpool'";
|
||||
$tmp_storage = dbFetchColumn($sql);
|
||||
|
||||
if (is_array($zpooltable_array)) {
|
||||
foreach ($zpooltable_array as $index => $zpool) {
|
||||
if (isset($zpool['zpoolDescr'])) {
|
||||
if (!in_array($zpool['zpoolDescr'], $tmp_storage)) {
|
||||
$zpool['zpoolIndex'] = $index;
|
||||
$zpool['zpoolTotal'] = $zpool['zpoolSize'] * $zpool['zpoolAllocationUnits'];
|
||||
$zpool['zpoolAvail'] = ($zpool['zpoolAvailable'] * $zpool['zpoolAllocationUnits']);
|
||||
$zpool['zpoolUsed'] = $zpool['zpoolTotal'] - $zpool['zpoolAvail'];
|
||||
|
||||
discover_storage($valid_storage, $device, $zpool['zpoolIndex'], 'zpool', 'freenas-zpool', $zpool['zpoolDescr'], $zpool['zpoolTotal'], $zpool['zpoolAllocationUnits'], $zpool['zpoolUsed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
includes/polling/storage/freenas-dataset.inc.php
Normal file
13
includes/polling/storage/freenas-dataset.inc.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
if (!is_array($storage_cache['dataset'])) {
|
||||
$storage_cache['dataset'] = snmpwalk_cache_oid($device, 'datasetTable', null, 'FREENAS-MIB');
|
||||
d_echo($storage_cache);
|
||||
}
|
||||
|
||||
foreach ($storage_cache['dataset'] as $index => $entry) {
|
||||
$storage['units'] = $entry['datasetAllocationUnits'];
|
||||
$storage['size'] = ($entry['datasetSize'] * $storage['units']);
|
||||
$storage['free'] = ($entry['datasetAvailable'] * $storage['units']);
|
||||
$storage['used'] = ($storage['size'] - $storage['free']);
|
||||
}
|
13
includes/polling/storage/freenas-zpool.inc.php
Normal file
13
includes/polling/storage/freenas-zpool.inc.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
if (!is_array($storage_cache['zpool'])) {
|
||||
$storage_cache['zpool'] = snmpwalk_cache_oid($device, 'zpoolTable', null, 'FREENAS-MIB');
|
||||
d_echo($storage_cache);
|
||||
}
|
||||
|
||||
foreach ($storage_cache['zpool'] as $index => $entry) {
|
||||
$storage['units'] = $entry['zpoolAllocationUnits'];
|
||||
$storage['size'] = ($entry['zpoolSize'] * $storage['units']);
|
||||
$storage['free'] = ($entry['zpoolAvailable'] * $storage['units']);
|
||||
$storage['used'] = ($storage['size'] - $storage['free']);
|
||||
}
|
Reference in New Issue
Block a user