minor fixes

This commit is contained in:
fbsanchez 2019-10-28 18:37:01 +01:00
parent 7accbc97c4
commit 7d5b845e1f
2 changed files with 54 additions and 7 deletions

View File

@ -57,11 +57,50 @@ if (is_ajax()) {
$component['plugin_pass']
);
if ($component['type'] >= 15
&& $component['type'] <= 18
) {
// New support for snmp v3.
$component['snmp_version'] = $component['tcp_send'];
$component['snmp3_auth_user'] = io_safe_output(
$component['plugin_user']
);
// Must use io_output_password.
$component['snmp3_auth_pass'] = io_safe_output(
$component['plugin_pass']
);
$component['snmp3_auth_method'] = io_safe_output(
$component['plugin_parameter']
);
$component['snmp3_privacy_method'] = io_safe_output(
$component['custom_string_1']
);
$component['snmp3_privacy_pass'] = io_safe_output(
$component['custom_string_2']
);
$component['snmp3_security_level'] = io_safe_output(
$component['custom_string_3']
);
} else if ($component['type'] >= 34
&& $component['type'] <= 37
) {
$component['command_text'] = io_safe_output(
$component['tcp_send']
);
$component['command_credential_identifier'] = io_safe_output(
$component['custom_string_1']
);
$component['command_os'] = io_safe_output(
$component['custom_string_2']
);
}
$component['str_warning'] = io_safe_output($component['str_warning']);
$component['str_critical'] = io_safe_output($component['str_critical']);
$component['warning_inverse'] = (bool) $component['warning_inverse'];
$component['critical_inverse'] = (bool) $component['critical_inverse'];
hd($component, true);
echo io_json_mb_encode($component);
return;
}

View File

@ -541,13 +541,13 @@ function configure_modules_form() {
}
if (data["type"] >= 15 && data["type"] <= 18) {
$("#snmp_version").val(data["tcp_send"]);
$("#text-snmp3_auth_user").val(data["plugin_user"]);
$("#password-snmp3_auth_pass").val(data["plugin_pass"]);
$("#snmp3_auth_method").val(data["plugin_parameter"]);
$("#snmp3_privacy_method").val(data["custom_string_1"]);
$("#password-snmp3_privacy_pass").val(data["custom_string_2"]);
$("#snmp3_security_level").val(data["custom_string_3"]);
$("#snmp_version").val(data["snmp_version"]);
$("#text-snmp3_auth_user").val(data["snmp3_auth_user"]);
$("#password-snmp3_auth_pass").val(data["snmp3_auth_pass"]);
$("#snmp3_auth_method").val(data["snmp3_auth_method"]);
$("#snmp3_privacy_method").val(data["snmp3_privacy_method"]);
$("#password-snmp3_privacy_pass").val(data["snmp3_privacy_pass"]);
$("#snmp3_security_level").val(data["snmp3_security_level"]);
if (data["tcp_send"] == "3") {
$("#simple-field_snmpv3_row1").attr("style", "");
@ -564,6 +564,14 @@ function configure_modules_form() {
if (data["id_plugin"] != undefined) {
$("#id_plugin").trigger("change");
}
if (data["type"] >= 34 && data["type"] <= 37) {
$("#command_text").val(data["command_text"]);
$("#command_credential_identifier").val(
data["command_credential_identifier"]
);
$("#command_os").val(data["command_os"]);
}
},
"json"
);