mirror of
https://github.com/opnsense/plugins.git
synced 2026-06-09 08:56:23 -04:00
Merge branch 'fix-2283' of https://github.com/Arnavion/plugins into Arnavion-fix-2283
This commit is contained in:
commit
dc1d703c5c
2 changed files with 18 additions and 27 deletions
|
|
@ -57,6 +57,7 @@ class ServiceController extends ApiControllerBase
|
|||
if ($this->request->isPost()) {
|
||||
$device = $this->request->getPost('device');
|
||||
$type = $this->request->getPost('type');
|
||||
$json = $this->request->getPost('json');
|
||||
|
||||
if (!in_array($device, $this->getDevices())) {
|
||||
return array("message" => "Invalid device name");
|
||||
|
|
@ -70,7 +71,15 @@ class ServiceController extends ApiControllerBase
|
|||
|
||||
$backend = new Backend();
|
||||
|
||||
$output = $backend->configdpRun("smart", array("info", $type, "/dev/" . $device));
|
||||
$params = array("info", $type, "/dev/" . $device);
|
||||
if ($json != NULL) {
|
||||
$params[0] = "info_json";
|
||||
}
|
||||
|
||||
$output = $backend->configdpRun("smart", $params);
|
||||
if ($json != NULL) {
|
||||
$output = json_decode($output, true);
|
||||
}
|
||||
|
||||
return array("output" => $output);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,35 +10,17 @@ parameters:
|
|||
type:script_output
|
||||
message:list installed devices
|
||||
|
||||
[info.i]
|
||||
command:/usr/local/sbin/smartctl -i
|
||||
parameters:%s; exit 0
|
||||
[info]
|
||||
command:/usr/local/sbin/smartctl
|
||||
parameters:-%s %s; exit 0
|
||||
type:script_output
|
||||
message:Get identity info for device %s
|
||||
message:exec smartctl -%s for device %s
|
||||
|
||||
[info.H]
|
||||
command:/usr/local/sbin/smartctl -H
|
||||
parameters:%s; exit 0
|
||||
[info_json]
|
||||
command:/usr/local/sbin/smartctl
|
||||
parameters:-%s --json=c %s; exit 0
|
||||
type:script_output
|
||||
message:Get SMART health status info for device %s
|
||||
|
||||
[info.c]
|
||||
command:/usr/local/sbin/smartctl -c
|
||||
parameters:%s; exit 0
|
||||
type:script_output
|
||||
message:Get capabilities for device %s
|
||||
|
||||
[info.A]
|
||||
command:/usr/local/sbin/smartctl -A
|
||||
parameters:%s; exit 0
|
||||
type:script_output
|
||||
message:Get vendor-specific attributes for device %s
|
||||
|
||||
[info.a]
|
||||
command:/usr/local/sbin/smartctl -a
|
||||
parameters:%s; exit 0
|
||||
type:script_output
|
||||
message:Get all SMART info for device %s
|
||||
message:exec smartctl -%s (JSON) for device %s
|
||||
|
||||
[log.error]
|
||||
command:/usr/local/sbin/smartctl -l error
|
||||
|
|
|
|||
Loading…
Reference in a new issue