mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Added skip_values operator and documentation (#10419)
* more operators * os_schema * discovery_schema * doc * doc
This commit is contained in:
parent
164f3a096a
commit
71da38cdf5
@ -145,6 +145,22 @@ $index="1.20", then $subindex0="1" and $subindex1="20".
|
||||
value: 4
|
||||
```
|
||||
|
||||
> ``` op ``` can be any of the following operators :
|
||||
>
|
||||
> =, !=, ==, !==, <=, >=, <, >,
|
||||
> starts, ends, contains, regex, in_array, not_starts,
|
||||
> not_ends, not_contains, not_regex, not_in_array
|
||||
>
|
||||
> Example:
|
||||
|
||||
```yaml
|
||||
skip_values:
|
||||
-
|
||||
oid: sensorName
|
||||
op: 'not_in_array'
|
||||
value: ['sensor1', 'sensor2']
|
||||
```
|
||||
|
||||
If you aren't able to use yaml to perform the sensor discovery, you
|
||||
will most likely need to use Advanced health discovery.
|
||||
|
||||
|
@ -314,12 +314,24 @@ function compare_var($a, $b, $comparison = '=')
|
||||
return $a < $b;
|
||||
case "contains":
|
||||
return str_contains($a, $b);
|
||||
case "not_contains":
|
||||
return !str_contains($a, $b);
|
||||
case "starts":
|
||||
return starts_with($a, $b);
|
||||
case "not_starts":
|
||||
return !starts_with($a, $b);
|
||||
case "ends":
|
||||
return ends_with($a, $b);
|
||||
case "not_ends":
|
||||
return !ends_with($a, $b);
|
||||
case "regex":
|
||||
return (bool)preg_match($b, $a);
|
||||
case "not regex":
|
||||
return !((bool)preg_match($b, $a));
|
||||
case "in_array":
|
||||
return in_array($a, $b);
|
||||
case "not_in_array":
|
||||
return !in_array($a, $b);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -444,7 +444,13 @@
|
||||
"starts",
|
||||
"ends",
|
||||
"contains",
|
||||
"regex"
|
||||
"regex",
|
||||
"not_starts",
|
||||
"not_ends",
|
||||
"not_contains",
|
||||
"not_regex",
|
||||
"in_array",
|
||||
"not_in_array"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,13 @@
|
||||
"starts",
|
||||
"ends",
|
||||
"contains",
|
||||
"regex"
|
||||
"regex",
|
||||
"not_starts",
|
||||
"not_ends",
|
||||
"not_contains",
|
||||
"not_regex",
|
||||
"in_array",
|
||||
"not_in_array"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user