本文整理汇总了C++中Oam::checkActiveAlarm方法的典型用法代码示例。如果您正苦于以下问题:C++ Oam::checkActiveAlarm方法的具体用法?C++ Oam::checkActiveAlarm怎么用?C++ Oam::checkActiveAlarm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oam
的用法示例。
在下文中一共展示了Oam::checkActiveAlarm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendAlarm
/******************************************************************************************
* @brief sendAlarm
*
* purpose: send a trap and log the process information
*
******************************************************************************************/
void ServerMonitor::sendAlarm(string alarmItem, ALARMS alarmID, int action, float sensorValue)
{
ServerMonitor serverMonitor;
Oam oam;
//Log this event
LoggingID lid(SERVER_MONITOR_LOG_ID);
MessageLog ml(lid);
Message msg;
Message::Args args;
args.add(alarmItem);
args.add(", sensor value out-of-range: ");
args.add(sensorValue);
// get current server name
string moduleName;
oamModuleInfo_t st;
try {
st = oam.getModuleInfo();
moduleName = boost::get<0>(st);
}
catch (...) {
moduleName = "Unknown Server";
}
// check if there is an active alarm above the reporting theshold
// that needs to be cleared
serverMonitor.checkAlarm(alarmItem, alarmID);
// check if Alarm is already active, don't resend
if ( !( oam.checkActiveAlarm(alarmID, moduleName, alarmItem)) ) {
SNMPManager alarmMgr;
// send alarm
alarmMgr.sendAlarmReport(alarmItem.c_str(), alarmID, action);
args.add(", Alarm set: ");
args.add(alarmID);
}
// output log
msg.format(args);
ml.logWarningMessage(msg);
return;
}
示例2: checkDiskAlarm
/******************************************************************************************
* @brief checkDiskAlarm
*
* purpose: check to see if an alarm(s) is set on Disk and clear if so
*
******************************************************************************************/
void ServerMonitor::checkDiskAlarm(string alarmItem, ALARMS alarmID)
{
Oam oam;
ServerMonitor serverMonitor;
// get current server name
string serverName;
oamModuleInfo_t st;
try {
st = oam.getModuleInfo();
serverName = boost::get<0>(st);
}
catch (...) {
serverName = "Unknown Server";
}
switch (alarmID) {
case NO_ALARM: // clear all alarms set if any found
if ( oam.checkActiveAlarm(DISK_USAGE_HIGH, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, DISK_USAGE_HIGH);
if ( oam.checkActiveAlarm(DISK_USAGE_MED, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, DISK_USAGE_MED);
if ( oam.checkActiveAlarm(DISK_USAGE_LOW, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, DISK_USAGE_LOW);
break;
case DISK_USAGE_LOW: // clear high and medium alarms set if any found
if ( oam.checkActiveAlarm(DISK_USAGE_HIGH, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, DISK_USAGE_HIGH);
if ( oam.checkActiveAlarm(DISK_USAGE_MED, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, DISK_USAGE_MED);
break;
case DISK_USAGE_MED: // clear high alarms set if any found
if ( oam.checkActiveAlarm(DISK_USAGE_HIGH, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, DISK_USAGE_HIGH);
break;
default: // none to clear
break;
} // end of switch
return;
}
示例3: checkAlarm
/******************************************************************************************
* @brief checkAlarm
*
* purpose: check to see if an alarm(s) is set on device and clear if so
*
******************************************************************************************/
void checkAlarm(string alarmItem, ALARMS alarmID)
{
Oam oam;
// get current server name
string serverName;
oamServerInfo_t st;
try {
st = oam.getServerInfo();
serverName = boost::get<0>(st);
}
catch (...) {
serverName = "Unknown Server";
}
switch (alarmID) {
case ALARM_NONE: // clear all alarms set if any found
if ( oam.checkActiveAlarm(HARDWARE_HIGH, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, HARDWARE_HIGH);
if ( oam.checkActiveAlarm(HARDWARE_MED, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, HARDWARE_MED);
if ( oam.checkActiveAlarm(HARDWARE_LOW, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, HARDWARE_LOW);
break;
case HARDWARE_LOW: // clear high and medium alarms set if any found
if ( oam.checkActiveAlarm(HARDWARE_HIGH, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, HARDWARE_HIGH);
if ( oam.checkActiveAlarm(HARDWARE_MED, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, HARDWARE_MED);
break;
case HARDWARE_MED: // clear high alarms set if any found
if ( oam.checkActiveAlarm(HARDWARE_HIGH, serverName, alarmItem) )
// alarm set, clear it
clearAlarm(alarmItem, HARDWARE_HIGH);
break;
default: // none to clear
break;
} // end of switch
return;
}
示例4: sendResourceAlarm
/******************************************************************************************
* @brief sendResourceAlarm
*
* purpose: send a trap and log the process information
*
******************************************************************************************/
bool ServerMonitor::sendResourceAlarm(string alarmItem, ALARMS alarmID, int action, int usage)
{
ServerMonitor serverMonitor;
Oam oam;
//Log this event
LoggingID lid(SERVER_MONITOR_LOG_ID);
MessageLog ml(lid);
Message msg;
Message::Args args;
args.add(alarmItem);
args.add(" usage at percentage of ");
args.add(usage);
// get current module name
string moduleName;
oamModuleInfo_t st;
try {
st = oam.getModuleInfo();
moduleName = boost::get<0>(st);
}
catch (...) {
moduleName = "Unknown Server";
}
// check if there is an active alarm above the reporting theshold
// that needs to be cleared
if (alarmItem == "CPU")
serverMonitor.checkCPUAlarm(alarmItem, alarmID);
else if (alarmItem == "Local Disk" || alarmItem == "External")
serverMonitor.checkDiskAlarm(alarmItem, alarmID);
else if (alarmItem == "Local Memory")
serverMonitor.checkMemoryAlarm(alarmItem, alarmID);
else if (alarmItem == "Local Swap")
serverMonitor.checkSwapAlarm(alarmItem, alarmID);
// don't issue an alarm on thge dbroots is already issued by this or another server
if ( alarmItem.find(startup::StartUp::installDir() + "/data") == 0 ) {
// check if Alarm is already active from any module, don't resend
if ( !( oam.checkActiveAlarm(alarmID, "*", alarmItem)) ) {
SNMPManager alarmMgr;
// send alarm
alarmMgr.sendAlarmReport(alarmItem.c_str(), alarmID, action);
args.add(", Alarm set: ");
args.add(alarmID);
msg.format(args);
ml.logInfoMessage(msg);
return true;
}
else
return false;
}
else
{
// check if Alarm is already active from this module, don't resend
if ( !( oam.checkActiveAlarm(alarmID, moduleName, alarmItem)) ) {
SNMPManager alarmMgr;
// send alarm
alarmMgr.sendAlarmReport(alarmItem.c_str(), alarmID, action);
args.add(", Alarm set: ");
args.add(alarmID);
msg.format(args);
ml.logInfoMessage(msg);
return true;
}
else
return false;
}
return true;
}