pandorafms/pandora_console/include/ajax/snmp.ajax.php

65 lines
2.0 KiB
PHP
Raw Normal View History

<?php
2023-06-08 13:19:01 +02:00
// Pandora FMS - https://pandorafms.com
// ==================================================
2023-06-08 11:53:13 +02:00
// Copyright (c) 2005-2023 Pandora FMS
2023-06-08 13:19:01 +02:00
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Login check
global $config;
require_once 'include/functions_snmp.php';
$save_snmp_translation = (bool) get_parameter('save_snmp_translation', 0);
$delete_snmp_translation = (bool) get_parameter('delete_snmp_translation', 0);
$update_snmp_translation = (bool) get_parameter('update_snmp_translation', 0);
$delete_snmp_filter = (bool) get_parameter('delete_snmp_filter', 0);
// skins image checks
if ($save_snmp_translation) {
$oid = get_parameter('oid', '');
$description = get_parameter('description', '');
$post_process = get_parameter('post_process', '');
$result = snmp_save_translation($oid, $description, $post_process);
echo json_encode(['correct' => $result]);
return;
}
if ($delete_snmp_translation) {
$oid = get_parameter('oid', '');
$result = snmp_delete_translation($oid);
echo json_encode(['correct' => $result]);
return;
}
if ($update_snmp_translation) {
$oid = get_parameter('oid', '');
$new_oid = get_parameter('new_oid', '');
$description = get_parameter('description', '');
$post_process = get_parameter('post_process', '');
$result = snmp_update_translation($oid, $new_oid, $description, $post_process);
echo json_encode(['correct' => $result]);
return;
}
2017-10-26 11:03:08 +02:00
if ($delete_snmp_filter) {
$filter_id = get_parameter('filter_id');
db_process_sql_delete('tsnmp_filter', ['id_snmp_filter' => $filter_id]);
2017-10-26 11:03:08 +02:00
return;
2017-10-26 11:03:08 +02:00
}