mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-04-08 17:06:05 +02:00
enh(generic-snmp): panic removed
This commit is contained in:
parent
271d9e8b75
commit
f01f892c5f
18
experimental/examples/cpu1.json
Normal file
18
experimental/examples/cpu1.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"leaf": {
|
||||
"name": "cpu",
|
||||
"output": {
|
||||
"status": "CPU {idx} usage: {value} %",
|
||||
"default": "{status}: {count} CPU(s) average usage is {total_cpu_avg} %"
|
||||
},
|
||||
"entries": [
|
||||
{ "Agregation": { "name": "total_cpu_avg", "op": "Average"}},
|
||||
{ "Query": { "name": "cpu_{idx}", "oid": "1.3.6.1.2.1.25.3.3.1.2", "query": "Walk" }}
|
||||
],
|
||||
"data": {
|
||||
"uom": "%",
|
||||
"min": 0,
|
||||
"max": 100
|
||||
}
|
||||
}
|
||||
}
|
74
experimental/examples/mem.json
Normal file
74
experimental/examples/mem.json
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"leaf": {
|
||||
"name": "mem",
|
||||
"output": {
|
||||
"header": "{status}: ",
|
||||
"text": [
|
||||
"{count} CPU(s) average usage is {total_cpu_avg} %",
|
||||
"CPU '{idx}' usage: {value} %"
|
||||
]
|
||||
},
|
||||
"entries": [
|
||||
{
|
||||
"Query": {
|
||||
"name": "used",
|
||||
"oid": "1.3.6.1.4.1.2021.4.6.0",
|
||||
"query": "Get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Query": {
|
||||
"name": "free",
|
||||
"oid": "1.3.6.1.4.1.2021.4.4.0",
|
||||
"query": "Get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Query": {
|
||||
"name": "used_prct",
|
||||
"oid": "1.3.6.1.4.1.2021.4.14.0",
|
||||
"query": "Get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Query": {
|
||||
"name": "buffer",
|
||||
"oid": "1.3.6.1.4.1.2021.4.13.0",
|
||||
"query": "Get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Query": {
|
||||
"name": "cached",
|
||||
"oid": "1.3.6.1.4.1.2021.4.11.0",
|
||||
"query": "Get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Query": {
|
||||
"name": "shared",
|
||||
"oid": "1.3.6.1.4.1.2021.4.5.0",
|
||||
"query": "Get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Query": {
|
||||
"name": "used1",
|
||||
"oid": "1.3.6.1.4.1.2021.4.3.0",
|
||||
"query": "Get"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Query": {
|
||||
"name": "used2",
|
||||
"oid": "1.3.6.1.4.1.2021.4.15.0",
|
||||
"query": "Get"
|
||||
}
|
||||
}
|
||||
],
|
||||
"data": {
|
||||
"uom": "B",
|
||||
"min": 0
|
||||
}
|
||||
}
|
||||
}
|
31
experimental/examples/new-cpu.json
Normal file
31
experimental/examples/new-cpu.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"collect": {
|
||||
"snmp": [
|
||||
{
|
||||
"name": "cpu",
|
||||
"oid": "1.3.6.1.2.1.25.3.3.1.2",
|
||||
"query": "Walk", // par défaut walk
|
||||
}
|
||||
]
|
||||
},
|
||||
"compute": {
|
||||
"metrics": [
|
||||
{
|
||||
"name": "core.cpu.usage.percent",
|
||||
"value": "{cpu}",
|
||||
"uom": "%", // optional
|
||||
"min": 0, // optional
|
||||
"max": 100 // optional
|
||||
}
|
||||
],
|
||||
"aggregations": [
|
||||
{
|
||||
"name": "avg.cpu.usage.percent",
|
||||
"value": "Average({cpu})", // si agregation, pas de prefix
|
||||
"uom": "%", // optional
|
||||
"min": 0, // optional
|
||||
"max": 100 // optional
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
46
experimental/examples/new-disk.json
Normal file
46
experimental/examples/new-disk.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"collect": {
|
||||
"snmp": [
|
||||
{
|
||||
"name": "disk",
|
||||
"oid": "1.3.6.1.2.1.25.2.3.1",
|
||||
"query": "Walk", // par défaut walk
|
||||
"labels": {
|
||||
".3": "label",
|
||||
".4": "allocationUnits",
|
||||
".5": "size",
|
||||
".6": "used"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"compute": {
|
||||
"metrics": [
|
||||
{
|
||||
"prefix": "{disk.label}", // par défaut "{idx}"
|
||||
"name": "disk.usage.percent",
|
||||
"value": "100 * {disk.used} / {disk.size}",
|
||||
"uom": "%", // optional
|
||||
"min": 0, // optional
|
||||
"max": 100, // optional
|
||||
},
|
||||
{
|
||||
"name": "disk.usage.bytes",
|
||||
"value": "{disk.used} * {disk.allocationUnits}",
|
||||
"uom": "B", // optional
|
||||
"min": 0, // optional
|
||||
"max_expr": "{disk.size} * {disk.allocationUnits}" // optional
|
||||
}
|
||||
],
|
||||
"aggregations": [
|
||||
{
|
||||
"name": "avg.disk.usage.percent",
|
||||
"value": "Average({metrics.disk.usage.percent})", // si agregation, pas de prefix
|
||||
"uom": "%", // optional
|
||||
"min": 0, // optional
|
||||
"max": 100 // optional
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
35
experimental/examples/new-mem.json
Normal file
35
experimental/examples/new-mem.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"collect": {
|
||||
"snmp": [
|
||||
{
|
||||
"name": "total",
|
||||
"oid": "1.3.6.1.4.1.2021.4.6.0",
|
||||
"query": "Get", // par défaut walk
|
||||
},
|
||||
{
|
||||
"name": "free",
|
||||
"oid": "1.3.6.1.4.1.2021.4.11.0",
|
||||
"query": "Get", // par défaut walk
|
||||
}
|
||||
]
|
||||
},
|
||||
"compute": {
|
||||
"metrics": [
|
||||
{
|
||||
"name": "core.mem.usage.percent",
|
||||
"value": "100 * (1 - {free}/{cpu})",
|
||||
"uom": "%", // optional
|
||||
"min": 0, // optional
|
||||
"max": 100 // optional
|
||||
},
|
||||
{
|
||||
"name": "avg.cpu.usage.percent",
|
||||
"value": "Average({cpu})", // si agregation, pas de prefix
|
||||
"uom": "%", // optional
|
||||
"min": 0, // optional
|
||||
"max": 100 // optional
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,10 @@ fn json_to_command(file_name: &str) -> Result<Command> {
|
||||
// Transform content of the file into a string
|
||||
let contents = match fs::read_to_string(file_name) {
|
||||
Ok(ret) => ret,
|
||||
Err(err) => panic!("Could not deserialize the file, error code: {}", err),
|
||||
Err(err) => {
|
||||
println!("erreur: {}", err);
|
||||
std::process::exit(3);
|
||||
},
|
||||
};
|
||||
|
||||
let module: Result<Command> = serde_json::from_str(&contents.as_str());
|
||||
|
Loading…
x
Reference in New Issue
Block a user