mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Fixed error in snmp alerts whit PandoraFMS event. Ticket#1592
This commit is contained in:
parent
1d8f101787
commit
e9d61ab644
@ -70,21 +70,42 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
$fields_rows = array();
|
$fields_rows = array();
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
|
|
||||||
|
if (($i == 5) && ($command['id'] == 3)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$field_description = $fields_descriptions[$i - 1];
|
$field_description = $fields_descriptions[$i - 1];
|
||||||
$field_value = $fields_values[$i - 1];
|
$field_value = $fields_values[$i - 1];
|
||||||
|
|
||||||
if (!empty($field_description)) {
|
if (!empty($field_description)) {
|
||||||
$fdesc = $field_description .
|
//If the value is 5, this because severity in snmp alerts is not permit to show
|
||||||
' <br><span style="font-size:xx-small; font-weight:normal;">' . sprintf(__('Field %s'), $i) . '</span>';
|
if (($i > 5) && ($command['id'] == 3)){
|
||||||
|
$fdesc = $field_description .
|
||||||
|
' <br><span style="font-size:xx-small; font-weight:normal;">' . sprintf(__('Field %s'), $i - 1) . '</span>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$fdesc = $field_description .
|
||||||
|
' <br><span style="font-size:xx-small; font-weight:normal;">' . sprintf(__('Field %s'), $i) . '</span>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it
|
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it
|
||||||
if (substr_count($command['command'], "_field" . $i . "_") > 0) {
|
if (($i > 5) && ($command['id'] == 3)){
|
||||||
$fdesc = sprintf(__('Field %s'), $i);
|
if (substr_count($command['command'], "_field" . $i - 1 . "_") > 0) {
|
||||||
|
$fdesc = sprintf(__('Field %s'), $i - 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fdesc = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
$fdesc = '';
|
if (substr_count($command['command'], "_field" . $i . "_") > 0) {
|
||||||
|
$fdesc = sprintf(__('Field %s'), $i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fdesc = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +191,14 @@ if (is_ajax ()) {
|
|||||||
$fields_rows[$i] .= '</tr>';
|
$fields_rows[$i] .= '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If command is PandoraFMS event, field 5 must be empty because "severity" must be set by the alert
|
||||||
|
if ($command['id'] == 3){
|
||||||
|
$fields_rows[5] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
html_debug_print($fields_rows, true);
|
||||||
|
|
||||||
$command['fields_rows'] = $fields_rows;
|
$command['fields_rows'] = $fields_rows;
|
||||||
|
|
||||||
echo json_encode ($command);
|
echo json_encode ($command);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user