mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Feature: skip_value can check OID existance (#11822)
* exists for skip_values * AR routers are using another logic for SFPs Power * schemas * tests
This commit is contained in:
@@ -161,7 +161,7 @@ $index="1.20", then $subindex0="1" and $subindex1="20".
|
|||||||
>
|
>
|
||||||
> =, !=, ==, !==, <=, >=, <, >,
|
> =, !=, ==, !==, <=, >=, <, >,
|
||||||
> starts, ends, contains, regex, in_array, not_starts,
|
> starts, ends, contains, regex, in_array, not_starts,
|
||||||
> not_ends, not_contains, not_regex, not_in_array
|
> not_ends, not_contains, not_regex, not_in_array, exists
|
||||||
>
|
>
|
||||||
> Example:
|
> Example:
|
||||||
|
|
||||||
@@ -173,6 +173,14 @@ $index="1.20", then $subindex0="1" and $subindex1="20".
|
|||||||
value: ['sensor1', 'sensor2']
|
value: ['sensor1', 'sensor2']
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
skip_values:
|
||||||
|
-
|
||||||
|
oid: sensorOptionalOID
|
||||||
|
op: 'exists'
|
||||||
|
value: false
|
||||||
|
```
|
||||||
|
|
||||||
If you aren't able to use yaml to perform the sensor discovery, you
|
If you aren't able to use yaml to perform the sensor discovery, you
|
||||||
will most likely need to use Advanced health discovery.
|
will most likely need to use Advanced health discovery.
|
||||||
|
|
||||||
|
@@ -218,6 +218,33 @@ modules:
|
|||||||
oid: hwEntityAdminStatus
|
oid: hwEntityAdminStatus
|
||||||
op: '='
|
op: '='
|
||||||
value: 12
|
value: 12
|
||||||
|
-
|
||||||
|
oid: hwOpticalModuleInfoTable
|
||||||
|
value: hwEntityOpticalRxPower
|
||||||
|
num_oid: '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.8.{{ $index }}'
|
||||||
|
descr: '{{ $entPhysicalName }} Rx'
|
||||||
|
entPhysicalIndex: '{{ $index }}'
|
||||||
|
entPhysicalIndex_measured: ports
|
||||||
|
index: 'rx-{{ $index }}'
|
||||||
|
divisor: 100
|
||||||
|
group: '{{ $entPhysicalName }}'
|
||||||
|
skip_values:
|
||||||
|
-
|
||||||
|
oid: hwEntityOpticalRxPower
|
||||||
|
op: '>'
|
||||||
|
value: 0
|
||||||
|
-
|
||||||
|
oid: hwEntityAdminStatus
|
||||||
|
op: '='
|
||||||
|
value: 12
|
||||||
|
-
|
||||||
|
oid: hwEntityOpticalLaneRxPower
|
||||||
|
op: 'exists'
|
||||||
|
value: true
|
||||||
|
-
|
||||||
|
oid: hwEntityOpticalBiasCurrent
|
||||||
|
op: '='
|
||||||
|
value: 0
|
||||||
-
|
-
|
||||||
oid: hwOpticalModuleInfoTable
|
oid: hwOpticalModuleInfoTable
|
||||||
value: hwEntityOpticalTxPower
|
value: hwEntityOpticalTxPower
|
||||||
@@ -237,6 +264,33 @@ modules:
|
|||||||
oid: hwEntityAdminStatus
|
oid: hwEntityAdminStatus
|
||||||
op: '='
|
op: '='
|
||||||
value: 12
|
value: 12
|
||||||
|
-
|
||||||
|
oid: hwOpticalModuleInfoTable
|
||||||
|
value: hwEntityOpticalTxPower
|
||||||
|
num_oid: '.1.3.6.1.4.1.2011.5.25.31.1.1.3.1.9.{{ $index }}'
|
||||||
|
descr: '{{ $entPhysicalName }} Tx'
|
||||||
|
entPhysicalIndex: '{{ $index }}'
|
||||||
|
entPhysicalIndex_measured: ports
|
||||||
|
index: 'tx-{{ $index }}'
|
||||||
|
divisor: 100
|
||||||
|
group: '{{ $entPhysicalName }}'
|
||||||
|
skip_values:
|
||||||
|
-
|
||||||
|
oid: hwEntityOpticalTxPower
|
||||||
|
op: '>'
|
||||||
|
value: 0
|
||||||
|
-
|
||||||
|
oid: hwEntityAdminStatus
|
||||||
|
op: '='
|
||||||
|
value: 12
|
||||||
|
-
|
||||||
|
oid: hwEntityOpticalLaneTxPower
|
||||||
|
op: 'exists'
|
||||||
|
value: true
|
||||||
|
-
|
||||||
|
oid: hwEntityOpticalBiasCurrent
|
||||||
|
op: '='
|
||||||
|
value: 0
|
||||||
-
|
-
|
||||||
oid: hwOpticalModuleInfoTable
|
oid: hwOpticalModuleInfoTable
|
||||||
value: hwEntityOpticalLaneRxPower
|
value: hwEntityOpticalLaneRxPower
|
||||||
|
@@ -337,6 +337,8 @@ function compare_var($a, $b, $comparison = '=')
|
|||||||
return in_array($a, $b);
|
return in_array($a, $b);
|
||||||
case "not_in_array":
|
case "not_in_array":
|
||||||
return !in_array($a, $b);
|
return !in_array($a, $b);
|
||||||
|
case "exists":
|
||||||
|
return isset($a) == $b;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,7 @@
|
|||||||
"$ref": "#/definitions/comparison"
|
"$ref": "#/definitions/comparison"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"type": ["integer", "string", "array"],
|
"type": ["boolean", "integer", "string", "array"],
|
||||||
"items": {
|
"items": {
|
||||||
"type": ["integer", "string"]
|
"type": ["integer", "string"]
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
"$ref": "#/definitions/comparison"
|
"$ref": "#/definitions/comparison"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"type": ["integer", "string", "array"],
|
"type": ["boolean", "integer", "string", "array"],
|
||||||
"items": {
|
"items": {
|
||||||
"type": ["integer", "string"]
|
"type": ["integer", "string"]
|
||||||
}
|
}
|
||||||
@@ -385,7 +385,7 @@
|
|||||||
"$ref": "#/definitions/comparison"
|
"$ref": "#/definitions/comparison"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"type": ["integer", "string", "array"],
|
"type": ["boolean", "integer", "string", "array"],
|
||||||
"items": {
|
"items": {
|
||||||
"type": ["integer", "string"]
|
"type": ["integer", "string"]
|
||||||
}
|
}
|
||||||
@@ -468,7 +468,8 @@
|
|||||||
"not_contains",
|
"not_contains",
|
||||||
"not_regex",
|
"not_regex",
|
||||||
"in_array",
|
"in_array",
|
||||||
"not_in_array"
|
"not_in_array",
|
||||||
|
"exists"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -533,7 +533,8 @@
|
|||||||
"not_contains",
|
"not_contains",
|
||||||
"not_regex",
|
"not_regex",
|
||||||
"in_array",
|
"in_array",
|
||||||
"not_in_array"
|
"not_in_array",
|
||||||
|
"exists"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3732
tests/data/vrp_ar169sfp.json
Normal file
3732
tests/data/vrp_ar169sfp.json
Normal file
File diff suppressed because it is too large
Load Diff
1120
tests/snmpsim/vrp_ar169sfp.snmprec
Normal file
1120
tests/snmpsim/vrp_ar169sfp.snmprec
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user