From 8e74a0ee1ee679caabc4686a985010dd3e1f523c Mon Sep 17 00:00:00 2001 From: Pablo Bovina Date: Fri, 23 Oct 2020 10:21:44 -0400 Subject: [PATCH 01/11] Reimplementation logic for trap generation In the current implementation "Fault" is responsible for the generation and dispatch of traps. This logic is removed from it, leaving only the responsibility of sending the metadata of a trap to a service dedicated to generating and sending them. The fm.conf file will contain the IP and port values of the service. Story: 2008132 Task: 40867 Depends-On: https://review.opendev.org/761217 Change-Id: I575dfa2329f11821404ca4cb1d539e5189444b4e Signed-off-by: Pablo Bovina --- doc/requirements.txt | 6 +- fm-common/centos/fm-common.spec | 2 + fm-common/sources/Makefile | 2 +- fm-common/sources/fmConstants.h | 3 + fm-common/sources/fmSnmpUtils.cpp | 557 +++++++++++++++++++----------- test-requirements.txt | 2 +- tox.ini | 14 +- 7 files changed, 378 insertions(+), 208 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 5f5e4377..dde36d52 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,8 +1,8 @@ -sphinx>=2.0.0,!=2.1.0 # BSD -openstackdocstheme>=2.2.1 # Apache-2.0 +sphinx>=1.6.2 # BSD +openstackdocstheme>=1.29.2 # Apache-2.0 # Release Notes documentation -reno>=3.1.0 # Apache-2.0 +reno>=2.11.2 # Apache-2.0 # Api Ref documentation os-api-ref>=1.4.0 # Apache-2.0 diff --git a/fm-common/centos/fm-common.spec b/fm-common/centos/fm-common.spec index 324fb304..a5c36188 100644 --- a/fm-common/centos/fm-common.spec +++ b/fm-common/centos/fm-common.spec @@ -19,6 +19,8 @@ BuildRequires: python-devel BuildRequires: python-setuptools BuildRequires: python2-pip BuildRequires: python2-wheel +Buildrequires: json-c-devel +Requires: json-c %package -n fm-common-dev Summary: CGTS Platform Fault Management Common Package - Development files diff --git a/fm-common/sources/Makefile b/fm-common/sources/Makefile index 7b1ea031..ad7f871f 100755 --- a/fm-common/sources/Makefile +++ b/fm-common/sources/Makefile @@ -4,7 +4,7 @@ SRCS = fmAPI.cpp fmFile.cpp fmLog.cpp fmMsgServer.cpp fmMutex.cpp fmSocket.cpp f CLI_SRCS = fm_cli.cpp OBJS = $(SRCS:.cpp=.o) CLI_OBJS = fm_cli.o -LDLIBS = -lstdc++ -lrt -luuid -lpq -lpthread -lpython2.7 +LDLIBS = -lstdc++ -lrt -luuid -lpq -lpthread -lpython2.7 -ljson-c INCLUDES = -I./ -I$(shell pg_config --includedir) CCFLAGS = -g -O2 -Wall -Werror -fPIC EXTRACCFLAGS= -Wformat -Wformat-security diff --git a/fm-common/sources/fmConstants.h b/fm-common/sources/fmConstants.h index 954c28af..7b649b06 100644 --- a/fm-common/sources/fmConstants.h +++ b/fm-common/sources/fmConstants.h @@ -94,6 +94,9 @@ #define FM_STRING_TRUE "True" #define FM_CONF_PASSWORD "password" #define FM_CONF_CONNECTION "connection" +#define FM_TRAP_SERVER_IP "trap_server_ip" +#define FM_TRAP_SERVER_PORT "trap_server_port" +#define FM_TRAP_SNMP_ENABLED "snmp_enabled" #define CLEAR_ALL_REASON_TEXT "System initiated hierarchical alarm clear" diff --git a/fm-common/sources/fmSnmpUtils.cpp b/fm-common/sources/fmSnmpUtils.cpp index 9177a028..7e63963b 100644 --- a/fm-common/sources/fmSnmpUtils.cpp +++ b/fm-common/sources/fmSnmpUtils.cpp @@ -1,28 +1,36 @@ // -// Copyright (c) 2014-2018 Wind River Systems, Inc. +// Copyright (c) 2014-2020 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include #include +#include +#include +#include +#include #include +#include +#include +#include #include +#include -#include "fmDbAPI.h" -#include "fmFile.h" #include "fmAPI.h" -#include "fmMsg.h" -#include "fmLog.h" +#include "fmConfig.h" +#include "fmDbAPI.h" #include "fmDb.h" #include "fmDbUtils.h" +#include "fmFile.h" +#include "fmLog.h" +#include "fmMsg.h" #include "fmSnmpConstants.h" #include "fmSnmpUtils.h" -#include "fmConfig.h" +#include "fmSocket.h" + +#define JSON_TRAP_TAG_ALARM "alarm" +#define JSON_TRAP_TAG_OP_TYPE "operation_type" +#define JSON_TRAP_EMPTY "" typedef std::map int_to_objtype; @@ -31,260 +39,405 @@ static pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; fm_db_result_t &getTrapDestList(){ - static fm_db_result_t trap_dest_list; - return trap_dest_list; + static fm_db_result_t trap_dest_list; + return trap_dest_list; } static void add_to_table(int t, std::string objtype, int_to_objtype &tbl) { - tbl[t]=objtype; + tbl[t]=objtype; } static void init_objtype_table() { - pthread_mutex_lock(&mutex); - static bool has_inited=false; - while (!has_inited){ - add_to_table(FM_ALARM_SEVERITY_CLEAR, ALARM_MSG, objtype_map); - add_to_table(FM_ALARM_SEVERITY_WARNING, ALARM_WARNING, objtype_map); - add_to_table(FM_ALARM_SEVERITY_MINOR, ALARM_MINOR, objtype_map); - add_to_table(FM_ALARM_SEVERITY_MAJOR, ALARM_MAJOR, objtype_map); - add_to_table(FM_ALARM_SEVERITY_CRITICAL, ALARM_CRITICAL, objtype_map); - add_to_table(FM_ALARM_CLEAR, ALARM_CLEAR, objtype_map); - add_to_table(FM_ALARM_HIERARCHICAL_CLEAR, ALARM_HIERARCHICAL_CLEAR, objtype_map); - add_to_table(FM_ALARM_MESSAGE, ALARM_MSG, objtype_map); - add_to_table(FM_WARM_START, WARM_START, objtype_map); - has_inited=true; - } - pthread_mutex_unlock(&mutex); + pthread_mutex_lock(&mutex); + static bool has_inited=false; + while (!has_inited){ + add_to_table(FM_ALARM_SEVERITY_CLEAR, ALARM_MSG, objtype_map); + add_to_table(FM_ALARM_SEVERITY_WARNING, ALARM_WARNING, objtype_map); + add_to_table(FM_ALARM_SEVERITY_MINOR, ALARM_MINOR, objtype_map); + add_to_table(FM_ALARM_SEVERITY_MAJOR, ALARM_MAJOR, objtype_map); + add_to_table(FM_ALARM_SEVERITY_CRITICAL, ALARM_CRITICAL, objtype_map); + add_to_table(FM_ALARM_CLEAR, ALARM_CLEAR, objtype_map); + add_to_table(FM_ALARM_HIERARCHICAL_CLEAR, ALARM_HIERARCHICAL_CLEAR, objtype_map); + add_to_table(FM_ALARM_MESSAGE, ALARM_MSG, objtype_map); + add_to_table(FM_WARM_START, WARM_START, objtype_map); + has_inited=true; + } + pthread_mutex_unlock(&mutex); } -static std::string add_time_val(std::string &str, - const std::string &objtype, FMTimeT time){ - std::string time_str; - fm_db_util_make_timestamp_string(time_str, time, true); - return str + objtype + STR_TYPE + time_str + SEP; +/** +* This method creates a json trap with the operation type attribute. + + { + "operation_type": "your_value", + "alarm" : { + } + } + +* Returns the json object representing the new trap. +*/ +struct json_object* init_json_trap(std::string op_type){ + struct json_object *json_trap = json_object_new_object(); + struct json_object *json_data_operation_type = + json_object_new_string(op_type.c_str()); + json_object_object_add(json_trap, JSON_TRAP_TAG_OP_TYPE, + json_data_operation_type ); + struct json_object *alarm_values = json_object_new_object(); + json_object_object_add(json_trap, JSON_TRAP_TAG_ALARM, alarm_values); + return json_trap; } -static std::string add_str_val(std::string &str, - const std::string &objtype, const char *value){ - std::string val(value); - return str + objtype + STR_TYPE + '"' + val + '"' + SEP; + +/** + +* This method adds new metadata given an json object that represents a trap. + +ie: Given the attributes object_type "v1", value "v2" +the result will be this: + + { + "operation_type": "alarm", + "alarm" : { ... + "v1": "v2" + } + } + +* The json object provided has the added metadata after the operation. + +*/ +void add_value_json_trap(struct json_object* json_trap, std::string obj_type, + std::string value){ + + struct json_object *json_alarm_values = NULL; + json_object_object_get_ex(json_trap, JSON_TRAP_TAG_ALARM, &json_alarm_values); + + struct json_object *json_value = json_object_new_string(value.c_str()); + json_object_object_add(json_alarm_values, obj_type.c_str(), json_value); + + return; } -static std::string add_int_val(std::string &str, - const std::string &objtype, int value){ - return str + objtype + INT_TYPE + fm_db_util_int_to_string(value) + SEP; + +/** +This method opens an socket and writes a message given a server name, +port number and the number of bytes of the message. + +Returns True if message is write succesfully else returns False. + +*/ +bool send_data(const char * server_name, int portno, const void * message, + int message_len){ + + char addr[INET6_ADDRSTRLEN]; + static bool m_connected = false; + static CFmSocket m_client; + struct addrinfo hints; + struct addrinfo *res = NULL; + memset(&hints,0,sizeof(hints)); + hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ + hints.ai_socktype = SOCK_STREAM; /* Datagram socket */ + hints.ai_flags = 0; /* For wildcard IP address */ + hints.ai_protocol = 0; /* Any protocol */ + hints.ai_canonname = NULL; + hints.ai_addr = NULL; + hints.ai_next = NULL; + bool result = false; + + int rc = getaddrinfo(server_name, NULL, &hints, &res); + if (rc != 0) { + FM_ERROR_LOG("ERROR failed to get SNMP trap server address info :%d", errno); + } else { + if (res->ai_family == AF_INET || res->ai_family==AF_INET6) { + if(res->ai_family == AF_INET) { + inet_ntop(AF_INET, &(((sockaddr_in*)res->ai_addr)->sin_addr), + addr, sizeof(addr)); + } else if (res->ai_family == AF_INET6) { + inet_ntop(AF_INET6, &(((sockaddr_in6*)res->ai_addr)->sin6_addr), + addr, sizeof(addr)); + } + m_connected = m_client.connect(addr, portno, res->ai_family); + if (m_connected == true) { + result = m_client.write_packet(message, message_len); + if (result){ + FM_INFO_LOG("SNMP sent data successfully"); + } + } else { + FM_ERROR_LOG("ERROR failed to connect with SNMP trap server: %d", errno); + } + } + } + freeaddrinfo(res); + return result; } static std::string get_trap_objtype(int type){ - init_objtype_table(); - return objtype_map[type]; + init_objtype_table(); + return objtype_map[type]; } static void add_to_list(std::vector &trap_strings) { - std::string delimiter = " "; + std::string delimiter = " "; - std::vector::iterator it = trap_strings.begin(); - std::vector::iterator end = trap_strings.end(); - getTrapDestList().clear(); - for (; it != end; ++it){ - size_t pos = 0; - fm_db_single_result_t entry; - pos = (*it).find(delimiter); - entry[FM_TRAPDEST_IP] = (*it).substr(0, pos); - entry[FM_TRAPDEST_COMM] = (*it).erase(0, pos + delimiter.length()); - getTrapDestList().push_back(entry); - } + std::vector::iterator it = trap_strings.begin(); + std::vector::iterator end = trap_strings.end(); + getTrapDestList().clear(); + for (; it != end; ++it){ + size_t pos = 0; + fm_db_single_result_t entry; + pos = (*it).find(delimiter); + entry[FM_TRAPDEST_IP] = (*it).substr(0, pos); + entry[FM_TRAPDEST_COMM] = (*it).erase(0, pos + delimiter.length()); + getTrapDestList().push_back(entry); + } } void set_trap_dest_list(std::string value){ - std::vector entries; - std::istringstream f(value); - std::string s; - while (getline(f, s, ',')) { - std::cout << s << std::endl; - FM_INFO_LOG("Add entry: (%s)", s.c_str()); - entries.push_back(s); - } - add_to_list(entries); - FM_INFO_LOG("Set trap entries: (%d)", getTrapDestList().size()); -} - -static std::string format_trap_cmd(int type, SFmAlarmDataT &data, - std::string &ip, std::string &comm){ - std::string cmd; - std::string objtype; - std::string mib; - std::string s = "\"\" "; - std::string env; - - if (get_trap_objtype(type) == WARM_START) - mib = SNMPv2_MIB; - else - mib = WRS_ALARM_MIB; - - objtype = mib + SCOPE + get_trap_objtype(type); - - cmd = TRAP_CMD + OPTION_COMM + comm + SEP + ip + SEP + s + objtype + SEP; - std::string operation_type =get_trap_objtype(type); - - if (operation_type == ALARM_CLEAR){ - cmd = add_str_val(cmd,ALARM_ID, data.alarm_id); - cmd = add_str_val(cmd, ALARM_INSTANCE_ID, data.entity_instance_id); - cmd = add_time_val(cmd, ALARM_DATE_TIME, data.timestamp); - cmd = add_str_val(cmd, ALARM_REASON_TEXT, data.reason_text); - } else if (operation_type == ALARM_HIERARCHICAL_CLEAR){ - cmd = add_str_val(cmd, ALARM_INSTANCE_ID, data.entity_instance_id); - cmd = add_time_val(cmd, ALARM_DATE_TIME, 0); - cmd = add_str_val(cmd, ALARM_REASON_TEXT, CLEAR_REASON_TEXT.c_str()); - } else if (operation_type == ALARM_MSG){ - cmd = add_str_val(cmd, EVENT_ID, data.alarm_id); - cmd = add_str_val(cmd, EVENT_INSTANCE_ID, data.entity_instance_id); - cmd = add_time_val(cmd, EVENT_DATE_TIME, data.timestamp); - cmd = add_int_val(cmd, EVENT_SEVERITY, data.severity); - cmd = add_str_val(cmd, EVENT_REASON_TEXT, data.reason_text); - cmd = add_int_val(cmd, EVENT_EVENT_TYPE, data.alarm_type); - cmd = add_int_val(cmd, EVENT_CAUSE, data.probable_cause); - cmd = add_int_val(cmd, EVENT_SERVICE_AFFECTING, data.service_affecting); - } else if (operation_type == WARM_START){ - // nothing to add to cmd - } else { - cmd = add_str_val(cmd, ALARM_ID, data.alarm_id); - cmd = add_str_val(cmd, ALARM_INSTANCE_ID, data.entity_instance_id); - cmd = add_time_val(cmd, ALARM_DATE_TIME, data.timestamp); - cmd = add_int_val(cmd, ALARM_SEVERITY, data.severity); - cmd = add_str_val(cmd, ALARM_REASON_TEXT, data.reason_text); - cmd = add_int_val(cmd, ALARM_EVENT_TYPE, data.alarm_type); - cmd = add_int_val(cmd, ALARM_CAUSE, data.probable_cause); - cmd = add_str_val(cmd, ALARM_REPAIR_ACTION, data.proposed_repair_action); - cmd = add_int_val(cmd, ALARM_SERVICE_AFFECTING, data.service_affecting); - cmd = add_int_val(cmd, ALARM_SUPPRESSION, data.suppression); - } - - return cmd; + std::vector entries; + std::istringstream f(value); + std::string s; + while (getline(f, s, ',')) { + std::cout << s << std::endl; + FM_INFO_LOG("Add entry: (%s)", s.c_str()); + entries.push_back(s); + } + add_to_list(entries); + FM_INFO_LOG("Set trap entries: (%d)", getTrapDestList().size()); } +/** + +*This method creates a JSON string representing a trap from the attributes +type and data. + +an example of a JSON string: + + { + "operation_type": "alarm_type_from_type_arg", + "alarm": { + ... + "obj_type1":"value1" + "obj_type2":"value2" + ... + } + } + +* Returns the JSON string created representing the trap. + +*/ +static std::string format_trap_json(int type, SFmAlarmDataT &data){ + + std::string operation_type = get_trap_objtype(type); + struct json_object *result = init_json_trap(operation_type); + std::string result_json; + std::string time_str; + + if(operation_type.empty() || result == NULL){ + return JSON_TRAP_EMPTY; + } + + if (operation_type == ALARM_CLEAR){ + add_value_json_trap(result, ALARM_ID, data.alarm_id); + add_value_json_trap(result, ALARM_INSTANCE_ID, + data.entity_instance_id); + fm_db_util_make_timestamp_string(time_str, data.timestamp, true); + add_value_json_trap(result, ALARM_DATE_TIME, time_str); + add_value_json_trap(result, ALARM_REASON_TEXT, data.reason_text); + } else if (operation_type == ALARM_HIERARCHICAL_CLEAR){ + add_value_json_trap(result, ALARM_INSTANCE_ID, + data.entity_instance_id); + fm_db_util_make_timestamp_string(time_str, 0, true); + add_value_json_trap(result, ALARM_DATE_TIME, time_str); + add_value_json_trap(result, ALARM_REASON_TEXT, CLEAR_REASON_TEXT); + } else if (operation_type == ALARM_MSG){ + add_value_json_trap(result, EVENT_ID, data.alarm_id); + add_value_json_trap(result, EVENT_INSTANCE_ID, + data.entity_instance_id); + fm_db_util_make_timestamp_string(time_str, data.timestamp, true); + add_value_json_trap(result, EVENT_DATE_TIME, time_str); + add_value_json_trap(result, EVENT_SEVERITY, + fm_db_util_int_to_string(data.severity)); + add_value_json_trap(result, EVENT_REASON_TEXT, data.reason_text); + add_value_json_trap(result, EVENT_EVENT_TYPE, + fm_db_util_int_to_string(data.alarm_type)); + add_value_json_trap(result, EVENT_CAUSE, + fm_db_util_int_to_string(data.probable_cause)); + add_value_json_trap(result, EVENT_SERVICE_AFFECTING, + fm_db_util_int_to_string(data.service_affecting)); + } else if (operation_type == WARM_START){ + // nothing to add to cmd + } else { + add_value_json_trap(result, ALARM_ID, data.alarm_id); + add_value_json_trap(result, ALARM_INSTANCE_ID, + data.entity_instance_id ); + fm_db_util_make_timestamp_string(time_str, data.timestamp, true); + add_value_json_trap(result, ALARM_DATE_TIME, time_str); + add_value_json_trap(result, ALARM_SEVERITY, + fm_db_util_int_to_string(data.severity)); + add_value_json_trap(result, ALARM_REASON_TEXT, data.reason_text); + add_value_json_trap(result, ALARM_EVENT_TYPE, + fm_db_util_int_to_string(data.alarm_type)); + add_value_json_trap(result, ALARM_CAUSE, + fm_db_util_int_to_string(data.probable_cause)); + add_value_json_trap(result, ALARM_REPAIR_ACTION, + data.proposed_repair_action); + add_value_json_trap(result, ALARM_SERVICE_AFFECTING, + fm_db_util_int_to_string(data.service_affecting)); + add_value_json_trap(result, ALARM_SUPPRESSION, + fm_db_util_int_to_string(data.suppression)); + } + result_json = std::string(json_object_to_json_string_ext(result, + JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY)); + int freed_json = json_object_put(result); + FM_DEBUG_LOG("JSON freed succesfully: %d", freed_json); + return result_json; +} + + +/** + +This method sends a JSON string representing the trap +to a trap server listening in a specific port. + +The server name and port are readed from fm.conf file. + +*/ bool fm_snmp_util_gen_trap(int type, SFmAlarmDataT &data) { - bool rc = true; - fm_buff_t cmdbuff; - fm_db_result_t res; - std::string cmd, eid; + bool send_json_success = false; + std::string eid = ""; + std::string trap_server_ip = ""; + std::string trap_server_port = ""; + std::string trap_server_snmp_enabled = ""; + std::string key_ip = FM_TRAP_SERVER_IP; + std::string key_port = FM_TRAP_SERVER_PORT; + std::string key_enabled = FM_TRAP_SNMP_ENABLED; + std::string json_trap = ""; - res = getTrapDestList(); + if (get_trap_objtype(type) != WARM_START) { + eid.assign(data.entity_instance_id); + std::string region_name = fm_db_util_get_region_name(); + std::string sys_name = fm_db_util_get_system_name(); + if (sys_name.length() != 0){ + eid = sys_name + "."+ eid; + } + if (region_name.length() != 0){ + eid = region_name + "."+ eid; + } + strncpy(data.entity_instance_id, eid.c_str(), + sizeof(data.entity_instance_id)-1); + } - if (get_trap_objtype(type) != WARM_START) { - eid.assign(data.entity_instance_id); - std::string region_name = fm_db_util_get_region_name(); - std::string sys_name = fm_db_util_get_system_name(); - if (sys_name.length() != 0){ - eid = sys_name + "."+ eid; - } - if (region_name.length() != 0){ - eid = region_name + "."+ eid; - } - strncpy(data.entity_instance_id, eid.c_str(), - sizeof(data.entity_instance_id)-1); - } + if (!fm_get_config_key(key_ip, trap_server_ip)) { + FM_ERROR_LOG("Fail to get config value for (%s)\n", key_ip.c_str()); + return false; + }; + if (!fm_get_config_key(key_port, trap_server_port)){ + FM_ERROR_LOG("Fail to get config value for (%s)\n", key_port.c_str()); + return false; + }; + if (!fm_get_config_key(key_enabled, trap_server_snmp_enabled)){ + FM_ERROR_LOG("Fail to get config value for (%s)\n", key_enabled.c_str()); + return false; + }; - fm_db_result_t::iterator it = res.begin(); - fm_db_result_t::iterator end = res.end(); + if (trap_server_snmp_enabled == "1"){ + json_trap = format_trap_json(type, data); - for (; it != end; ++it){ - memset(&(cmdbuff[0]), 0, cmdbuff.size()); - cmd.clear(); - std::string ip = (*it)[FM_TRAPDEST_IP]; - std::string comm = (*it)[FM_TRAPDEST_COMM]; - cmd = format_trap_cmd(type, data, ip, comm); + if(json_trap.empty()){ + FM_ERROR_LOG("ERROR creating SNMP trap with type: %d", type); + return false; + } - //FM_INFO_LOG("run cmd: %s\n", cmd.c_str()); - char *pline = &(cmdbuff[0]); - FILE *op = popen(cmd.c_str(),"r"); - if (op==NULL) { - FM_ERROR_LOG("popen() failed, errno: (%d) (%s)\n", - errno, strerror(errno)); - rc = false; - } - while (fgets(pline,cmdbuff.size(),op)!=NULL) { - FM_ERROR_LOG("Trap error message: (%s)\n", pline); - } - fclose(op); - } - return rc; + send_json_success = send_data(trap_server_ip.c_str(), + atoi(trap_server_port.c_str()), json_trap.c_str(), + json_trap.length()); + + if(send_json_success){ + FM_INFO_LOG("SNMP trap metadata sent succesfully %s %d", + json_trap.c_str(), json_trap.length()); + } else { + FM_ERROR_LOG("ERROR failed to send SNMP trap metadata %s %d", + json_trap.c_str(), json_trap.length()); + } + }else{ + FM_INFO_LOG("Fail to send SNMP trap metadata because snmp_trap_enabled" + " is not setted as 1, actual value: %s \n", + trap_server_snmp_enabled.c_str()); + return false; + } + return send_json_success; } static bool fm_snmp_get_db_connection(std::string &connection){ - const char *fn = "/etc/fm/fm.conf"; - std::string key = FM_SQL_CONNECTION; + const char *fn = "/etc/fm/fm.conf"; + std::string key = FM_SQL_CONNECTION; - fm_conf_set_file(fn); - return fm_get_config_key(key, connection); + fm_conf_set_file(fn); + return fm_get_config_key(key, connection); } extern "C" { bool fm_snmp_util_create_session(TFmAlarmSessionT *handle, const char* db_conn){ - std::string conn; - CFmDBSession *sess = new CFmDBSession; - if (sess==NULL) return false;; + std::string conn; + CFmDBSession *sess = new CFmDBSession; + if (sess==NULL) return false;; - if (db_conn == NULL){ - if (fm_snmp_get_db_connection(conn) != true){ - FM_ERROR_LOG("Fail to get db connection uri\n"); - delete sess; - return false; - } - db_conn = conn.c_str(); - } + if (db_conn == NULL){ + if (fm_snmp_get_db_connection(conn) != true){ + FM_ERROR_LOG("Fail to get db connection uri\n"); + delete sess; + return false; + } + db_conn = conn.c_str(); + } - if (sess->connect(db_conn) != true){ - FM_ERROR_LOG("Fail to connect to (%s)\n", db_conn); - delete sess; - return false; - } - *handle = sess; - return true; + if (sess->connect(db_conn) != true){ + FM_ERROR_LOG("Fail to connect to (%s)\n", db_conn); + delete sess; + return false; + } + *handle = sess; + return true; } void fm_snmp_util_destroy_session(TFmAlarmSessionT handle) { - CFmDBSession *sess = (CFmDBSession *)handle; + CFmDBSession *sess = (CFmDBSession *)handle; - if (sess != NULL){ - delete sess; - } + if (sess != NULL){ + delete sess; + } } -bool fm_snmp_util_get_all_alarms(TFmAlarmSessionT handle, - SFmAlarmQueryT *query) { +bool fm_snmp_util_get_all_alarms(TFmAlarmSessionT handle, SFmAlarmQueryT *query) { - assert(handle!=NULL); + assert(handle!=NULL); - CFmDbAlarmOperation op; - fm_db_result_t res; + CFmDbAlarmOperation op; + fm_db_result_t res; - CFmDBSession &sess = *((CFmDBSession*)handle); + CFmDBSession &sess = *((CFmDBSession*)handle); - if (!op.get_all_alarms(sess, &(query->alarm), &(query->num))) return false; + if (!op.get_all_alarms(sess, &(query->alarm), &(query->num))) return false; - return true; + return true; } -bool fm_snmp_util_get_all_event_logs(TFmAlarmSessionT handle, - SFmAlarmQueryT *query) { +bool fm_snmp_util_get_all_event_logs(TFmAlarmSessionT handle, SFmAlarmQueryT *query) { - assert(handle!=NULL); + assert(handle!=NULL); - CFmDbEventLogOperation op; - fm_db_result_t res; + CFmDbEventLogOperation op; + fm_db_result_t res; - CFmDBSession &sess = *((CFmDBSession*)handle); + CFmDBSession &sess = *((CFmDBSession*)handle); - if (!op.get_all_event_logs(sess, &(query->alarm), &(query->num))) return false; + if (!op.get_all_event_logs(sess, &(query->alarm), &(query->num))) return false; - return true; + return true; } } - diff --git a/test-requirements.txt b/test-requirements.txt index cbbb8bfc..2d6552d7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,4 +4,4 @@ mock PyYAML >= 3.1.0 yamllint >= 0.5.2 #spec_cleaner>=1.0.9 -bandit!=1.6.0,>=1.1.0,<2.0.0 +bandit>=1.1.0,<=1.6.2 diff --git a/tox.ini b/tox.ini index 32bf0038..e9a504dc 100644 --- a/tox.ini +++ b/tox.ini @@ -73,6 +73,8 @@ commands = pylint {posargs} --rcfile=./pylint.rc \ basepython = python3 description = Run style checks. +deps = + hacking commands = flake8 @@ -93,9 +95,19 @@ commands = # E123, E125 skipped as they are invalid PEP-8. # E501 skipped because some of the code files include templates # that end up quite wide + +# E402,module level import not at top of file +# W504,line break after binary operator +# W605,invalid escape sequence '\w' +# E117,over-indented +# F633,use of >> is invalid with print function +# F841,local variable 'e' is assigned to but never used +# E741,ambiguous variable name 'l' +# E117,over-indented +# F632,use ==/!= to compare constant literals (str, bytes, int, float, tuple) show-source = True ignore = H102,H104,H105,H301,H306,H401,H403,H404,H405,H702,H903, - W504,W605,E123,E125,E501 + W504,W605,E123,E125,E501,E402,W504,W605,E117,F633,F841,E741,E117,F632 exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-* # TODO: H106 Don’t put vim configuration in source files (off by default). # H203 Use assertIs(Not)None to check for None (off by default). From 3b341c6e5ef20d12bfe3044e5232b533bc42aecf Mon Sep 17 00:00:00 2001 From: Eric MacDonald Date: Mon, 16 Nov 2020 12:16:02 -0500 Subject: [PATCH 02/11] Add collectd memory plugin entity IDs to fm-doc This update adds the following collectd memory plugin instance based alarm entity IDs to fm-doc's events.yaml file. host=.memory=platform host=.memory=total host=.numa=node It also removes the obsoleted MINOR threshold level from the cpu, memory and filesystem alarm definitions. Change-Id: I259ba5c84ff90c3e1acd82fc7e72ba63a2fab50a Partial-Bug: 1903731 Depends-On: https://review.opendev.org/c/starlingx/monitoring/+/764388 Signed-off-by: Eric MacDonald --- fm-doc/fm_doc/events.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fm-doc/fm_doc/events.yaml b/fm-doc/fm_doc/events.yaml index 0cf01cc1..f1e6c62f 100755 --- a/fm-doc/fm_doc/events.yaml +++ b/fm-doc/fm_doc/events.yaml @@ -93,9 +93,8 @@ Platform CPU threshold exceeded; threshold x%, actual y% . CRITICAL @ 95% MAJOR @ 90% - MINOR @ 80% Entity_Instance_ID: host= - Severity: [critical, major, minor] + Severity: [critical, major] Proposed_Repair_Action: "Monitor and if condition persists, contact next level of support." Maintenance_Action: critical: degrade @@ -135,9 +134,15 @@ Memory threshold exceeded; threshold x%, actual y% . CRITICAL @ 90% MAJOR @ 80% - MINOR @ 70% - Entity_Instance_ID: host= - Severity: [critical, major, minor] + Entity_Instance_ID: |- + host= + OR + host=.memory=total + OR + host=.memory=platform + OR + host=.numa=node + Severity: [critical, major] Proposed_Repair_Action: "Monitor and if condition persists, contact next level of support; may require additional memory on Host." Maintenance_Action: critical: degrade @@ -157,7 +162,6 @@ File System threshold exceeded; threshold x%, actual y% . CRITICAL @ 90% MAJOR @ 80% - MINOR @ 70% OR host=.volumegroup= Monitor and if condition persists, consider adding additional physical volumes to the volume group. @@ -165,7 +169,7 @@ host=.filesystem= OR host=.volumegroup= - Severity: [critical, major, minor] + Severity: [critical, major] Proposed_Repair_Action: "Monitor and if condition persists, contact next level of support." Maintenance_Action: critical: degrade From dc14a2a3ad3ab7369127f186bdb0109629bc6360 Mon Sep 17 00:00:00 2001 From: pablo bovina Date: Mon, 14 Dec 2020 22:27:51 -0300 Subject: [PATCH 03/11] Update FM Manager old net-snmp related code Now a service outside of Fault is in charge of trap generation, this new service manages the SNMP configuration trap destinations, communities, users etc. For this reason the code that reads and stores the SNMP configuration from fm.conf is removed. Story: 2008132 Task: 41419 Depends-On: https://review.opendev.org/765381 Change-Id: If27f4f04f9dfc37e7404d593e3b337cbbb361552 Signed-off-by: Pablo Bovina --- fm-common/sources/fmConfig.cpp | 6 +---- fm-common/sources/fmSnmpConstants.h | 16 +------------- fm-common/sources/fmSnmpUtils.cpp | 34 ----------------------------- fm-common/sources/fmSnmpUtils.h | 4 +--- 4 files changed, 3 insertions(+), 57 deletions(-) diff --git a/fm-common/sources/fmConfig.cpp b/fm-common/sources/fmConfig.cpp index 32b19578..c7d7d764 100644 --- a/fm-common/sources/fmConfig.cpp +++ b/fm-common/sources/fmConfig.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Wind River Systems, Inc. +// Copyright (c) 2018-2020 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -15,7 +15,6 @@ #include "fmMutex.h" #include "fmConstants.h" #include "fmSnmpConstants.h" -#include "fmSnmpUtils.h" typedef std::map configParams; @@ -73,9 +72,6 @@ void fm_get_config_paramters() { key = trim(line.substr(0, pos)); value = trim(line.erase(0, pos + delimiter.length())); getConfigMap()[key] = value; - if (key.compare(FM_SNMP_TRAPDEST) == 0) { - set_trap_dest_list(value); - } if (key.compare(FM_SQL_CONNECTION) != 0) { // Don't log sql_connection, as it has a password if (key.compare(FM_CONF_PASSWORD) == 0 || key.compare(FM_CONF_CONNECTION) == 0) { diff --git a/fm-common/sources/fmSnmpConstants.h b/fm-common/sources/fmSnmpConstants.h index b6d38bb4..2b0ca83e 100644 --- a/fm-common/sources/fmSnmpConstants.h +++ b/fm-common/sources/fmSnmpConstants.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2017-2018 Wind River Systems, Inc. +// Copyright (c) 2017-2020 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -14,14 +14,6 @@ #define FM_CUSTOMER_LOG 10 -/* Trap Destination definitions */ - -#define FM_SNMP_TRAPDEST "trap_destinations" - -#define FM_TRAPDEST_IP "ip_address" - -#define FM_TRAPDEST_COMM "community" - /* MIB Trap definitions */ const std::string WRS_ALARM_MIB = "WRS-ALARM-MIB"; @@ -56,11 +48,5 @@ const std::string EVENT_SERVICE_AFFECTING = "wrsEventServiceAffecting"; const std::string SNMPv2_MIB = "SNMPv2-MIB"; const std::string WARM_START = "warmStart"; -const std::string TRAP_CMD = "/usr/bin/snmptrap -v 2c"; const std::string CLEAR_REASON_TEXT = "System initiated hierarchical alarm clear"; -const std::string SEP = " "; -const std::string SCOPE = "::"; -const std::string STR_TYPE = " s "; -const std::string INT_TYPE = " i "; -const std::string OPTION_COMM = " -c "; diff --git a/fm-common/sources/fmSnmpUtils.cpp b/fm-common/sources/fmSnmpUtils.cpp index 7e63963b..b74979b6 100644 --- a/fm-common/sources/fmSnmpUtils.cpp +++ b/fm-common/sources/fmSnmpUtils.cpp @@ -38,10 +38,6 @@ static int_to_objtype objtype_map; static pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -fm_db_result_t &getTrapDestList(){ - static fm_db_result_t trap_dest_list; - return trap_dest_list; -} static void add_to_table(int t, std::string objtype, int_to_objtype &tbl) { tbl[t]=objtype; @@ -175,36 +171,6 @@ static std::string get_trap_objtype(int type){ return objtype_map[type]; } -static void add_to_list(std::vector &trap_strings) { - std::string delimiter = " "; - - std::vector::iterator it = trap_strings.begin(); - std::vector::iterator end = trap_strings.end(); - getTrapDestList().clear(); - for (; it != end; ++it){ - size_t pos = 0; - fm_db_single_result_t entry; - pos = (*it).find(delimiter); - entry[FM_TRAPDEST_IP] = (*it).substr(0, pos); - entry[FM_TRAPDEST_COMM] = (*it).erase(0, pos + delimiter.length()); - getTrapDestList().push_back(entry); - } -} - -void set_trap_dest_list(std::string value){ - - std::vector entries; - std::istringstream f(value); - std::string s; - while (getline(f, s, ',')) { - std::cout << s << std::endl; - FM_INFO_LOG("Add entry: (%s)", s.c_str()); - entries.push_back(s); - } - add_to_list(entries); - FM_INFO_LOG("Set trap entries: (%d)", getTrapDestList().size()); -} - /** diff --git a/fm-common/sources/fmSnmpUtils.h b/fm-common/sources/fmSnmpUtils.h index 3e6856e9..2c62ad5a 100644 --- a/fm-common/sources/fmSnmpUtils.h +++ b/fm-common/sources/fmSnmpUtils.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2014 Wind River Systems, Inc. +// Copyright (c) 2014-2020 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -7,13 +7,11 @@ #ifndef __FM_SNMP_UTILS_H #define __FM_SNMP_UTILS_H -#include #include "fmAPI.h" #include "fmDb.h" bool fm_snmp_util_gen_trap(int type, SFmAlarmDataT &data); -void set_trap_dest_list(std::string value); #endif From 08130cd6252a1e44923bdc15ec060ef6d305322c Mon Sep 17 00:00:00 2001 From: albailey Date: Fri, 18 Dec 2020 07:45:40 -0600 Subject: [PATCH 04/11] Fix zuul jobs broken due to pip upversion python 2.7 zuul jobs such as py27 and pylint could fail when trying to import bandit using the new pip since bandit 1.7 was released Dec 12 and is python3 only. The cpp file header was only changed in this review to trigger the appropriate zuul jobs. Partial-Bug: #1907678 Change-Id: Idb1e97d16773d36027d29f4eb100d8b453a8069f Signed-off-by: albailey --- fm-common/sources/fmTime.cpp | 2 +- test-requirements.txt | 4 ++-- tox.ini | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fm-common/sources/fmTime.cpp b/fm-common/sources/fmTime.cpp index f6a2a588..fe3cc100 100644 --- a/fm-common/sources/fmTime.cpp +++ b/fm-common/sources/fmTime.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2014 Wind River Systems, Inc. +// Copyright (c) 2020 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // diff --git a/test-requirements.txt b/test-requirements.txt index 2d6552d7..7edf7389 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,5 +3,5 @@ bashate >= 0.2 mock PyYAML >= 3.1.0 yamllint >= 0.5.2 -#spec_cleaner>=1.0.9 -bandit>=1.1.0,<=1.6.2 +isort<5;python_version>="3.5" +bandit;python_version>="3.5" diff --git a/tox.ini b/tox.ini index e9a504dc..862ec5d1 100644 --- a/tox.ini +++ b/tox.ini @@ -51,7 +51,7 @@ commands = -print0 | xargs -0 yamllint -d '\{extends: relaxed, rules: \{line-length: \{max: 260\}\}\}'" [testenv:pylint] -basepython = python2.7 +basepython = python3 sitepackages = False deps = {[testenv]deps} @@ -109,7 +109,7 @@ show-source = True ignore = H102,H104,H105,H301,H306,H401,H403,H404,H405,H702,H903, W504,W605,E123,E125,E501,E402,W504,W605,E117,F633,F841,E741,E117,F632 exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-* -# TODO: H106 Don’t put vim configuration in source files (off by default). +# TODO: H106 Do not put vim configuration in source files (off by default). # H203 Use assertIs(Not)None to check for None (off by default). # TODO: H904 Delay string interpolations at logging calls (off by default). enable-extensions = H203 From b8bfdbebea568815fa1bf42a8d36e79732f104e0 Mon Sep 17 00:00:00 2001 From: Gonzalo Gallardo Date: Mon, 7 Dec 2020 12:14:48 -0500 Subject: [PATCH 05/11] Remove snmp-ext and snmp-audittrail from FM Remove the libraries libcgtsAgentPlugin and libsnmpAuditPlugin of Fault Management old net-snmp implementation within Starlingx, to delete the implementation of non-containerized SNMP. Story: 2008132 Task: 40866 Signed-off-by: Gonzalo Gallardo Depends-On: https://review.opendev.org/765381 Change-Id: I3aab46cbd45ae7be9e3f97b3acae0fe4536d1388 --- centos_iso_image.inc | 6 - centos_pkg_dirs | 3 +- snmp-audittrail/centos/build_srpm.data | 2 - snmp-audittrail/centos/snmp-audittrail.spec | 55 -- .../opensuse/snmp-audittrail.changes | 14 - .../opensuse/snmp-audittrail.rpmlintrc | 1 - snmp-audittrail/opensuse/snmp-audittrail.spec | 61 -- snmp-audittrail/sources/LICENSE | 202 ----- snmp-audittrail/sources/Makefile | 30 - snmp-audittrail/sources/snmpAuditPlugin.c | 422 --------- snmp-ext/centos/build_srpm.data | 2 - snmp-ext/centos/snmp-ext.spec | 60 -- snmp-ext/opensuse/snmp-ext.changes | 9 - snmp-ext/opensuse/snmp-ext.rpmlintrc | 1 - snmp-ext/opensuse/snmp-ext.spec | 67 -- snmp-ext/sources/LICENSE | 202 ----- snmp-ext/sources/Makefile | 40 - snmp-ext/sources/cgtsActiveAlarms.c | 266 ------ snmp-ext/sources/cgtsAgentPlugin.c | 164 ---- snmp-ext/sources/cgtsAgentPlugin.h | 69 -- snmp-ext/sources/cgtsEventLogs.c | 268 ------ snmp-ext/sources/mibs/wrsAlarmMib.mib.txt | 818 ------------------ .../sources/mibs/wrsEnterpriseReg.mib.txt | 132 --- 23 files changed, 1 insertion(+), 2893 deletions(-) delete mode 100644 snmp-audittrail/centos/build_srpm.data delete mode 100644 snmp-audittrail/centos/snmp-audittrail.spec delete mode 100644 snmp-audittrail/opensuse/snmp-audittrail.changes delete mode 100644 snmp-audittrail/opensuse/snmp-audittrail.rpmlintrc delete mode 100644 snmp-audittrail/opensuse/snmp-audittrail.spec delete mode 100644 snmp-audittrail/sources/LICENSE delete mode 100644 snmp-audittrail/sources/Makefile delete mode 100644 snmp-audittrail/sources/snmpAuditPlugin.c delete mode 100644 snmp-ext/centos/build_srpm.data delete mode 100644 snmp-ext/centos/snmp-ext.spec delete mode 100644 snmp-ext/opensuse/snmp-ext.changes delete mode 100644 snmp-ext/opensuse/snmp-ext.rpmlintrc delete mode 100644 snmp-ext/opensuse/snmp-ext.spec delete mode 100644 snmp-ext/sources/LICENSE delete mode 100644 snmp-ext/sources/Makefile delete mode 100644 snmp-ext/sources/cgtsActiveAlarms.c delete mode 100644 snmp-ext/sources/cgtsAgentPlugin.c delete mode 100644 snmp-ext/sources/cgtsAgentPlugin.h delete mode 100644 snmp-ext/sources/cgtsEventLogs.c delete mode 100644 snmp-ext/sources/mibs/wrsAlarmMib.mib.txt delete mode 100644 snmp-ext/sources/mibs/wrsEnterpriseReg.mib.txt diff --git a/centos_iso_image.inc b/centos_iso_image.inc index ada4c7ab..2991719e 100644 --- a/centos_iso_image.inc +++ b/centos_iso_image.inc @@ -14,12 +14,6 @@ fm-mgr # fm-doc fm-doc -# snmp-ext -snmp-ext - -# snmp-audittrail -snmp-audittrail - # fm-rest-api fm-rest-api diff --git a/centos_pkg_dirs b/centos_pkg_dirs index 6335d5e7..2068b991 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -4,5 +4,4 @@ fm-mgr fm-doc fm-rest-api python-fmclient -snmp-ext -snmp-audittrail + diff --git a/snmp-audittrail/centos/build_srpm.data b/snmp-audittrail/centos/build_srpm.data deleted file mode 100644 index 3107c380..00000000 --- a/snmp-audittrail/centos/build_srpm.data +++ /dev/null @@ -1,2 +0,0 @@ -SRC_DIR="sources" -TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/snmp-audittrail/centos/snmp-audittrail.spec b/snmp-audittrail/centos/snmp-audittrail.spec deleted file mode 100644 index fd4ede03..00000000 --- a/snmp-audittrail/centos/snmp-audittrail.spec +++ /dev/null @@ -1,55 +0,0 @@ -Summary: StarlingX SNMP Audit Trail -Name: snmp-audittrail -Version: 1.0 -Release: %{tis_patch_ver}%{?_tis_dist} -License: Apache-2.0 -Group: base -Packager: Wind River -URL: unknown -Source0: %{name}-%{version}.tar.gz -BuildRequires: net-snmp-devel -BuildRequires: fm-common-dev -BuildRequires: uuid-devel -BuildRequires: uuid -BuildRequires: libuuid-devel -Requires: net-snmp -Requires: uuid - -%description -StarlingX SNMP Audit Trail provides audit trail support for incoming -SNMP requests. - -%package -n snmp-audittrail-devel -Summary: StarlingX SNMP Audit Trail Package - Development files -Group: devel -Requires: snmp-audittrail = %{version}-%{release} - -%description -n snmp-audittrail-devel -StarlingX SNMP Audit Trail provides audit trail support for incoming SNMP requests. -This package contains symbolic links, header files, and related items necessary -for software development. - -%prep -%setup - -%build -VER=%{version} -MAJOR=`echo $VER | awk -F . '{print $1}'` -MINOR=`echo $VER | awk -F . '{print $2}'` -make MAJOR=$MAJOR MINOR=$MINOR PATCH=%{tis_patch_ver} %{?_smp_mflags} - -%install -rm -rf $RPM_BUILD_ROOT -VER=%{version} -MAJOR=`echo $VER | awk -F . '{print $1}'` -MINOR=`echo $VER | awk -F . '{print $2}'` -make install DESTDIR=$RPM_BUILD_ROOT LIB_DIR=%{_libdir} MAJOR=$MAJOR MINOR=$MINOR PATCH=%{tis_patch_ver} - -%files -%defattr(-,root,root,-) -%doc LICENSE -%{_libdir}/*.so.* - -%files -n snmp-audittrail-devel -%defattr(-,root,root,-) -%{_libdir}/*.so diff --git a/snmp-audittrail/opensuse/snmp-audittrail.changes b/snmp-audittrail/opensuse/snmp-audittrail.changes deleted file mode 100644 index 3ebfe4f3..00000000 --- a/snmp-audittrail/opensuse/snmp-audittrail.changes +++ /dev/null @@ -1,14 +0,0 @@ -------------------------------------------------------------------- -Thu Jun 13 20:56:01 UTC 2019 - sgw@linux.intel.com - -- convert from tarball to _service file - -------------------------------------------------------------------- -Mon Jun 10 23:21:36 UTC 2019 - sgw@linux.intel.com - -- spec-cleaner and rpmlint checked - -------------------------------------------------------------------- -Thu May 23 20:39:25 UTC 2019 - sgw@bigsur.com - -- Initial Commit diff --git a/snmp-audittrail/opensuse/snmp-audittrail.rpmlintrc b/snmp-audittrail/opensuse/snmp-audittrail.rpmlintrc deleted file mode 100644 index adc59bf3..00000000 --- a/snmp-audittrail/opensuse/snmp-audittrail.rpmlintrc +++ /dev/null @@ -1 +0,0 @@ -setBadness('script-without-shebang', 2) diff --git a/snmp-audittrail/opensuse/snmp-audittrail.spec b/snmp-audittrail/opensuse/snmp-audittrail.spec deleted file mode 100644 index 5df34cdb..00000000 --- a/snmp-audittrail/opensuse/snmp-audittrail.spec +++ /dev/null @@ -1,61 +0,0 @@ -Name: snmp-audittrail -Version: 1.0.0 -Release: %{tis_patch_ver}%{?_tis_dist} -Summary: StarlingX SNMP Audit Trail -License: Apache-2.0 -Group: Development/Tools/Other -URL: https://opendev.org/starlingx/fault -Source0: %{name}-%{version}.tar.gz -BuildRequires: fm-common-devel -BuildRequires: libuuid-devel -BuildRequires: net-snmp-devel -BuildRequires: uuid-devel -Requires: net-snmp -Requires: uuid -%if 0%{?suse_version} -BuildRequires: gcc-c++ -%endif - -%description -StarlingX SNMP Audit Trail provides audit trail support for incoming -SNMP requests. - -%package -n snmp-audittrail-devel -Summary: StarlingX SNMP Audit Trail Package - Development files -Group: Development/Tools/Other -Requires: snmp-audittrail = %{version}-%{release} - -%description -n snmp-audittrail-devel -StarlingX SNMP Audit Trail provides audit trail support for incoming SNMP requests. -This package contains symbolic links, header files, and related items necessary -for software development. - -%prep -%autosetup -n %{name}-%{version}/sources - -%build -VER=%{version} -MAJOR=`echo $VER | awk -F . '{print $1}'` -MINOR=`echo $VER | awk -F . '{print $2}'` -make MAJOR=$MAJOR MINOR=$MINOR PATCH=%{tis_patch_ver} %{?_smp_mflags} - -%install -VER=%{version} -MAJOR=`echo $VER | awk -F . '{print $1}'` -MINOR=`echo $VER | awk -F . '{print $2}'` -make install DESTDIR=%{buildroot} LIB_DIR=%{_libdir} MAJOR=$MAJOR MINOR=$MINOR PATCH=%{tis_patch_ver} - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root,-) -%license LICENSE -%{_libdir}/*.so.* - -%files -n snmp-audittrail-devel -%defattr(-,root,root,-) -%{_libdir}/*.so - -%changelog diff --git a/snmp-audittrail/sources/LICENSE b/snmp-audittrail/sources/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/snmp-audittrail/sources/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/snmp-audittrail/sources/Makefile b/snmp-audittrail/sources/Makefile deleted file mode 100644 index 6f7469c6..00000000 --- a/snmp-audittrail/sources/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -SRCS = snmpAuditPlugin.c - -OBJS = $(SRCS:.c=.o) -LDLIBS = -lfmcommon -lnetsnmp -lnetsnmpagent -luuid -INCLUDES += -I./ -CCFLAGS = -fPIC -g -O2 -Wall -Werror -Wformat -Wformat-security -LIBCGTSAGENT_SO := libsnmpAuditPlugin.so -MAJOR ?= 1 -MINOR ?= 0 -PATCH ?= 0 -DESTDIR ?= /usr/lib64 - -build: lib - -.c.o: - $(CXX) $(CCFLAGS) $(INCLUDES) -c $< -o $@ - -lib: $(OBJS) - $(CXX) $(OBJS) $(LDLIBS) -o $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) -shared - ln -sf $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(LIBCGTSAGENT_SO).$(MAJOR) - ln -sf $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(LIBCGTSAGENT_SO) - -clean: - @rm -f $(OBJ) *.o *.so.* - -install: - install -m 755 -d $(DESTDIR)$(LIB_DIR) - install -m 755 $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DESTDIR)$(LIB_DIR) - ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DESTDIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO).$(MAJOR) - ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DESTDIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO) diff --git a/snmp-audittrail/sources/snmpAuditPlugin.c b/snmp-audittrail/sources/snmpAuditPlugin.c deleted file mode 100644 index 46d5fd9d..00000000 --- a/snmp-audittrail/sources/snmpAuditPlugin.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright (c) 2017 Wind River Systems, Inc. -* -* SPDX-License-Identifier: Apache-2.0 -* - */ - - - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define LOG_BUF_STR (256) - -#define AUDIT_TAG "snmp-auditor" - -/* Used to keep track of the first handler call for a transaction */ -typedef struct s_audit_req_t { - long transid; - long reqid; -} audit_req_t; - -typedef struct s_enum_to_string_t { - const int enumval; - const char *str; -} enum_to_string_t; - - -/* Logs IP session information, in the format: "remote IP:port ==> local IP:port" */ -static inline char* fmtaddr(const char *prefix, int af, - void *remote_addr, unsigned short remote_port, - char*buf, size_t buflen) -{ - char remote_addr_str[LOG_BUF_STR+1]; - - if (NULL == inet_ntop(af, remote_addr, remote_addr_str, sizeof(remote_addr_str))) { - strncpy(remote_addr_str, "UNKNOWN", LOG_BUF_STR+1); - } - remote_addr_str[LOG_BUF_STR] = 0; - - snprintf(buf, buflen, "transport:%s remote:%s", prefix, remote_addr_str); - return buf; -} - - -#ifdef NETSNMP_ENABLE_IPV6 -static char* ipv6_fmtaddr(const char *prefix, netsnmp_addr_pair *addr_pair, char*buf, size_t buflen) -{ - return fmtaddr(prefix, AF_INET6, - (void *)&addr_pair->remote_addr.sin6.sin6_addr, addr_pair->remote_addr.sin6.sin6_port, - buf, buflen); -} -#endif - - -static char* ipv4_fmtaddr(const char *prefix, netsnmp_addr_pair *addr_pair, char*buf, size_t buflen) -{ - return fmtaddr(prefix, AF_INET, - (void *)&addr_pair->remote_addr.sin.sin_addr, addr_pair->remote_addr.sin.sin_port, - buf, buflen); -} - - -/* Logs IP session information */ -static char* log_session_addresses(const oid* tDomain, netsnmp_addr_pair *addr_pair, char*buf, size_t buflen) -{ - if (tDomain == netsnmpUDPDomain) { - return ipv4_fmtaddr("udp", addr_pair, buf, buflen); - } - - if (tDomain == netsnmp_snmpTCPDomain) { - return ipv4_fmtaddr("tcp", addr_pair, buf, buflen); - } - -#ifdef NETSNMP_ENABLE_IPV6 - if (tDomain == netsnmp_UDPIPv6Domain) { - return ipv6_fmtaddr("udpv6", addr_pair, buf, buflen); - } - - if (tDomain == netsnmp_TCPIPv6Domain) { - return ipv6_fmtaddr("tcpv6", addr_pair, buf, buflen); - } -#endif - strncpy(buf, "IP FMT ERROR", buflen); - buf[buflen-1] = 0; - return buf; -} - - -/* SNMP OID formatting (a wrapper around the 'standard' function */ -static inline char* fmtoid(const oid * theoid, size_t len, int* no_overflow) -{ - u_char *buf = NULL; - size_t buf_len = 0; - size_t out_len = 0; - - *no_overflow = sprint_realloc_objid(&buf, &buf_len, &out_len, 1, theoid, len); - if (NULL == buf) { - *no_overflow = 0; - } - - return (char*)buf; -} - - -/* SNMP var bind formatting (a convenience function) - formats the OID (variable name) - This function is always called with var != NULL */ -static inline char* fmtmsg_var(netsnmp_variable_list * var, int* no_overflow) -{ - return fmtoid(var->name, var->name_length, no_overflow); -} - -static const char* get_version(long version) -{ - switch (version) { - case 0: return "v1"; - case 1: return "v2c"; - case 2: return "v3"; - } - return "error"; -} - - -static const char *get_str_from_enum(int enumval, const enum_to_string_t* table, const char* defval) -{ - const enum_to_string_t* ptr = table; - - for ( ; ptr->str != NULL; ++ptr) { - if (ptr->enumval == enumval) { - return ptr->str; - } - } - if (NULL == defval) { - return "unknown"; - } - return defval; -} - - -static const char *get_auth_error(int errorcode) -{ - static enum_to_string_t errorcodes_str[] = { - { VACM_SUCCESS, "Success", }, - { VACM_NOSECNAME, "InvalidCommunityName" }, - { VACM_NOGROUP, "NoGroup" }, - { VACM_NOACCESS, "NoAccess" }, - { VACM_NOVIEW, "NoViewAccess" }, - { VACM_NOTINVIEW, "NotInView" }, - { VACM_NOSUCHCONTEXT, "NoSuchContext" }, - { VACM_SUBTREE_UNKNOWN,"SubtreeUnknown" }, - {0, NULL} - }; - return get_str_from_enum(errorcode, errorcodes_str, "unknown err"); -} - -static const char *get_result_error(int errorcode) -{ - static enum_to_string_t errorcodes_str[] = { - { 0, "pass" }, - { SNMP_NOSUCHOBJECT, "NoSuchObject" }, - { SNMP_NOSUCHINSTANCE, "NoSuchInstance" }, - { SNMP_ENDOFMIBVIEW, "EndOfMIBView" }, - {0, NULL} - }; - return get_str_from_enum(errorcode, errorcodes_str, "pass"); -} - - -/* Logs all var-binds in PDU (only variable names, aka OID's) */ -static void log_var_list(netsnmp_pdu *pdu) -{ - netsnmp_variable_list * var; - - for (var = pdu->variables; var != NULL; var = var->next_variable) { - int no_overflow_var = 0; - char* var_str = fmtmsg_var(var, &no_overflow_var); - - snmp_log(LOG_INFO, AUDIT_TAG" reqid:%ld oid:%s%s\n", - pdu->reqid, - (var_str != NULL) ? var_str : "INVALID", - (no_overflow_var) ? "" : " [TRUNCATED]"); - free(var_str); - } -} - -/* Logs the 'header' of a PDU/request (IP addresses, reqid, msg type, version) */ -static void log_pdu_header(netsnmp_pdu *pdu, const char *status) -{ - char buf[LOG_BUF_STR]; - netsnmp_addr_pair *addr_pair = (netsnmp_addr_pair *)pdu->transport_data; - - snmp_log(LOG_INFO, AUDIT_TAG" %s reqid:%ld msg-type:%s version:%s%s\n", - log_session_addresses(pdu->tDomain, addr_pair, buf, sizeof(buf)), - pdu->reqid, snmp_pdu_type(pdu->command), get_version(pdu->version), status); -} - -/* Logs the results of a request, namely results obtained from actual processing handlers */ -static void log_results(long reqid, netsnmp_request_info *requests) -{ - netsnmp_request_info *req; - - for (req = requests; req != NULL; req = req->next) { - netsnmp_variable_list *var = req->requestvb; - - if (NULL == var) { - continue; - } - if (var->type != ASN_NULL) { /* NULL means no result, so skip */ - int no_overflow_var = 0; - char* var_str = fmtmsg_var(var, &no_overflow_var); - - /* Print only first variable: this is the request that we get a result for */ - snmp_log(LOG_INFO, AUDIT_TAG" reqid:%ld oid:%s%s status:%s\n", reqid, - (var_str != NULL) ? var_str : "INVALID", - (no_overflow_var) ? "" : " [TRUNCATED]", get_result_error(var->type)); - free(var_str); - } - } -} - - -static void log_invalid_oid_trees(netsnmp_pdu *pdu) -{ - char buf[LOG_BUF_STR]; - netsnmp_variable_list *var; - netsnmp_addr_pair *addr_pair = (netsnmp_addr_pair *)pdu->transport_data; - int first_time = 1; - - for (var = pdu->variables; var != NULL; var = var->next_variable) { - netsnmp_subtree *tp = netsnmp_subtree_find(var->name, var->name_length, - NULL, pdu->contextName); - if (tp != NULL) { - int prefix_len = netsnmp_oid_find_prefix(tp->start_a, - tp->start_len, - tp->end_a, tp->end_len); - while (prefix_len < 1) { - tp = tp->next; - if (NULL == tp) { - break; - } - prefix_len = netsnmp_oid_find_prefix(tp->start_a, - tp->start_len, - tp->end_a, tp->end_len); - } - DEBUGMSGTL(("helper:snmpAudit", "var=%p tp=%p prefix_len=%d\n", var, tp, prefix_len )); - } - else { - DEBUGMSGTL(("helper:snmpAudit", "tp NOT found var=%p\n", var)); - } - if (NULL == tp) { - int no_overflow_var = 0; - char* var_str = fmtmsg_var(var, &no_overflow_var); - - if (first_time) { - first_time = 0; - snmp_log(LOG_INFO, AUDIT_TAG" %s reqid:%ld msg-type:%s version:%s\n", - log_session_addresses(pdu->tDomain, addr_pair, buf, sizeof(buf)), pdu->reqid, - snmp_pdu_type(pdu->command), - get_version(pdu->version)); - log_var_list(pdu); - } - - snmp_log(LOG_INFO, AUDIT_TAG" reqid:%ld oid:%s%s status:%s\n", - pdu->reqid, - (var_str != NULL) ? var_str : "INVALID", - (no_overflow_var) ? "" : " [TRUNCATED]", - get_result_error(SNMP_ENDOFMIBVIEW)); - free(var_str); - } - } -} - -/* - * Register with 'SNMPD_CALLBACK_ACM_CHECK_INITIAL == minorId' - * This function is used to log authorization errors and invalid OID's errors, - * for GET BULK and GET NEXT requests - */ -static int audit_callback_acm_check_initial(int majorID, int minorID, void *serverarg, - void *clientarg) -{ - struct view_parameters *view_parms = - (struct view_parameters *) serverarg; - netsnmp_pdu *pdu = view_parms->pdu; - - DEBUGMSGTL(("helper:snmpAudit", "%s msg-type: %s errcode=%d minorID=%d\n", - __FUNCTION__, snmp_pdu_type(pdu->command), view_parms->errorcode, minorID)); - - if (view_parms->errorcode != VACM_SUCCESS) { - /* Log Authentication errors */ - char buf[LOG_BUF_STR]; - netsnmp_addr_pair *addr_pair = (netsnmp_addr_pair *)pdu->transport_data; - - snmp_log(LOG_INFO, AUDIT_TAG" %s reqid:%ld msg-type:%s version:%s status:%s\n", - log_session_addresses(pdu->tDomain, addr_pair, buf, sizeof(buf)), pdu->reqid, - snmp_pdu_type(pdu->command), get_version(pdu->version), - get_auth_error(view_parms->errorcode)); - log_var_list(pdu); - return 0; - } - - if (SNMP_MSG_GETBULK == pdu->command || - SNMP_MSG_GETNEXT == pdu->command) { - /* Log possible invalid OID subtrees for GETNEXT and GETBULK request - * (e.g. "1.10" - outside the normal ISO MIB subtree) - */ - log_invalid_oid_trees(pdu); - } - return 0; -} - -/* - * Register with 'SNMPD_CALLBACK_ACM_CHECK == minorId' - * This function is used to log SET requests (which are normally rejected) - */ -static int audit_callback_acm_check(int majorID, int minorID, void *serverarg, - void *clientarg) -{ - struct view_parameters *view_parms = - (struct view_parameters *) serverarg; - netsnmp_pdu *pdu = view_parms->pdu; - - DEBUGMSGTL(("helper:snmpAudit", "%s msg-type: %s errcode=%d minorID=%d\n", - __FUNCTION__, snmp_pdu_type(pdu->command), view_parms->errorcode, minorID)); - if (SNMP_MSG_SET == pdu->command) { - char status_buf[LOG_BUF_STR]; - snprintf(status_buf, LOG_BUF_STR, - " status:%s", get_auth_error(view_parms->errorcode)); - log_pdu_header(pdu, status_buf); - log_var_list(pdu); - } - return 0; -} - - -/* Main log handler function: logs 'normal' requests: - * everything except SET operations, authentication errors and GETBULK/GETNEXT for invalid OIDs */ -static int audit_log_handler(netsnmp_mib_handler *handler, - netsnmp_handler_registration *reginfo, - netsnmp_agent_request_info *reqinfo, - netsnmp_request_info *requests) -{ - static audit_req_t req = { - .transid = 0, - .reqid = 0 - }; - netsnmp_pdu *orig_pdu = reqinfo->asp->orig_pdu; - int ret; - - /* Note. Assumes single-threaded processing. */ - if ((req.transid != orig_pdu->transid) && - (req.reqid != orig_pdu->reqid)) { - - /* New transaction */ - req.transid = orig_pdu->transid; - req.reqid = orig_pdu->reqid; - - /* Logs session information (e.g. IP addresses, version...) */ - log_pdu_header(orig_pdu, ""); - /* Logs the variables names in the request */ - log_var_list(orig_pdu); - } - /* Calls the next handlers, to obtain processing results */ - ret = netsnmp_call_next_handler(handler, reginfo, reqinfo, requests); - /* Logs the variables names in the results - * resulted from the calls to 'netsnmp_call_next_handler' above - * which invokes all other handlers in the chain. - */ - log_results(orig_pdu->reqid, requests); - return ret; -} - - - -/* - * Initialization routine, automatically called by the agent - * (to get called, the function name must match init_FILENAME()) - */ -extern "C" void init_snmpAuditPlugin(void) { - - netsnmp_mib_handler *audit_handler = NULL; - - snmp_log(LOG_INFO, "init_snmpAuditPlugin\n"); - audit_handler = netsnmp_create_handler("snmpAudit", - audit_log_handler); - if (audit_handler != NULL) { - netsnmp_register_handler_by_name("snmpAudit", audit_handler); - } - - netsnmp_register_callback(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_ACM_CHECK, - audit_callback_acm_check, - NULL, NETSNMP_CALLBACK_LOWEST_PRIORITY ); - netsnmp_register_callback(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_ACM_CHECK_INITIAL, - audit_callback_acm_check_initial, - NULL, NETSNMP_CALLBACK_LOWEST_PRIORITY); -} - -extern "C" void deinit_snmpAuditPlugin(void) -{ - snmp_log(LOG_INFO, "deinit_snmpAuditPlugin\n"); - snmp_unregister_callback(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_ACM_CHECK, - audit_callback_acm_check, NULL, 1); - snmp_unregister_callback(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_ACM_CHECK_INITIAL, - audit_callback_acm_check_initial, NULL, 1); -} diff --git a/snmp-ext/centos/build_srpm.data b/snmp-ext/centos/build_srpm.data deleted file mode 100644 index 3107c380..00000000 --- a/snmp-ext/centos/build_srpm.data +++ /dev/null @@ -1,2 +0,0 @@ -SRC_DIR="sources" -TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/snmp-ext/centos/snmp-ext.spec b/snmp-ext/centos/snmp-ext.spec deleted file mode 100644 index 5cdc0abe..00000000 --- a/snmp-ext/centos/snmp-ext.spec +++ /dev/null @@ -1,60 +0,0 @@ -Summary: CGTS Platform SNMP extension Package -Name: snmp-ext -Version: 1.0 -Release: %{tis_patch_ver}%{?_tis_dist} -License: Apache-2.0 -Group: base -Packager: Wind River -URL: unknown -Source0: %{name}-%{version}.tar.gz -BuildRequires: fm-common-dev -BuildRequires: net-snmp-devel -BuildRequires: libuuid-devel -Requires: fm-common -Requires: net-snmp - -%define mib_ver 2.0 - -%description -StarlingX platform SNMP extension provides Wind River enterprise MIBs support -and it serves as SNMP based alarm surveillance module for Network Manager -System. - -%package -n snmp-ext-devel -Summary: StarlingX Platform SNMP extension Package - Development files -Group: devel -Requires: snmp-ext = %{version}-%{release} - -%description -n snmp-ext-devel -StarlingX platform SNMP extension provides Wind River enterprise MIBs support -and it serves as SNMP based alarm surveillance module for Network Manager -System. This package contains symbolic links, header files, and related -items necessary for software development. - -%prep -%setup - -%build -MAJOR=`echo %{version} | awk -F . '{print $1}'` -MINOR=`echo %{version} | awk -F . '{print $2}'` -make MAJOR=$MAJOR MINOR=$MINOR PATCH=%{tis_patch_ver} %{?_smp_mflags} - -%install -MAJOR=`echo %{version} | awk -F . '{print $1}'` -MINOR=`echo %{version} | awk -F . '{print $2}'` -make DEST_DIR=%{buildroot} \ - LIB_DIR=%{_libdir} \ - MAJOR=$MAJOR \ - MINOR=$MINOR \ - MIBVER=%{mib_ver} \ - PATCH=%{tis_patch_ver} install - -%files -%defattr(-,root,root,-) -%doc LICENSE -%{_libdir}/*.so.* -%{_datadir}/snmp/mibs/* - -%files -n snmp-ext-devel -%defattr(-,root,root,-) -%{_libdir}/*.so diff --git a/snmp-ext/opensuse/snmp-ext.changes b/snmp-ext/opensuse/snmp-ext.changes deleted file mode 100644 index 2bb92135..00000000 --- a/snmp-ext/opensuse/snmp-ext.changes +++ /dev/null @@ -1,9 +0,0 @@ -------------------------------------------------------------------- -Mon Jun 10 23:47:39 UTC 2019 - sgw@linux.intel.com - -- spec-cleaner and rpmlint checked - -------------------------------------------------------------------- -Thu May 23 21:03:10 UTC 2019 - sgw@bigsur.com - -- Initial Commit diff --git a/snmp-ext/opensuse/snmp-ext.rpmlintrc b/snmp-ext/opensuse/snmp-ext.rpmlintrc deleted file mode 100644 index adc59bf3..00000000 --- a/snmp-ext/opensuse/snmp-ext.rpmlintrc +++ /dev/null @@ -1 +0,0 @@ -setBadness('script-without-shebang', 2) diff --git a/snmp-ext/opensuse/snmp-ext.spec b/snmp-ext/opensuse/snmp-ext.spec deleted file mode 100644 index 8bc1b7e5..00000000 --- a/snmp-ext/opensuse/snmp-ext.spec +++ /dev/null @@ -1,67 +0,0 @@ -%define mib_ver 2.0 -Name: snmp-ext -Version: 1.0.0 -Release: %{tis_patch_ver}%{?_tis_dist} -Summary: StarlingX Platform SNMP extension Package -License: Apache-2.0 -Group: Development/Tools/Other -URL: https://opendev.org/starlingx/fault -Source0: %{name}-%{version}.tar.gz -BuildRequires: fm-common-devel -BuildRequires: libuuid-devel -BuildRequires: net-snmp-devel -Requires: fm-common -Requires: net-snmp -%if 0%{?suse_version} -BuildRequires: gcc-c++ -%endif - -%description -StarlingX Cloud platform SNMP extension provides Wind River enterprise MIBs support -and it serves as SNMP based alarm surveillance module for Network Manager -System. - -%package -n snmp-ext-devel -Summary: StarlingX Cloud Platform SNMP extension Package - Development files -Group: Development/Tools/Other -Requires: snmp-ext = %{version}-%{release} - -%description -n snmp-ext-devel -StarlingX Cloud platform SNMP extension provides Wind River enterprise MIBs support -and it serves as SNMP based alarm surveillance module for Network Manager -System. This package contains symbolic links, header files, and related -items necessary for software development. - -%prep -%autosetup -n %{name}-%{version}/sources - -%build -MAJOR=`echo %{version} | awk -F . '{print $1}'` -MINOR=`echo %{version} | awk -F . '{print $2}'` -make MAJOR=$MAJOR MINOR=$MINOR PATCH=%{tis_patch_ver} %{?_smp_mflags} - -%install -MAJOR=`echo %{version} | awk -F . '{print $1}'` -MINOR=`echo %{version} | awk -F . '{print $2}'` -make DEST_DIR=%{buildroot} \ - LIB_DIR=%{_libdir} \ - MAJOR=$MAJOR \ - MINOR=$MINOR \ - MIBVER=%{mib_ver} \ - PATCH=%{tis_patch_ver} install - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root,-) -%license LICENSE -%{_libdir}/*.so.* -%{_datadir}/snmp/mibs/* - -%files -n snmp-ext-devel -%defattr(-,root,root,-) -%{_libdir}/*.so - -%changelog diff --git a/snmp-ext/sources/LICENSE b/snmp-ext/sources/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/snmp-ext/sources/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/snmp-ext/sources/Makefile b/snmp-ext/sources/Makefile deleted file mode 100644 index 408ea342..00000000 --- a/snmp-ext/sources/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# -# SPDX-License-Identifier: Apache-2.0 -# - -MAJOR ?= 1 -MINOR ?= 0 -PATCH ?= 0 -MIBVER ?= 2.0 - -DEST_DIR ?= / -DATA_DIR ?= /usr/share -LIB_DIR ?= /usr/lib64 - -SRCS = cgtsActiveAlarms.c cgtsAgentPlugin.c cgtsEventLogs.c - -OBJS = $(SRCS:.c=.o) -LDLIBS = -lfmcommon -lnetsnmp -lnetsnmpagent -luuid -INCLUDES += -I./ -CCFLAGS = -fPIC -g -O2 -Wall -Werror -Wformat -Wformat-security -LIBCGTSAGENT_SO := libcgtsAgentPlugin.so - -.c.o: - $(CXX) $(CCFLAGS) $(INCLUDES) -c $< -o $@ - -lib: $(OBJS) - $(CXX) $(OBJS) $(LDLIBS) -o $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) -shared - ln -sf $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(LIBCGTSAGENT_SO).$(MAJOR) - ln -sf $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(LIBCGTSAGENT_SO) - -clean: - @rm -f $(OBJ) *.o *.so.* *.tgz - -install: - install -m 755 -d $(DEST_DIR)$(LIB_DIR) - install -m 755 $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR) - install -m 755 -d $(DEST_DIR)$(DATA_DIR)/snmp/mibs - install -m 644 mibs/wrsAlarmMib.mib.txt $(DEST_DIR)$(DATA_DIR)/snmp/mibs/ - install -m 644 mibs/wrsEnterpriseReg.mib.txt $(DEST_DIR)$(DATA_DIR)/snmp/mibs/ - ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO).$(MAJOR) - ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO) diff --git a/snmp-ext/sources/cgtsActiveAlarms.c b/snmp-ext/sources/cgtsActiveAlarms.c deleted file mode 100644 index e1abc688..00000000 --- a/snmp-ext/sources/cgtsActiveAlarms.c +++ /dev/null @@ -1,266 +0,0 @@ -/* -* Copyright (c) 2013-2014 Wind River Systems, Inc. -* -* SPDX-License-Identifier: Apache-2.0 -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cgtsAgentPlugin.h" - - -netsnmp_feature_require(date_n_time) - -#define MINLOADFREQ 1 /* min reload frequency in seconds */ - -static long Active_Alarm_Count = 0; -static struct activealarm *alarm_list; -static struct activealarm *alarmaddr, savealarm, *savealarmaddr; -static int saveIndex = 0; -static char saveUuid[36]; -static long LastLoad = 0; /* ET in secs at last table load */ -extern long long_return; - - -int Active_Alarm_Get_Count(void); - -static void -Alarm_Scan_Init() -{ - struct timeval et; /* elapsed time */ - struct activealarm **activealarm_ptr; - SFmAlarmQueryT aquery; - size_t i = 0; - - saveIndex = 0; - netsnmp_get_monotonic_clock(&et); - if ( et.tv_sec < LastLoad + MINLOADFREQ ) { - DEBUGMSG(("cgtsAgentPlugin", "Skip reload" )); - alarmaddr = alarm_list; - return; - } - LastLoad = et.tv_sec; - - /* - * free old list: - */ - while (alarm_list) { - struct activealarm *old = alarm_list; - alarm_list = alarm_list->next; - free(old); - } - alarmaddr = 0; - activealarm_ptr = &alarm_list; - - /* - * query active alarm list from DB - */ - if (fm_snmp_util_get_all_alarms(getAlarmSession(), &aquery) != true){ - DEBUGMSG(("cgtsAgentPlugin", "get_all_alarms from db failed\n")); - return; - } - DEBUGMSG(("cgtsAgentPlugin", "get_all_alarms returns %lu alarms\n", aquery.num)); - for (i = 0; i < aquery.num; ++i){ - struct activealarm *almnew; - /*populate alarm_list*/ - almnew = (struct activealarm *) calloc(1, sizeof(struct activealarm)); - if (almnew == NULL) - break; /* alloc error */ - *activealarm_ptr = almnew; - activealarm_ptr = &almnew->next; - memset(&almnew->alarmdata, 0 , sizeof(almnew->alarmdata)); - memcpy(&almnew->alarmdata, aquery.alarm + i, sizeof(almnew->alarmdata)); - } - alarmaddr = alarm_list; - free(aquery.alarm); -} - -static int -Alarm_Scan_NextAlarm(int *Index, - char *Name, - struct activealarm *Aalm) -{ - struct activealarm alm; - while (alarmaddr) { - alm = *alarmaddr; - strlcpy(saveUuid, alm.alarmdata.uuid, sizeof(saveUuid)); - if (Index) - *Index = ++saveIndex; - if (Aalm) - *Aalm = alm; - if (Name) - strcpy(Name, saveUuid); - - savealarm = alm; - savealarmaddr = alarmaddr; - alarmaddr = alm.next; - return 1; - } - return 0; -} - -static int -Alarm_Scan_By_Index(int Index, - char *Name, - struct activealarm *Aalm) -{ - int i; - - DEBUGMSGTL(("cgtsAgentPlugin","Alarm_Scan_By_Index")); - Alarm_Scan_Init(); - while (Alarm_Scan_NextAlarm(&i, Name, Aalm)) { - if (i == Index) - break; - } - if (i != Index) - return (-1); /* Error, doesn't exist */ - return (0); /* DONE */ -} - -static int -header_alarmEntry(struct variable *vp, - oid * name, - size_t * length, - int exact, size_t * var_len, - WriteMethod ** write_method) -{ -#define ALM_ENTRY_NAME_LENGTH 14 - oid newname[MAX_OID_LEN]; - register int index; - int result, count; - - DEBUGMSGTL(("cgtsAgentPlugin", "header_alarmEntry: ")); - DEBUGMSGOID(("cgtsAgentPlugin", name, *length)); - DEBUGMSG(("cgtsAgentPlugin", "exact %d\n", exact)); - - memcpy((char *) newname, (char *) vp->name, - (int) vp->namelen * sizeof(oid)); - /* - * find "next" alarm - */ - count = Active_Alarm_Get_Count(); - DEBUGMSG(("cgtsAgentPlugin", "count %d\n", count)); - for (index = 1; index <= count; index++) { - newname[ALM_ENTRY_NAME_LENGTH] = (oid) index; - result = - snmp_oid_compare(name, *length, newname, - (int) vp->namelen + 1); - if ((exact && (result == 0)) || (!exact && (result < 0))) - break; - } - if (index > count) { - DEBUGMSGTL(("cgtsAgentPlugin", "... index out of range\n")); - return MATCH_FAILED; - } - - memcpy((char *) name, (char *) newname, - ((int) vp->namelen + 1) * sizeof(oid)); - *length = vp->namelen + 1; - *write_method = 0; - *var_len = sizeof(long); /* default to 'long' results */ - - DEBUGMSGTL(("cgtsAgentPlugin", "... get ALM data ")); - DEBUGMSGOID(("cgtsAgentPlugin", name, *length)); - DEBUGMSG(("cgtsAgentPlugin", "\n")); - - DEBUGMSG(("cgtsAgentPlugin","Return index: %d\n", index)); - return index; -} - - -int -Active_Alarm_Get_Count(void) -{ - static time_t scan_time = 0; - time_t time_now = time(NULL); - - if (!Active_Alarm_Count || (time_now > scan_time + 60)) { - scan_time = time_now; - Alarm_Scan_Init(); - Active_Alarm_Count = 0; - while (Alarm_Scan_NextAlarm(NULL, NULL, NULL) != 0) { - Active_Alarm_Count++; - } - } - return (Active_Alarm_Count); -} - -u_char * -var_alarms(struct variable *vp, - oid * name, - size_t * length, - int exact, size_t * var_len, - WriteMethod ** write_method) -{ - static struct activealarm alrm; - static char Name[36]; - char *cp; - int index = 0; - - DEBUGMSGTL(("cgtsAgentPlugin", "var_alarms")); - index = header_alarmEntry(vp, name, length, exact, var_len, write_method); - if (index == MATCH_FAILED) - return NULL; - - Alarm_Scan_By_Index(index, Name, &alrm); - - switch (vp->magic) { - case ALARM_INDEX: - long_return = index; - return (u_char *) & long_return; - case ALARM_UUID: - cp = Name; - *var_len = strlen(cp); - return (u_char *) cp; - case ALARM_ID: - cp = alrm.alarmdata.alarm_id; - *var_len = strlen(cp); - return (u_char *) cp; - case ALARM_INSTANCE_ID: - cp = alrm.alarmdata.entity_instance_id; - *var_len = strlen(cp); - return (u_char *) cp; - case ALARM_TIME:{ - time_t when = alrm.alarmdata.timestamp/SECOND_PER_MICROSECOND; - cp = (char *) date_n_time(&when, var_len ); - return (u_char *) cp; - } - case ALARM_SEVERITY: - long_return = alrm.alarmdata.severity; - return (u_char *) & long_return; - case ALARM_REASONTEXT: - cp = alrm.alarmdata.reason_text; - *var_len = strlen(cp); - return (u_char *) cp; - case ALARM_EVENTTYPE: - long_return = alrm.alarmdata.alarm_type; - return (u_char *) & long_return; - case ALARM_PROBABLECAUSE: - long_return = alrm.alarmdata.probable_cause; - return (u_char *) & long_return; - case ALARM_REPAIRACTION: - cp = alrm.alarmdata.proposed_repair_action; - *var_len = strlen(cp); - return (u_char *) cp; - case ALARM_SERVICEAFFECTING: - long_return = alrm.alarmdata.service_affecting; - return (u_char *) & long_return; - case ALARM_SUPPRESSION: - long_return = alrm.alarmdata.suppression; - return (u_char *) & long_return; - default: - DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_alarms\n", - vp->magic)); - } - return NULL; -} - diff --git a/snmp-ext/sources/cgtsAgentPlugin.c b/snmp-ext/sources/cgtsAgentPlugin.c deleted file mode 100644 index b19ef773..00000000 --- a/snmp-ext/sources/cgtsAgentPlugin.c +++ /dev/null @@ -1,164 +0,0 @@ -/* -* Copyright (c) 2016 Wind River Systems, Inc. -* -* SPDX-License-Identifier: Apache-2.0 -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cgtsAgentPlugin.h" - - -#define CGTS_ALM_TABLE_NAME "wrsAlarmActiveTable" -#define CGTS_EVENT_TABLE_NAME "wrsEventTable" - -#define _UNREGISTER_MIB(var, miboid) \ - do{ \ - size_t varsize = sizeof(struct variable2); \ - struct variable2 *vp; \ - oid myoid[MAX_OID_LEN]; \ - size_t length; \ - int i, result; \ - int numvars = sizeof(var)/varsize; \ - int miboidlen = sizeof(miboid)/sizeof(oid); \ - for (i=0; i < numvars; i++) { \ - vp = (struct variable2 *)((char *)var + varsize * i); \ - memcpy(myoid, miboid, miboidlen * sizeof(oid)); \ - memcpy(myoid+miboidlen, vp->name, vp->namelen * sizeof(oid)); \ - length = miboidlen + vp->namelen; \ - result = unregister_mib(myoid, length); \ - DEBUGMSGOID(("cgtsAgentPlugin", myoid, length)); \ - if (result != MIB_UNREGISTERED_OK) { \ - snmp_log(LOG_ERR, "%s: Unregistering failed:%d\n", \ - __FUNCTION__, result); \ - } else { \ - DEBUGMSGTL(("cgtsAgentPlugin", "Unregistering succeeded\n")); \ - } \ - } \ - }while(0); - - -static TFmAlarmSessionT alm_handle; - -/* - * * the OID we want to register our integer at. This should be the - * * OID node for the entire table. In our case this is the - * * wrsAlarmActiveTable oid definition - */ -oid cgtsAlarmTable_oid[] = - { 1, 3, 6, 1, 4, 1, 731, 1, 1, 1, 1, 1}; - -oid cgtsEventLogTable_oid[] = - { 1, 3, 6, 1, 4, 1, 731, 1, 1, 1, 1, 4}; - - -struct variable2 alarm_variables[] = { - {ALARM_INDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 1}}, - {ALARM_UUID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 2}}, - {ALARM_ID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 3}}, - {ALARM_INSTANCE_ID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 4}}, - {ALARM_TIME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 5}}, - {ALARM_SEVERITY, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 6}}, - {ALARM_REASONTEXT, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 7}}, - {ALARM_EVENTTYPE, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 8}}, - {ALARM_PROBABLECAUSE, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 9}}, - {ALARM_REPAIRACTION , ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 10}}, - {ALARM_SERVICEAFFECTING, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 11}}, - {ALARM_SUPPRESSION, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_alarms, 2, {1, 12}}, -}; - -struct variable2 event_log_variables[] = { - {EVENT_INDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 1}}, - {EVENT_UUID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 2}}, - {EVENT_EVENT_ID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 3}}, - {EVENT_STATE, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 4}}, - {EVENT_INSTANCE_ID, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 5}}, - {EVENT_TIME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 6}}, - {EVENT_SEVERITY, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 7}}, - {EVENT_REASONTEXT, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 8}}, - {EVENT_EVENTTYPE, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 9}}, - {EVENT_PROBABLECAUSE, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 10}}, - {EVENT_REPAIRACTION , ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 11}}, - {EVENT_SERVICEAFFECTING, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 12}}, - {EVENT_SUPPRESSION, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, - var_events, 2, {1, 13}}, -}; - - -TFmAlarmSessionT getAlarmSession() -{ - return alm_handle; -} - -/* - * our initialization routine, automatically called by the agent - * (to get called, the function name must match init_FILENAME()) - */ -void -init_cgtsAgentPlugin(void) -{ - snmp_log(LOG_INFO,"init_cgtsAgentPlugin start"); - snmp_log(LOG_INFO,"MIB registration: %s",CGTS_ALM_TABLE_NAME); - REGISTER_MIB(CGTS_ALM_TABLE_NAME, alarm_variables, - variable2, cgtsAlarmTable_oid); - - snmp_log(LOG_INFO,"MIB registration: %s",CGTS_EVENT_TABLE_NAME); - REGISTER_MIB(CGTS_EVENT_TABLE_NAME, event_log_variables, - variable2, cgtsEventLogTable_oid); - - snmp_log(LOG_INFO,"get alarm database handler"); - if (fm_snmp_util_create_session(&alm_handle, NULL) != true){ - snmp_log(LOG_ERR,"failed to get alarm database handler"); - exit(-1); - } - /* - * a debugging statement. Run the agent with -DcgtsAgentPlugin to see - * the output of this debugging statement. - */ - DEBUGMSGTL(("cgtsAgentPlugin", "Done initializing.\n")); -} - -void -deinit_cgtsAgentPlugin(void) -{ - snmp_log(LOG_INFO,"deinit_cgtsAgentPlugin start"); - _UNREGISTER_MIB(alarm_variables, cgtsAlarmTable_oid); - _UNREGISTER_MIB(event_log_variables, cgtsEventLogTable_oid); - fm_snmp_util_destroy_session(alm_handle); -} - - - diff --git a/snmp-ext/sources/cgtsAgentPlugin.h b/snmp-ext/sources/cgtsAgentPlugin.h deleted file mode 100644 index df82e1fd..00000000 --- a/snmp-ext/sources/cgtsAgentPlugin.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2013-2014 Wind River Systems, Inc. -* -* SPDX-License-Identifier: Apache-2.0 -* -*/ - -#ifndef CGTSAGENTPLUGIN_H -#define CGTSAGENTPLUGIN_H - -#include -#include -#include - -extern FindVarMethod var_alarms; - -extern FindVarMethod var_events; - -/* Active alarm Table */ -#define ALARM_INDEX 1 -#define ALARM_UUID 2 -#define ALARM_ID 3 -#define ALARM_INSTANCE_ID 4 -#define ALARM_TIME 5 -#define ALARM_SEVERITY 6 -#define ALARM_REASONTEXT 7 -#define ALARM_EVENTTYPE 8 -#define ALARM_PROBABLECAUSE 9 -#define ALARM_REPAIRACTION 10 -#define ALARM_SERVICEAFFECTING 11 -#define ALARM_SUPPRESSION 12 - -/* Event Log Table */ -#define EVENT_INDEX 1 -#define EVENT_UUID 2 -#define EVENT_EVENT_ID 3 -#define EVENT_STATE 4 -#define EVENT_INSTANCE_ID 5 -#define EVENT_TIME 6 -#define EVENT_SEVERITY 7 -#define EVENT_REASONTEXT 8 -#define EVENT_EVENTTYPE 9 -#define EVENT_PROBABLECAUSE 10 -#define EVENT_REPAIRACTION 11 -#define EVENT_SERVICEAFFECTING 12 -#define EVENT_SUPPRESSION 13 - - -#define SECOND_PER_MICROSECOND 1000000 - -struct activealarm { - SFmAlarmDataT alarmdata; - struct activealarm *next; -}; - -/* - * function declarations - */ -#ifdef __cplusplus -extern "C" { -#endif -void init_cgtsAgentPlugin(void); -void deinit_cgtsAgentPlugin(void); -TFmAlarmSessionT getAlarmSession(); -#ifdef __cplusplus -} -#endif - -#endif /* CGTSAGENTPLUGIN_H */ diff --git a/snmp-ext/sources/cgtsEventLogs.c b/snmp-ext/sources/cgtsEventLogs.c deleted file mode 100644 index 848261fa..00000000 --- a/snmp-ext/sources/cgtsEventLogs.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2013-2016 Wind River Systems, Inc. -* -* SPDX-License-Identifier: Apache-2.0 -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cgtsAgentPlugin.h" - - -netsnmp_feature_require(date_n_time) - -#define MINLOADFREQ 2 /* min reload frequency in seconds */ - -static long Event_Log_Count = 0; -static struct activealarm *alarm_list; -static struct activealarm *alarmaddr, savealarm, *savealarmaddr; -static int saveIndex = 0; -static char saveUuid[36]; -static long LastLoad = 0; /* ET in secs at last table load */ -extern long long_return; - - -int Event_Log_Get_Count(void); - -static void -Event_Log_Scan_Init() -{ - struct timeval et; /* elapsed time */ - struct activealarm **activealarm_ptr; - SFmAlarmQueryT aquery; - size_t i = 0; - - saveIndex = 0; - netsnmp_get_monotonic_clock(&et); - if ( et.tv_sec < LastLoad + MINLOADFREQ ) { - DEBUGMSG(("cgtsAgentPlugin", "Skip reload" )); - alarmaddr = alarm_list; - return; - } - LastLoad = et.tv_sec; - - /* - * free old list: - */ - while (alarm_list) { - struct activealarm *old = alarm_list; - alarm_list = alarm_list->next; - free(old); - } - alarmaddr = 0; - activealarm_ptr = &alarm_list; - - /* - * query event log list from DB - */ - if (fm_snmp_util_get_all_event_logs(getAlarmSession(), &aquery) != true){ - DEBUGMSG(("cgtsAgentPlugin", "get_all_event_logs from db failed\n")); - return; - } - DEBUGMSG(("cgtsAgentPlugin", "get_all_event_logs returns %lu logs\n", aquery.num)); - for (i = 0; i < aquery.num; ++i){ - struct activealarm *almnew; - /*populate alarm_list*/ - almnew = (struct activealarm *) calloc(1, sizeof(struct activealarm)); - if (almnew == NULL) - break; /* alloc error */ - *activealarm_ptr = almnew; - activealarm_ptr = &almnew->next; - memset(&almnew->alarmdata, 0 , sizeof(almnew->alarmdata)); - memcpy(&almnew->alarmdata, aquery.alarm + i, sizeof(almnew->alarmdata)); - } - alarmaddr = alarm_list; - free(aquery.alarm); -} - -static int -Event_Log_Scan_NextLog(int *Index, - char *Name, - struct activealarm *Aalm) -{ - struct activealarm alm; - while (alarmaddr) { - alm = *alarmaddr; - strlcpy(saveUuid, alm.alarmdata.uuid, sizeof(saveUuid)); - if (Index) - *Index = ++saveIndex; - if (Aalm) - *Aalm = alm; - if (Name) - strcpy(Name, saveUuid); - - savealarm = alm; - savealarmaddr = alarmaddr; - alarmaddr = alm.next; - return 1; - } - return 0; -} - -static int -Event_Log_Scan_By_Index(int Index, - char *Name, - struct activealarm *Aalm) -{ - int i; - - DEBUGMSGTL(("cgtsAgentPlugin","Event_Log_Scan_By_Index")); - Event_Log_Scan_Init(); - while (Event_Log_Scan_NextLog(&i, Name, Aalm)) { - if (i == Index) - break; - } - if (i != Index) - return (-1); /* Error, doesn't exist */ - return (0); /* DONE */ -} - -static int -header_eventLogEntry(struct variable *vp, - oid * name, - size_t * length, - int exact, size_t * var_len, - WriteMethod ** write_method) -{ -#define ALM_ENTRY_NAME_LENGTH 14 - oid newname[MAX_OID_LEN]; - register int index; - int result, count; - - DEBUGMSGTL(("cgtsAgentPlugin", "header_eventLogEntry: ")); - DEBUGMSGOID(("cgtsAgentPlugin", name, *length)); - DEBUGMSG(("cgtsAgentPlugin", "exact %d\n", exact)); - - memcpy((char *) newname, (char *) vp->name, - (int) vp->namelen * sizeof(oid)); - /* - * find "next" log - */ - count = Event_Log_Get_Count(); - DEBUGMSG(("cgtsAgentPlugin", "count %d\n", count)); - for (index = 1; index <= count; index++) { - newname[ALM_ENTRY_NAME_LENGTH] = (oid) index; - result = - snmp_oid_compare(name, *length, newname, - (int) vp->namelen + 1); - if ((exact && (result == 0)) || (!exact && (result < 0))) - break; - } - if (index > count) { - DEBUGMSGTL(("cgtsAgentPlugin", "... index out of range\n")); - return MATCH_FAILED; - } - - memcpy((char *) name, (char *) newname, - ((int) vp->namelen + 1) * sizeof(oid)); - *length = vp->namelen + 1; - *write_method = 0; - *var_len = sizeof(long); /* default to 'long' results */ - - DEBUGMSGTL(("cgtsAgentPlugin", "... get ALM data ")); - DEBUGMSGOID(("cgtsAgentPlugin", name, *length)); - DEBUGMSG(("cgtsAgentPlugin", "\n")); - - DEBUGMSG(("cgtsAgentPlugin","Return index: %d\n", index)); - return index; -} - -int -Event_Log_Get_Count(void) -{ - static time_t scan_time = 0; - time_t time_now = time(NULL); - - if (!Event_Log_Count || (time_now > scan_time + 60)) { - scan_time = time_now; - Event_Log_Scan_Init(); - Event_Log_Count = 0; - while (Event_Log_Scan_NextLog(NULL, NULL, NULL) != 0) { - Event_Log_Count++; - } - } - return (Event_Log_Count); -} - -u_char * -var_events(struct variable *vp, - oid * name, - size_t * length, - int exact, size_t * var_len, - WriteMethod ** write_method) -{ - static struct activealarm alrm; - static char Name[36]; - char *cp; - int index = 0; - - DEBUGMSGTL(("cgtsAgentPlugin", "var_events")); - index = header_eventLogEntry(vp, name, length, exact, var_len, write_method); - if (index == MATCH_FAILED) - return NULL; - - Event_Log_Scan_By_Index(index, Name, &alrm); - - switch (vp->magic) { - case EVENT_INDEX: - long_return = index; - return (u_char *) & long_return; - case EVENT_UUID: - cp = Name; - *var_len = strlen(cp); - return (u_char *) cp; - case EVENT_EVENT_ID: - cp = alrm.alarmdata.alarm_id; - *var_len = strlen(cp); - return (u_char *) cp; - case EVENT_STATE: - long_return = alrm.alarmdata.alarm_state; - return (u_char *) & long_return; - case EVENT_INSTANCE_ID: - cp = alrm.alarmdata.entity_instance_id; - *var_len = strlen(cp); - return (u_char *) cp; - case EVENT_TIME:{ - time_t when = alrm.alarmdata.timestamp/SECOND_PER_MICROSECOND; - cp = (char *) date_n_time(&when, var_len ); - return (u_char *) cp; - } - case EVENT_SEVERITY: - long_return = alrm.alarmdata.severity; - return (u_char *) & long_return; - case EVENT_REASONTEXT: - cp = alrm.alarmdata.reason_text; - *var_len = strlen(cp); - return (u_char *) cp; - case EVENT_EVENTTYPE: - long_return = alrm.alarmdata.alarm_type; - return (u_char *) & long_return; - case EVENT_PROBABLECAUSE: - long_return = alrm.alarmdata.probable_cause; - return (u_char *) & long_return; - case EVENT_REPAIRACTION: - cp = alrm.alarmdata.proposed_repair_action; - *var_len = strlen(cp); - return (u_char *) cp; - case EVENT_SERVICEAFFECTING: - long_return = alrm.alarmdata.service_affecting; - return (u_char *) & long_return; - case EVENT_SUPPRESSION: - long_return = alrm.alarmdata.suppression; - return (u_char *) & long_return; - default: - DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_events\n", - vp->magic)); - } - return NULL; -} - diff --git a/snmp-ext/sources/mibs/wrsAlarmMib.mib.txt b/snmp-ext/sources/mibs/wrsAlarmMib.mib.txt deleted file mode 100644 index 7c5fb7fe..00000000 --- a/snmp-ext/sources/mibs/wrsAlarmMib.mib.txt +++ /dev/null @@ -1,818 +0,0 @@ -WRS-ALARM-MIB - -DEFINITIONS ::= BEGIN - - IMPORTS - wrsAlarms, WrsUUID, WrsBoolean FROM WRS-ENTERPRISE-REG-MIB - - NOTIFICATION-GROUP, OBJECT-GROUP, MODULE-COMPLIANCE - FROM SNMPv2-CONF - - DateAndTime, DisplayString, TEXTUAL-CONVENTION - FROM SNMPv2-TC - - MODULE-IDENTITY, OBJECT-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, Unsigned32 - FROM SNMPv2-SMI; - - - wrsAlarmMIB MODULE-IDENTITY - LAST-UPDATED "201703310000Z" - ORGANIZATION "Wind River Systems, Inc." - CONTACT-INFO "Wind River Systems, Inc. - 500 Wind River Way - Alameda, CA 94501, USA - Contact : Wind River Systems Support - E-mail: support@windriver.com - Phone : 510.748.4100" - DESCRIPTION "This module contains objects of the - Titanium Cloud Alarm MIB, - including notifications." - - -- Revision history - REVISION "201703310000Z" - DESCRIPTION "Titanium Cloud Release 4 version, with new Event table and removal of deprecated customer and alarm history tables." - ::= { wrsAlarms 1 } - - wrsAlarmObjects OBJECT IDENTIFIER ::= { wrsAlarmMIB 1 } - wrsAlarmConformance OBJECT IDENTIFIER ::= { wrsAlarmMIB 2 } - wrsAlarmCompliances OBJECT IDENTIFIER ::= { wrsAlarmConformance 1 } - wrsAlarmGroups OBJECT IDENTIFIER ::= { wrsAlarmConformance 2 } - - - -- Textual Conventions - - WrsAlarmSeverity ::= TEXTUAL-CONVENTION - STATUS current - DESCRIPTION "The severity of the alarm." - SYNTAX INTEGER - { - not-applicable (0), - warning (1), - minor (2), - major (3), - critical (4) - } - - WrsAlarmState ::= TEXTUAL-CONVENTION - STATUS current - DESCRIPTION "The state of the alarm." - SYNTAX INTEGER - { - clear (0), - set (1), - log (3) - } - - WrsAlarmId ::= TEXTUAL-CONVENTION - STATUS current - DESCRIPTION "An ID identifying the particular Alarm condition. - Typically used as an index for looking up Alarm details - in a System's Alarm Document. - - This will be a structured ID, in order to allow grouping of - Alarms into general categories and allow specific Alarms to - be independently added and numbered within the group. - - e.g. . - where = 000 - 999 - = 000 - 999 - - NOTE: the { alarm-id, entity-instance-id } uniquely identifies an ACTIVE Alarm. - e.g. - - an alarm is cleared based on the matching { alarm-id, entity-instance-id }, - - consecutive sets of an alarm with matching { alarm-id, entity-instance-id } - updates the fields of the single ACTIVE Alarm. - E.g. updates severity for example. " - SYNTAX OCTET STRING (SIZE (0..7)) - - WrsAlarmEntityInstanceId ::= TEXTUAL-CONVENTION - DISPLAY-HINT "255a" - STATUS current - DESCRIPTION "This is a textual description of the resource under alarm. - - A '.' separated list of sub-entity-type=instance-value pairs, - representing the containment structure of the overall entity - instance. - - Can be larger than 256 bytes. - - Note that this containment structure will be used for - processing hierarchical clears. - - e.g - system=ironpass1-4 - system=ironpass1-4 . host=compute-0 - system=ironpass1-4 . host=compute-0 . port=eth0 - system=ironpass1-4 . host=compute-0 . disk=/dev/sda - - system=ironpass1-4 . instance=vyatta_rtr_0 - system=ironpass1-4 . stack=vyatta_scaling_rtrs - - NOTE: the { alarm-id, entity-instance-id } uniquely identifies an ACTIVE Alarm. - e.g. - - an alarm is cleared based on the matching { alarm-id, entity-instance-id }, - - consecutive sets of an alarm with matching { alarm-id, entity-instance-id } - updates the fields of the single ACTIVE Alarm. - E.g. updates severity for example." - SYNTAX OCTET STRING - - WrsAlarmText ::= TEXTUAL-CONVENTION - DISPLAY-HINT "255a" - STATUS current - DESCRIPTION "Variable length string to encapsulate alarm or message - information from the entity raising the trap. - Can be larger than 256 bytes." - SYNTAX OCTET STRING - - WrsAlarmProbableCause ::= TEXTUAL-CONVENTION - STATUS current - DESCRIPTION - "ITU-T probable cause values. Duplicate values defined in - X.733 are appended with X733 to ensure syntactic uniqueness. - Probable cause value 0 is reserved for special purposes. - - The Internet Assigned Number Authority (IANA) is responsible - for the assignment of the enumerations in this TC. - IANAItuProbableCause value of 0 is reserved for special - purposes and MUST NOT be assigned. - - Values of IANAItuProbableCause in the range 1 to 1023 are - reserved for causes that correspond to ITU-T probable cause. - - All other requests for new causes will be handled on a - first-come, first served basis and will be assigned - enumeration values starting with 1025. - - Request should come in the form of well-formed - SMI [RFC2578] for enumeration names that are unique and - sufficiently descriptive. - - While some effort will be taken to ensure that new probable - causes do not conceptually duplicate existing probable - causes it is acknowledged that the existence of conceptual - duplicates in the starting probable cause list is an known - industry reality. - - To aid IANA in the administration of probable cause names - and values, the OPS Area Director will appoint one or more - experts to help review requests. - - See http://www.iana.org" - REFERENCE - "ITU Recommendation M.3100, 'Generic Network Information - Model', 1995 - ITU Recommendation X.733, 'Information Technology - Open - Systems Interconnection - System Management: Alarm - Reporting Function', 1992 - ITU Recommendation X.736, 'Information Technology - Open - Systems Interconnection - System Management: Security - Alarm Reporting Function', 1992" - SYNTAX INTEGER - { - not-applicable (0), - -- The following probable causes were defined in M.3100 - adaptor-error (1), - application-subsystem-failure (2), - bandwidth-reduced (3), - call-establishment-error (4), - communication-protocol-error (5), - communication-subsystem-failure (6), - configuration-or-customization-error (7), - congestion (8), - corrupt-data (9), - cpu-cycles-limit-exceeded (10), - dataset-or-modem-error (11), - degraded-signal (12), - dte-dce-interface-error (13), - enclosure-door-open (14), - equipment-malfunction (15), - excessive-vibration (16), - file-error (17), - fire-detected (18), - flood-detected (19), - framing-error (20), - heating-ventilation-cooling-system-problem (21), - humidity-unacceptable (22), - io-device-error (23), - input-device-error (24), - lan-error (25), - leak-detected (26), - local-node-transmission-error (27), - loss-of-frame (28), - loss-of-signal (29), - material-supply-exhausted (30), - multiplexer-problem (31), - out-of-memory (32), - output-device-error (33), - performance-degraded (34), - power-problem (35), - processor-problem (36), - pump-failure (37), - queue-size-exceeded (38), - receive-failure (39), - receiver-failure (40), - remote-node-transmission-error (41), - resource-at-or-nearing-capacity (42), - response-time-excessive (43), - retransmission-rate-excessive (44), - software-error (45), - software-program-abnormally-terminated (46), - software-program-error (47), - storage-capacity-problem (48), - temperature-unacceptable (49), - threshold-crossed (50), - timing-problem (51), - toxic-leak-detected (52), - transmit-failure (53), - transmitter-failure (54), - underlying-resource-unavailable (55), - version-mismatch (56), - duplicate-information (57), - information-missing (58), - information-modification-detected (59), - information-out-of-sequence (60), - unexpected-information (61), - denial-of-service (62), - out-of-service (63), - procedural-error (64), - unspecified-reason (65), - cable-tamper (66), - intrusion-detection (67), - authentication-failure (68), - breach-of-confidentiality (69), - non-repudiation-failure (70), - unauthorized-access-attempt (71), - delayed-information (72), - key-expired (73), - out-of-hours-activity (74) - } - - WrsAlarmEventType ::= TEXTUAL-CONVENTION - STATUS current - DESCRIPTION - "The ITU event Type values. - - The Internet Assigned Number Authority (IANA) is - responsible for the assignment of the enumerations - in this TC. - - Request should come in the form of well-formed - SMI [RFC2578] for enumeration names that are unique - and sufficiently descriptive. - - See http://www.iana.org " - REFERENCE - "ITU Recommendation X.736, 'Information Technology - Open - Systems Interconnection - System Management: Security - Alarm Reporting Function', 1992" - SYNTAX INTEGER - { - other (0), - communicationsAlarm (1), - qualityOfServiceAlarm (2), - processingErrorAlarm (3), - equipmentAlarm (4), - environmentalAlarm (5), - integrityViolation (6), - operationalViolation (7), - physicalViolation (8), - securityServiceOrMechanismViolation (9), - timeDomainViolation (10) - } - - - -- Wind River Systems Active Alarm Table - - wrsAlarmActiveTable OBJECT-TYPE - SYNTAX SEQUENCE OF WrsAlarmActiveEntry - MAX-ACCESS not-accessible - STATUS current - DESCRIPTION "This table contains information about active alarms." - ::= { wrsAlarmObjects 1 } - - wrsAlarmActiveEntry OBJECT-TYPE - SYNTAX WrsAlarmActiveEntry - MAX-ACCESS not-accessible - STATUS current - DESCRIPTION "An active alarm entry" - INDEX { wrsAlarmActiveIndex } - ::= { wrsAlarmActiveTable 1 } - - WrsAlarmActiveEntry ::= SEQUENCE { - wrsAlarmActiveIndex Unsigned32, - wrsAlarmActiveUuid DisplayString, - wrsAlarmActiveAlarmId WrsAlarmId, - wrsAlarmActiveEntityInstanceId WrsAlarmEntityInstanceId, - wrsAlarmActiveDateAndTime DateAndTime, - wrsAlarmActiveAlarmSeverity WrsAlarmSeverity, - wrsAlarmActiveReasonText WrsAlarmText, - wrsAlarmActiveEventType WrsAlarmEventType, - wrsAlarmActiveProbableCause WrsAlarmProbableCause, - wrsAlarmActiveProposedRepairAction WrsAlarmText, - wrsAlarmActiveServiceAffecting WrsBoolean, - wrsAlarmActiveSuppressionAllowed WrsBoolean - } - - wrsAlarmActiveIndex OBJECT-TYPE - SYNTAX Unsigned32 (1..4294967295) - MAX-ACCESS not-accessible - STATUS current - DESCRIPTION "The index of the Active Alarm in the Active Alarm Table." - ::= { wrsAlarmActiveEntry 1 } - - wrsAlarmActiveUuid OBJECT-TYPE - SYNTAX DisplayString - MAX-ACCESS read-only - STATUS current - DESCRIPTION "An ID identifying the active alarm instance in the Active Alarm Table." - ::= { wrsAlarmActiveEntry 2 } - - wrsAlarmActiveAlarmId OBJECT-TYPE - SYNTAX WrsAlarmId - MAX-ACCESS read-only - STATUS current - DESCRIPTION "An ID identifying the particular Alarm condition. - Typically used as an index for looking up Alarm details - in a System's Alarm Document. - - This will be a structured ID, in order to allow grouping of - Alarms into general categories and allow specific Alarms to - be independently added and numbered within the group. - - e.g. . - where = 000 - 999 - = 000 - 999 - - NOTE: the { alarm-id, entity-instance-id } uniquely identifies an ACTIVE Alarm. - e.g. - - an alarm is cleared based on the matching { alarm-id, entity-instance-id }, - - consecutive sets of an alarm with matching { alarm-id, entity-instance-id } - updates the fields of the single ACTIVE Alarm. - E.g. updates severity for example. " - ::= { wrsAlarmActiveEntry 3 } - - wrsAlarmActiveEntityInstanceId OBJECT-TYPE - SYNTAX WrsAlarmEntityInstanceId - MAX-ACCESS read-only - STATUS current - DESCRIPTION "This is a textual description of the resource under alarm. - - A '.' separated list of sub-entity-type=instance-value pairs, - representing the containment structure of the overall entity - instance. - - Note that this containment structure will be used for - processing hierarchical clears. - - e.g - system=ironpass1-4 - system=ironpass1-4 . host=compute-0 - system=ironpass1-4 . host=compute-0 . port=eth0 - system=ironpass1-4 . host=compute-0 . disk=/dev/sda - - system=ironpass1-4 . instance=vyatta_rtr_0 - system=ironpass1-4 . stack=vyatta_scaling_rtrs - - NOTE: the { alarm-id, entity-instance-id } uniquely identifies an ACTIVE Alarm. - e.g. - - an alarm is cleared based on the matching { alarm-id, entity-instance-id }, - - consecutive sets of an alarm with matching { alarm-id, entity-instance-id } - updates the fields of the single ACTIVE Alarm. - E.g. updates severity for example." - ::= { wrsAlarmActiveEntry 4 } - - wrsAlarmActiveDateAndTime OBJECT-TYPE - SYNTAX DateAndTime - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Provided in this table as a convenience. It is a copy of the Date and Time of the alarm." - ::= { wrsAlarmActiveEntry 5} - - wrsAlarmActiveAlarmSeverity OBJECT-TYPE - SYNTAX WrsAlarmSeverity - MAX-ACCESS read-only - STATUS current - DESCRIPTION "The severity of the alarm." - ::= { wrsAlarmActiveEntry 6} - - wrsAlarmActiveReasonText OBJECT-TYPE - SYNTAX WrsAlarmText - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Represents the per active alarm instance additional text field." - REFERENCE "ITU Recommendation M.3100, 'Generic Network Information Model', 1995 - ITU Recommendation X.733, 'Information Technology - Open - Systems Interconnection - System Management: Alarm Reporting Function', 1992" - ::= { wrsAlarmActiveEntry 7} - - wrsAlarmActiveEventType OBJECT-TYPE - SYNTAX WrsAlarmEventType - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Represents the per active alarm instance event type values." - REFERENCE "ITU Recommendation M.3100, 'Generic Network Information Model', 1995 - ITU Recommendation X.733, 'Information Technology - Open - Systems Interconnection - System Management: Alarm Reporting Function', 1992 - ITU Recommendation X.736, 'Information Technology - Open - Systems Interconnection - System Management: Security - Alarm Reporting Function', 1992" - ::= { wrsAlarmActiveEntry 8 } - - wrsAlarmActiveProbableCause OBJECT-TYPE - SYNTAX WrsAlarmProbableCause - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Per active alarm instance ITU probable cause values." - REFERENCE "ITU Recommendation M.3100, 'Generic Network Information Model', 1995 - ITU Recommendation X.733, 'Information Technology - Open - Systems Interconnection - System Management: Alarm Reporting Function', 1992 - ITU Recommendation X.736, 'Information Technology - Open - Systems Interconnection - System Management: Security - Alarm Reporting Function', 1992" - ::= { wrsAlarmActiveEntry 9 } - - wrsAlarmActiveProposedRepairAction OBJECT-TYPE - SYNTAX WrsAlarmText - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Represents more of the per active alarm instance additional text field." - ::= { wrsAlarmActiveEntry 10} - - wrsAlarmActiveServiceAffecting OBJECT-TYPE - SYNTAX WrsBoolean - MAX-ACCESS read-only - STATUS current - DESCRIPTION "This attribute indicates whether the alarm is service affecting or not." - ::= { wrsAlarmActiveEntry 11 } - - wrsAlarmActiveSuppressionAllowed OBJECT-TYPE - SYNTAX WrsBoolean - MAX-ACCESS read-only - STATUS current - DESCRIPTION "This attribute indicates whether the alarm can be manually suppressed or not." - ::= { wrsAlarmActiveEntry 12 } - - - -- Wind River Event Table - - wrsEventTable OBJECT-TYPE - SYNTAX SEQUENCE OF WrsEventEntry - MAX-ACCESS not-accessible - STATUS current - DESCRIPTION "This table contains information about events." - ::= { wrsAlarmObjects 4 } - - wrsEventEntry OBJECT-TYPE - SYNTAX WrsEventEntry - MAX-ACCESS not-accessible - STATUS current - DESCRIPTION "An event entry" - INDEX { wrsEventIndex } - ::= { wrsEventTable 1 } - - WrsEventEntry ::= SEQUENCE { - wrsEventIndex Unsigned32, - wrsEventUuid DisplayString, - wrsEventEventId WrsAlarmId, - wrsEventState WrsAlarmState, - wrsEventEntityInstanceId WrsAlarmEntityInstanceId, - wrsEventDateAndTime DateAndTime, - wrsEventSeverity WrsAlarmSeverity, - wrsEventReasonText WrsAlarmText, - wrsEventEventType WrsAlarmEventType, - wrsEventProbableCause WrsAlarmProbableCause, - wrsEventProposedRepairAction WrsAlarmText, - wrsEventServiceAffecting WrsBoolean, - wrsEventSuppressionAllowed WrsBoolean - } - - wrsEventIndex OBJECT-TYPE - SYNTAX Unsigned32 (1..4294967295) - MAX-ACCESS not-accessible - STATUS current - DESCRIPTION "The index of the event in the Event Table." - ::= { wrsEventEntry 1 } - - wrsEventUuid OBJECT-TYPE - SYNTAX DisplayString - MAX-ACCESS read-only - STATUS current - DESCRIPTION "An ID identifying the event instance in the Event Table." - ::= { wrsEventEntry 2 } - - wrsEventEventId OBJECT-TYPE - SYNTAX WrsAlarmId - MAX-ACCESS read-only - STATUS current - DESCRIPTION "An ID identifying the particular Event condition. - Typically used as an index for looking up Event details - in a System's Event Document. - - This will be a structured ID, in order to allow grouping of - Events into general categories and allow specific Event to - be independently added and numbered within the group. - - e.g. . - where = 000 - 999 - = 000 - 999 " - ::= { wrsEventEntry 3 } - - wrsEventState OBJECT-TYPE - SYNTAX WrsAlarmState - MAX-ACCESS read-only - STATUS current - DESCRIPTION "The state of the event. - - For Customer log events, this field is set to LOG. The attributes that are applicable for a LOG state are: - State, EventId, EntityInstanceId, DateAndTime, Severity, ReasonText, EventType, ProbableCause, ServiceAffecting - - " - ::= { wrsEventEntry 4 } - - wrsEventEntityInstanceId OBJECT-TYPE - SYNTAX WrsAlarmEntityInstanceId - MAX-ACCESS read-only - STATUS current - DESCRIPTION "This is a textual description of the resource under event. - - A '.' separated list of sub-entity-type=instance-value pairs, - representing the containment structure of the overall entity - instance. - - e.g - system=ironpass1-4 - system=ironpass1-4 . host=compute-0 - system=ironpass1-4 . host=compute-0 . port=eth0 - system=ironpass1-4 . host=compute-0 . disk=/dev/sda - - system=ironpass1-4 . instance=vyatta_rtr_0 - system=ironpass1-4 . stack=vyatta_scaling_rtrs" - ::= { wrsEventEntry 5 } - - wrsEventDateAndTime OBJECT-TYPE - SYNTAX DateAndTime - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Provided in this table as a convenience. It is the event last update Date and Time ." - ::= { wrsEventEntry 6 } - - wrsEventSeverity OBJECT-TYPE - SYNTAX WrsAlarmSeverity - MAX-ACCESS read-only - STATUS current - DESCRIPTION "The severity of the Event." - ::= { wrsEventEntry 7 } - - wrsEventReasonText OBJECT-TYPE - SYNTAX WrsAlarmText - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Represents the per Event instance additional text field." - REFERENCE "ITU Recommendation M.3100, 'Generic Network Information Model', 1995 - ITU Recommendation X.733, 'Information Technology - Open - Systems Interconnection - System Management: Alarm Reporting Function', 1992" - ::= { wrsEventEntry 8 } - - wrsEventEventType OBJECT-TYPE - SYNTAX WrsAlarmEventType - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Represents the per Event instance event type values." - REFERENCE "ITU Recommendation M.3100, 'Generic Network Information Model', 1995 - ITU Recommendation X.733, 'Information Technology - Open - Systems Interconnection - System Management: Alarm Reporting Function', 1992 - ITU Recommendation X.736, 'Information Technology - Open - Systems Interconnection - System Management: Security - Alarm Reporting Function', 1992" - ::= { wrsEventEntry 9 } - - wrsEventProbableCause OBJECT-TYPE - SYNTAX WrsAlarmProbableCause - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Per Event instance ITU probable cause values." - REFERENCE "ITU Recommendation M.3100, 'Generic Network Information Model', 1995 - ITU Recommendation X.733, 'Information Technology - Open - Systems Interconnection - System Management: Alarm Reporting Function', 1992 - ITU Recommendation X.736, 'Information Technology - Open - Systems Interconnection - System Management: Security - Alarm Reporting Function', 1992" - ::= { wrsEventEntry 10 } - - wrsEventProposedRepairAction OBJECT-TYPE - SYNTAX WrsAlarmText - MAX-ACCESS read-only - STATUS current - DESCRIPTION "Represents more of the per historical alarm instance additional text field. - Applies to alarms only." - ::= { wrsEventEntry 11} - - wrsEventServiceAffecting OBJECT-TYPE - SYNTAX WrsBoolean - MAX-ACCESS read-only - STATUS current - DESCRIPTION "This attribute indicates whether the Event is service affecting or not." - ::= { wrsEventEntry 12 } - - wrsEventSuppressionAllowed OBJECT-TYPE - SYNTAX WrsBoolean - MAX-ACCESS read-only - STATUS current - DESCRIPTION "This attribute indicates whether the alarm can be manually suppressed or not. - Applies to alarms only." - ::= { wrsEventEntry 13 } - - - -- All notification OIDs would be prefixed with a zero OID to facilitate snmp v1<->v2 conversion - - wrsTrapPrefix OBJECT-IDENTITY - STATUS current - DESCRIPTION "This OID represents the prefix branch for all WIND RIVER ITU Alarm Trap. - The last but one sub identifier in the OID of any Notification must have the value - zero to facilitate v2<-->v1 conversion." - ::= {wrsAlarmObjects 0 } - - --- Generic Severity-based Traps / Alarms - - wrsAlarmCritical NOTIFICATION-TYPE - OBJECTS { - wrsAlarmActiveAlarmId, - wrsAlarmActiveEntityInstanceId, - wrsAlarmActiveDateAndTime, - wrsAlarmActiveAlarmSeverity, - wrsAlarmActiveReasonText, - wrsAlarmActiveEventType, - wrsAlarmActiveProbableCause, - wrsAlarmActiveProposedRepairAction, - wrsAlarmActiveServiceAffecting, - wrsAlarmActiveSuppressionAllowed - } - STATUS current - DESCRIPTION "This notification indicates that an alarm of 'Critical' severity - has been raised on the system. - The varbinds include details of the alarm." - ::= { wrsTrapPrefix 1 } - - - wrsAlarmMajor NOTIFICATION-TYPE - OBJECTS { - wrsAlarmActiveAlarmId, - wrsAlarmActiveEntityInstanceId, - wrsAlarmActiveDateAndTime, - wrsAlarmActiveAlarmSeverity, - wrsAlarmActiveReasonText, - wrsAlarmActiveEventType, - wrsAlarmActiveProbableCause, - wrsAlarmActiveProposedRepairAction, - wrsAlarmActiveServiceAffecting, - wrsAlarmActiveSuppressionAllowed - } - STATUS current - DESCRIPTION "This notification indicates that an alarm of 'Major' severity - has been raised on the system. - The varbinds include details of the alarm." - ::= { wrsTrapPrefix 2 } - - - wrsAlarmMinor NOTIFICATION-TYPE - OBJECTS { - wrsAlarmActiveAlarmId, - wrsAlarmActiveEntityInstanceId, - wrsAlarmActiveDateAndTime, - wrsAlarmActiveAlarmSeverity, - wrsAlarmActiveReasonText, - wrsAlarmActiveEventType, - wrsAlarmActiveProbableCause, - wrsAlarmActiveProposedRepairAction, - wrsAlarmActiveServiceAffecting, - wrsAlarmActiveSuppressionAllowed - } - STATUS current - DESCRIPTION "This notification indicates that an alarm of 'Minor' severity - has been raised on the system. - The varbinds include details of the alarm." - ::= { wrsTrapPrefix 3 } - - - wrsAlarmWarning NOTIFICATION-TYPE - OBJECTS { - wrsAlarmActiveAlarmId, - wrsAlarmActiveEntityInstanceId, - wrsAlarmActiveDateAndTime, - wrsAlarmActiveAlarmSeverity, - wrsAlarmActiveReasonText, - wrsAlarmActiveEventType, - wrsAlarmActiveProbableCause, - wrsAlarmActiveProposedRepairAction, - wrsAlarmActiveServiceAffecting, - wrsAlarmActiveSuppressionAllowed - } - STATUS current - DESCRIPTION "This notification indicates that an alarm of 'Warning' severity - has been raised on the system. - The varbinds include details of the alarm." - ::= { wrsTrapPrefix 4 } - - - wrsAlarmMessage NOTIFICATION-TYPE - OBJECTS { - wrsAlarmActiveAlarmId, - wrsAlarmActiveEntityInstanceId, - wrsAlarmActiveDateAndTime, - wrsAlarmActiveAlarmSeverity, - wrsAlarmActiveReasonText, - wrsAlarmActiveEventType, - wrsAlarmActiveProbableCause, - wrsAlarmActiveProposedRepairAction, - wrsAlarmActiveServiceAffecting, - wrsAlarmActiveSuppressionAllowed - } - STATUS current - DESCRIPTION "This notification indicates that a stateless message alarm - event has occurred on the system. - The varbinds include details of the alarm. - Note that these events are stored in the Customer Log Table." - ::= { wrsTrapPrefix 5 } - - - wrsAlarmClear NOTIFICATION-TYPE - OBJECTS { - wrsAlarmActiveAlarmId, - wrsAlarmActiveEntityInstanceId, - wrsAlarmActiveDateAndTime, - wrsAlarmActiveReasonText - } - STATUS current - DESCRIPTION "This notification indicates that a previously - reported alarm have been cleared. - The previously reported alarm is identified by the - { AlarmId, EntityInstanceId } tuple." - ::= { wrsTrapPrefix 9 } - - wrsAlarmHierarchicalClear NOTIFICATION-TYPE - OBJECTS { - wrsAlarmActiveEntityInstanceId, - wrsAlarmActiveDateAndTime, - wrsAlarmActiveReasonText - } - STATUS current - DESCRIPTION "This notification indicates that one or more previously - reported alarms have been cleared. - The previously reported alarms are identified by the - EntityInstanceId attribute. - ALL alarms against EntityInstanceId and all of its children - have been cleared." - ::= { wrsTrapPrefix 99 } - - - --- Notification group definitions - - wrsAlarmNotificationsGroup NOTIFICATION-GROUP - NOTIFICATIONS { - wrsAlarmClear, - wrsAlarmHierarchicalClear, - wrsAlarmMessage, - wrsAlarmWarning, - wrsAlarmMinor, - wrsAlarmMajor, - wrsAlarmCritical - } - STATUS current - DESCRIPTION "Wind River alarm notification group." - ::= { wrsAlarmGroups 1} - - wrsAlarmGroup OBJECT-GROUP - OBJECTS { - wrsAlarmActiveUuid, - wrsAlarmActiveAlarmId, - wrsAlarmActiveEntityInstanceId, - wrsAlarmActiveDateAndTime, - wrsAlarmActiveAlarmSeverity, - wrsAlarmActiveReasonText, - wrsAlarmActiveEventType, - wrsAlarmActiveProbableCause, - wrsAlarmActiveProposedRepairAction, - wrsAlarmActiveServiceAffecting, - wrsAlarmActiveSuppressionAllowed - } - STATUS current - DESCRIPTION "Wind River alarm group." - ::= { wrsAlarmGroups 2} - - - --- Compliance - - wrsAlarmCompliance MODULE-COMPLIANCE - STATUS current - DESCRIPTION "The compliance statement for entities which implement - the Wind River Alarm MIB." - MODULE -- this module - MANDATORY-GROUPS { wrsAlarmGroup - } - ::= { wrsAlarmCompliances 1} - - -END diff --git a/snmp-ext/sources/mibs/wrsEnterpriseReg.mib.txt b/snmp-ext/sources/mibs/wrsEnterpriseReg.mib.txt deleted file mode 100644 index f009cac1..00000000 --- a/snmp-ext/sources/mibs/wrsEnterpriseReg.mib.txt +++ /dev/null @@ -1,132 +0,0 @@ ------------------------------------------------------------------------------- --- --- File : wrsEnterpriseReg.mib --- Description : Wind River Enterprise Registration Hierarchy MIB --- Version : 1.2.0 --- Date : June 2, 2017 --- OBSOLETES : wrsMasterMib.mib v0.6 (August 29, 2000) --- --- Copyright (c) 2014-2017 Wind River Systems, Inc. All Rights Reserved. --- --- This module defines the Wind River Systems (WRS) registration hierarchy, --- --- The Wind River Systems registration tree is administered with the following --- hierarchy: --- iso(1).org(3).dod(6).internet(1).private(4).enterprise(1) --- .wrs(731) --- .wrs(731).wrsCommon(1) --- .wrs(731).wrsCommon(1).wrs(1-...) ... cont'd in wrsCommon.mib --- .wrs(731).wrs(2-...) ... cont'd in wrs.mib --- --- Reproduction of this document is authorized on condition that this --- copyright notice is included. This Wind River Enterprise Registration MIB --- embodies proprietary intellectual property of Wind River Systems (WRS). --- WRS retains all title and ownership in the specification, including any --- revisions. --- --- It is the intent of WRS to encourage the widespread use of this --- specification in connection with the management of Wind River products. --- WRS grants vendors, end-users, and other interested parties a --- non-exclusive license to use this specification in connection with the --- management of Wind River products. --- --- This specification is supplied "AS IS", and WRS makes no warranty, --- either express or implied, as to the use, operations, condition, --- or performance of this specification. --- ------------------------------------------------------------------------------- - -WRS-ENTERPRISE-REG-MIB DEFINITIONS ::= BEGIN - -IMPORTS - TEXTUAL-CONVENTION FROM SNMPv2-TC - MODULE-IDENTITY, enterprises FROM SNMPv2-SMI; - - wrs MODULE-IDENTITY - LAST-UPDATED "201407100000Z" -- July 10, 2014 - ORGANIZATION "Wind River Systems, Inc." - CONTACT-INFO "Wind River Systems, Inc. - 500 Wind River Way - Alameda, CA 94501, USA - Contact: Wind River Systems Support - E-mail : support@windriver.com - Phone : 510.748.4100" - DESCRIPTION "This module defines the Wind River Systems, Inc. Registration hierarchy." - - -- Revision history - REVISION "201407100000Z" -- July 10, 2014 - DESCRIPTION "Initial Version of MIB." - - ::= { enterprises 731 } - --- WRS Common Enterprise MIB Modules - wrsCommon OBJECT IDENTIFIER ::= { wrs 1 } - wrsAlarms OBJECT IDENTIFIER ::= { wrsCommon 1 } -- Common WRS Enterprise Alarm MIB - --- WRS Products --- tms1_0 OBJECT IDENTIFIER ::= { wrs 1 } Obsolete - tms OBJECT IDENTIFIER ::= { wrs 2 } - wrsTs OBJECT IDENTIFIER ::= { wrs 3 } -- WRS Titanium Cloud specific Enterprise MIBs - - - - - - ---------------------------------------------------------------------------- --- TMS OID Definitions --- - --- TMS Major MIB Categories - idb OBJECT IDENTIFIER ::= { tms 1 } -- IDB MIBs - tmsGeneric OBJECT IDENTIFIER ::= { tms 2 } -- TMS Generic MIBs - oemSwapi OBJECT IDENTIFIER ::= { tms 3 } -- OEM swAPI MIBs - oemProd OBJECT IDENTIFIER ::= { tms 4 } -- OEM Product MIBs - --- TMS IDB Internal Module MIBs - rmonMib OBJECT IDENTIFIER ::= { idb 1 } --- garpMib OBJECT IDENTIFIER ::= { idb 2 } SMIv2 --- stpMib OBJECT IDENTIFIER ::= { idb 3 } SMIv2 - --- TMS Generic MIBs --- tmsCommonMib OBJECT IDENTIFIER ::= { tmsGeneric 1 } SMIv2 --- tmsL3Mib OBJECT IDENTIFIER ::= { tmsGeneric 2 } SMIv2 - --- OEM swAPI MIBs --- pmSwapi OBJECT IDENTIFIER ::= { oemSwapi 1 } SMIv2 --- bcmSwapi OBJECT IDENTIFIER ::= { oemSwapi 2 } SMIv2 --- pcSwapi OBJECT IDENTIFIER ::= { oemSwapi 3 } SMIv2 - --- OEM Product MIBs --- pm3575 OBJECT IDENTIFIER ::= { oemProd 1 } SMIv2 --- bcm5600 OBJECT IDENTIFIER ::= { oemProd 2 } SMIv2 --- pcSwitch OBJECT IDENTIFIER ::= { oemProd 3 } SMIv2 - - - ---------------------------------------------------------------------------- --- General Textual Conventions --- - -WrsUUID ::= TEXTUAL-CONVENTION - STATUS current - DESCRIPTION "Universally Unique IDentifier; - format is typically XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX , - where X is a hex-digit." - SYNTAX OCTET STRING (SIZE (0..36)) - -WrsBoolean ::= TEXTUAL-CONVENTION - STATUS current - DESCRIPTION "Boolean type." - SYNTAX INTEGER - { - false (0), - true (1) - } - - --- --- END of WRS-ENTERPRISE-REG-MIB --- - -END From 4639f7dfff972f2b3e2cd61df11ebaf31afc89ee Mon Sep 17 00:00:00 2001 From: albailey Date: Wed, 18 Nov 2020 13:36:04 -0600 Subject: [PATCH 06/11] Add log and alarm support for vim orchestrated kube-upgrade Adds a Kubernetes Upgrade in progress alarm 900.007 Kubernetes auto apply upgrade alarms are 900.4xx series The new alarms are similar in numbering and wording as the firmware update auto apply 900.3xx series alarms and logs. Change-Id: Iab4fb79aebfd999ebc5f17c109371caf566671be Story: 2008137 Task: 41427 Signed-off-by: albailey --- fm-api/fm_api/constants.py | 19 +++++ fm-doc/fm_doc/events.yaml | 159 +++++++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+) diff --git a/fm-api/fm_api/constants.py b/fm-api/fm_api/constants.py index bb05ab0b..401baafa 100755 --- a/fm-api/fm_api/constants.py +++ b/fm-api/fm_api/constants.py @@ -288,6 +288,9 @@ FM_ALARM_ID_UPGRADE_IN_PROGRESS = ALARM_GROUP_SW_MGMT + ".005" # Device image alarm id FM_ALARM_ID_DEVICE_IMAGE_UPDATE_IN_PROGRESS = ALARM_GROUP_SW_MGMT + ".006" +# Kubernetes Upgrade alarm id +FM_ALARM_ID_KUBE_UPGRADE_IN_PROGRESS = ALARM_GROUP_SW_MGMT + ".007" + # Security log id FM_LOG_ID_INVALID_PASSWORD = ALARM_GROUP_SECURITY + ".001" FM_LOG_ID_USER_LOCKOUT = ALARM_GROUP_SECURITY + ".002" @@ -348,6 +351,22 @@ FM_LOG_ID_FW_UPDATE_AUTO_APPLY_ABORT_REJECTED = ALARM_GROUP_SW_MGMT + ".319" FM_LOG_ID_FW_UPDATE_AUTO_APPLY_ABORT_FAILED = ALARM_GROUP_SW_MGMT + ".320" FM_LOG_ID_FW_UPDATE_AUTO_APPLY_ABORTED = ALARM_GROUP_SW_MGMT + ".321" +FM_ALARM_ID_KUBE_UPGRADE_AUTO_APPLY_INPROGRESS = ALARM_GROUP_SW_MGMT + ".401" +FM_ALARM_ID_KUBE_UPGRADE_AUTO_APPLY_ABORTING = ALARM_GROUP_SW_MGMT + ".402" +FM_ALARM_ID_KUBE_UPGRADE_AUTO_APPLY_FAILED = ALARM_GROUP_SW_MGMT + ".403" + +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_START = ALARM_GROUP_SW_MGMT + ".411" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_INPROGRESS = ALARM_GROUP_SW_MGMT + ".412" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_REJECTED = ALARM_GROUP_SW_MGMT + ".413" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_CANCELLED = ALARM_GROUP_SW_MGMT + ".414" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_FAILED = ALARM_GROUP_SW_MGMT + ".415" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_COMPLETED = ALARM_GROUP_SW_MGMT + ".416" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_ABORT = ALARM_GROUP_SW_MGMT + ".417" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_ABORTING = ALARM_GROUP_SW_MGMT + ".418" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_ABORT_REJECTED = ALARM_GROUP_SW_MGMT + ".419" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_ABORT_FAILED = ALARM_GROUP_SW_MGMT + ".420" +FM_LOG_ID_KUBE_UPGRADE_AUTO_APPLY_ABORTED = ALARM_GROUP_SW_MGMT + ".421" + FM_ALARM_STATE_SET = 'set' FM_ALARM_STATE_CLEAR = 'clear' FM_ALARM_STATE_MSG = 'msg' diff --git a/fm-doc/fm_doc/events.yaml b/fm-doc/fm_doc/events.yaml index f1e6c62f..7bca5174 100755 --- a/fm-doc/fm_doc/events.yaml +++ b/fm-doc/fm_doc/events.yaml @@ -3071,6 +3071,21 @@ Management_Affecting_Severity: warning Degrade_Affecting_Severity: none +900.007: + Type: Alarm + Description: Kubernetes upgrade in progress. + Entity_Instance_ID: host=controller + Severity: minor + Proposed_Repair_Action: No action required. + Maintenance_Action: + Inhibit_Alarms: + Alarm_Type: operational-violation + Probable_Cause: unspecified-reason + Service_Affecting: False + Suppression: False + Management_Affecting_Severity: warning + Degrade_Affecting_Severity: none + 900.101: Type: Alarm Description: Software patch auto-apply inprogress @@ -3502,4 +3517,148 @@ Alarm_Type: equipment Probable_Cause: unspecified-reason Service_Affecting: False + +900.401: + Type: Alarm + Description: Kubernetes upgrade auto-apply inprogress + Entity_Instance_ID: orchestration=kube-upgrade + Severity: major + Proposed_Repair_Action: Wait for kubernetes upgrade auto-apply to complete; if problem persists contact next level of support + Maintenance_Action: + Inhibit_Alarms: + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: True + Suppression: True + Management_Affecting_Severity: warning + Degrade_Affecting_Severity: none + +900.402: + Type: Alarm + Description: Kubernetes upgrade auto-apply aborting + Entity_Instance_ID: orchestration=kube-upgrade + Severity: major + Proposed_Repair_Action: Wait for kubernetes upgrade auto-apply abort to complete; if problem persists contact next level of support + Maintenance_Action: + Inhibit_Alarms: + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: True + Suppression: True + Management_Affecting_Severity: warning + Degrade_Affecting_Severity: none + +900.403: + Type: Alarm + Description: Kubernetes upgrade auto-apply failed + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Proposed_Repair_Action: Attempt to apply kubernetes upgrade manually; if problem persists contact next level of support + Maintenance_Action: + Inhibit_Alarms: + Alarm_Type: equipment + Probable_Cause: underlying-resource-unavailable + Service_Affecting: True + Suppression: True + Management_Affecting_Severity: warning + Degrade_Affecting_Severity: none + +900.411: + Type: Log + Description: Kubernetes upgrade auto-apply start + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.412: + Type: Log + Description: Kubernetes upgrade auto-apply inprogress + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.413: + Type: Log + Description: Kubernetes upgrade auto-apply rejected + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.414: + Type: Log + Description: Kubernetes upgrade auto-apply cancelled + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.415: + Type: Log + Description: Kubernetes upgrade auto-apply failed + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.416: + Type: Log + Description: Kubernetes upgrade auto-apply completed + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.417: + Type: Log + Description: Kubernetes upgrade auto-apply abort + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.418: + Type: Log + Description: Kubernetes upgrade auto-apply aborting + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.419: + Type: Log + Description: Kubernetes upgrade auto-apply abort rejected + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.420: + Type: Log + Description: Kubernetes upgrade auto-apply abort failed + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False + +900.421: + Type: Log + Description: Kubernetes upgrade auto-apply aborted + Entity_Instance_ID: orchestration=kube-upgrade + Severity: critical + Alarm_Type: equipment + Probable_Cause: unspecified-reason + Service_Affecting: False ... From 63fcc33bbca0bc07719c070a8fa7c2a3d3f084b9 Mon Sep 17 00:00:00 2001 From: Enzo Candotti Date: Thu, 1 Apr 2021 11:37:45 -0300 Subject: [PATCH 07/11] Update events.yaml with DM-Monitor alarms Add a new alarm definition under the 260.001 id, created when resources reconciled status were false. Closes-Bug: 1922238 Signed-off-by: Enzo Candotti Change-Id: I96c05aaaf914bb253f7a71a7bfc79924c8da7857 --- fm-doc/fm_doc/events.yaml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/fm-doc/fm_doc/events.yaml b/fm-doc/fm_doc/events.yaml index 7bca5174..657021ff 100755 --- a/fm-doc/fm_doc/events.yaml +++ b/fm-doc/fm_doc/events.yaml @@ -1,7 +1,7 @@ --- # -# Copyright (c) 2013-2020 Wind River Systems, Inc. +# Copyright (c) 2013-2021 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -845,6 +845,23 @@ Management_Affecting_Severity: warning Degrade_Affecting_Severity: none +#--------------------------------------------------------------------------- +# Deployment Manager Monitor +#--------------------------------------------------------------------------- +260.001: + Type: Alarm + Description: "Deployment Manager resource not reconciled: " + Entity_Instance_ID: resource=,name= + Severity: major + Proposed_Repair_Action: Monitor and if condition persists, validate deployment configuration. + Maintenance_Action: + Inhibit_Alarms: + Alarm_Type: operational-violation + Probable_Cause: configuration-out-of-date + Service_Affecting: True + Suppression: True + Management_Affecting_Severity: warning + Degrade_Affecting_Severity: none #--------------------------------------------------------------------------- # VM Compute Services From 581495082a5a0a9456065b3d3bb8b5f015747fd8 Mon Sep 17 00:00:00 2001 From: Eric MacDonald Date: Tue, 6 Apr 2021 09:02:39 -0400 Subject: [PATCH 08/11] Make small modification to fm's logrotation configuration file This update makes the following changes to the fm logrotation config file - add 'create' with permissions to each tuple - add 'delaycompress' as a local setting to each log entry - remove 'nodateext' global and local setting Test Plan: PASS: Verify fm logs rotation behavior PASS: Verify fm logs delaycompress setting behavior PASS: Verify log permissions after rotate Change-Id: Ibe8bd8107501df947b5091e928de202378ef4ea8 Partial-Bug: 1918979 Depends-On: https://review.opendev.org/c/starlingx/config-files/+/784943 Signed-off-by: Eric MacDonald --- fm-mgr/sources/fm.logrotate | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fm-mgr/sources/fm.logrotate b/fm-mgr/sources/fm.logrotate index 486f3806..99d6714b 100644 --- a/fm-mgr/sources/fm.logrotate +++ b/fm-mgr/sources/fm.logrotate @@ -3,25 +3,25 @@ # # SPDX-License-Identifier: Apache-2.0 # -nodateext /var/log/fm-event.log { - nodateext + create 0640 root root size 100M start 1 - missingok rotate 20 + missingok compress sharedscripts postrotate systemctl reload syslog-ng > /dev/null 2>&1 || true - endscript + endscript + delaycompress } /var/log/fm-manager.log { - nodateext + create 0600 root root size 10M start 1 rotate 20 @@ -32,4 +32,5 @@ nodateext postrotate systemctl reload syslog-ng > /dev/null 2>&1 || true endscript + delaycompress } From 03090ca2bb77edb8a01c9a08a716aa3d1a5f4595 Mon Sep 17 00:00:00 2001 From: Charles Short Date: Mon, 26 Apr 2021 10:50:20 -0400 Subject: [PATCH 09/11] Fix pep8 gate failures Set hacking to < 4.0.1 in test-requirements.txt so that the pep8 gate passes again. Test: Ran tox -e pep8 command to validate the flake8 job and result. Related-Bug: 1926172 Signed-off-by: Charles Short Change-Id: I5b27a89d0e078912814ca2999bf28e6602980fd0 --- test-requirements.txt | 2 +- tox.ini | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 7edf7389..891aec20 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -hacking +hacking<4.0.1 bashate >= 0.2 mock PyYAML >= 3.1.0 diff --git a/tox.ini b/tox.ini index 862ec5d1..baaf4cbe 100644 --- a/tox.ini +++ b/tox.ini @@ -73,8 +73,6 @@ commands = pylint {posargs} --rcfile=./pylint.rc \ basepython = python3 description = Run style checks. -deps = - hacking commands = flake8 From a64e88bf43012d5558826442b98b26847370eeb3 Mon Sep 17 00:00:00 2001 From: Jerry Sun Date: Tue, 4 May 2021 15:46:52 -0400 Subject: [PATCH 10/11] Better repair action for alarm 100.104 This commit adds a better proposed repair action for filesystem threshold alarm 100.104. Closes-Bug: 1927155 Signed-off-by: Jerry Sun Change-Id: Id2d1d4c23d343455d1f0c2e359cf380cc23229cd --- fm-doc/fm_doc/events.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fm-doc/fm_doc/events.yaml b/fm-doc/fm_doc/events.yaml index 7bca5174..b859374a 100755 --- a/fm-doc/fm_doc/events.yaml +++ b/fm-doc/fm_doc/events.yaml @@ -170,7 +170,7 @@ OR host=.volumegroup= Severity: [critical, major] - Proposed_Repair_Action: "Monitor and if condition persists, contact next level of support." + Proposed_Repair_Action: "Reduce usage or resize filesystem." Maintenance_Action: critical: degrade major: degrade From 3280e6cd5b28809b51ea45e369c069f76f165c44 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Linhares Date: Thu, 6 May 2021 18:41:57 -0300 Subject: [PATCH 11/11] Adding Kubernetes alarm type for PV migration errors during AIO-SX to AIO-DX This commit adds a new alarm type for Kubernetes Persistent Volume patching errors during AIO-SX to AIO-DX migration. Partial-Bug: 1927224 Signed-off-by: Pedro Henrique Linhares Change-Id: I8f64280394999249c829372d1748a9c26fdb9ced --- fm-api/fm_api/constants.py | 7 +++++-- fm-doc/fm_doc/events.yaml | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/fm-api/fm_api/constants.py b/fm-api/fm_api/constants.py index 401baafa..02e94a9c 100755 --- a/fm-api/fm_api/constants.py +++ b/fm-api/fm_api/constants.py @@ -33,7 +33,7 @@ FM_ENTITY_TYPE_INSTANCE = 'instance' FM_ENTITY_TYPE_CLUSTER = 'cluster' FM_ENTITY_TYPE_NTP = 'ntp' FM_ENTITY_TYPE_ML2DRIVER = 'ml2driver' -FM_ENTITY_TYPE_PV = 'pv' +FM_ENTITY_TYPE_K8S = 'kubernetes' FM_ENTITY_TYPE_BGP_PEER = "bgp-peer" FM_ENTITY_TYPE_STORAGE_BACKEND = 'storage_backend' FM_ENTITY_TYPE_IMAGE_CONVERSION = 'fs_name' @@ -60,6 +60,7 @@ ALARM_GROUP_LICENSING = "600" ALARM_GROUP_VM = "700" ALARM_GROUP_APPLICATION = "750" ALARM_GROUP_STORAGE = "800" +ALARM_GROUP_K8S = "850" ALARM_GROUP_SW_MGMT = "900" # General Alarm id @@ -104,10 +105,12 @@ FM_ALARM_ID_STORAGE_IMAGE = ALARM_GROUP_STORAGE + ".002" FM_ALARM_ID_STORAGE_CEPH_FREE_SPACE = ALARM_GROUP_STORAGE + ".003" FM_ALARM_ID_STORAGE_CINDER_IO_BUILDING = ALARM_GROUP_STORAGE + ".100" FM_ALARM_ID_STORAGE_CINDER_IO_LIMITING = ALARM_GROUP_STORAGE + ".101" -FM_ALARM_ID_STORAGE_PV_FAILED = ALARM_GROUP_STORAGE + ".102" # Alarm .103 is reserved for LVM thin pool metadata alarm FM_ALARM_ID_STORAGE_BACKEND_FAILED = ALARM_GROUP_STORAGE + ".104" +# Kubernetes Resource Alarms +FM_ALARM_ID_K8S_RESOURCE_PV = ALARM_GROUP_K8S + ".001" + # Host-Services alarm id FM_ALARM_ID_HOST_SERVICES_FAILED = ALARM_GROUP_HOST_SERVICES + ".001" diff --git a/fm-doc/fm_doc/events.yaml b/fm-doc/fm_doc/events.yaml index 073e1953..9431089b 100755 --- a/fm-doc/fm_doc/events.yaml +++ b/fm-doc/fm_doc/events.yaml @@ -2993,6 +2993,27 @@ Management_Affecting_Severity: major Degrade_Affecting_Severity: none +#--------------------------------------------------------------------------- +# KUBERNETES +#--------------------------------------------------------------------------- + +850.001: + Type: Alarm + Description: Persistent Volume Migration Error + Entity_Instance_ID: kubernetes=PV-migration-failed + Severity: major + Proposed_Repair_Action: "Manually execute /usr/bin/ceph_k8s_update_monitors.sh + to confirm PVs are updated, then lock/unlock to clear + alarms. If problem persists, contact next level of + support." + Maintenance_Action: + Inhibit_Alarms: + Alarm_Type: processing-error + Probable_Cause: communication-subsystem-failure + Service_Affecting: False + Suppression: False + Management_Affecting_Severity: none + Degrade_Affecting_Severity: none #--------------------------------------------------------------------------- # SOFTWARE