Added trap for unexpected restart.

git-svn-id: http://voip.null.ro/svn/yate@5384 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
andrei 2013-01-25 15:42:52 +00:00
parent 33d89afa04
commit 269ad3f190
3 changed files with 45 additions and 13 deletions

View File

@ -327,6 +327,7 @@ public:
ENGINE_NODENAME = 12,
ENGINE_STATE = 13,
ENGINE_CALL_ACCEPT = 14,
ENGINE_UNEX_RESTART = 15,
};
// Constructor
inline EngineInfo()
@ -1063,6 +1064,7 @@ static TokenDict s_categories[] = {
{"semaphores", Monitor::ENGINE},
{"waitingSemaphores", Monitor::ENGINE},
{"acceptStatus", Monitor::ENGINE},
{"unexpectedRestart", Monitor::ENGINE},
// node info
{"runAttempt", Monitor::ENGINE},
{"name", Monitor::ENGINE},
@ -1242,23 +1244,25 @@ static TokenDict s_engineQuery[] = {
{"runAttempt", EngineInfo::ENGINE_RUNATTEMPT},
{"name", EngineInfo::ENGINE_NODENAME},
{"state", EngineInfo::ENGINE_STATE},
{"unexpectedRestart", EngineInfo::ENGINE_UNEX_RESTART},
{0,0}
};
TokenDict EngineInfo::s_engineInfo[] = {
{"type", EngineInfo::ENGINE_TYPE},
{"plugins", EngineInfo::ENGINE_PLUGINS},
{"handlers", EngineInfo::ENGINE_HANDLERS},
{"messages", EngineInfo::ENGINE_MESSAGES},
{"threads", EngineInfo::ENGINE_THREADS},
{"workers", EngineInfo::ENGINE_WORKERS},
{"mutexes", EngineInfo::ENGINE_MUTEXES},
{"locks", EngineInfo::ENGINE_LOCKS},
{"semaphores", EngineInfo::ENGINE_SEMAPHORES},
{"waiting", EngineInfo::ENGINE_WAITING},
{"runattempt", EngineInfo::ENGINE_RUNATTEMPT},
{"nodename", EngineInfo::ENGINE_NODENAME},
{"acceptcalls", EngineInfo::ENGINE_CALL_ACCEPT},
{"type", EngineInfo::ENGINE_TYPE},
{"plugins", EngineInfo::ENGINE_PLUGINS},
{"handlers", EngineInfo::ENGINE_HANDLERS},
{"messages", EngineInfo::ENGINE_MESSAGES},
{"threads", EngineInfo::ENGINE_THREADS},
{"workers", EngineInfo::ENGINE_WORKERS},
{"mutexes", EngineInfo::ENGINE_MUTEXES},
{"locks", EngineInfo::ENGINE_LOCKS},
{"semaphores", EngineInfo::ENGINE_SEMAPHORES},
{"waiting", EngineInfo::ENGINE_WAITING},
{"runattempt", EngineInfo::ENGINE_RUNATTEMPT},
{"nodename", EngineInfo::ENGINE_NODENAME},
{"acceptcalls", EngineInfo::ENGINE_CALL_ACCEPT},
{"lastsignal", EngineInfo::ENGINE_UNEX_RESTART},
{0,0}
};
@ -1619,6 +1623,12 @@ bool EngineStartHandler::received(Message& msg)
if (!notif.null())
__plugin.sendTrap(notif,String(s_yateRun));
}
int lastsignal = Engine::runParams().getIntValue(YSTRING("lastsignal"),0);
if (lastsignal >= 0) {
String notif = lookup(EngineInfo::ENGINE_UNEX_RESTART,s_engineQuery,"");
if (!notif.null())
__plugin.sendTrap(notif,String(lastsignal));
}
return false;
};

View File

@ -1850,6 +1850,20 @@ mgcpGatewayUp OBJECT-TYPE
-- mgcpAlarms END
-- engineAlarms BEGIN
engineAlarms OBJECT IDENTIFIER ::= { alarms 6 }
unexpectedRestart OBJECT-TYPE
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Signal code that caused last YATE restart."
::= { engineAlarms 1 }
-- engineAlarms END
-- alarms END

View File

@ -1282,6 +1282,14 @@ name=mgcpGatewayUp
access=accessible-for-notify
type=DisplayString
[1.3.6.1.4.1.34501.1.8.6]
name=engineAlarms
[1.3.6.1.4.1.34501.1.8.6.1]
name=unexpectedRestart
access=read-only
type=Counter32
[1.3.6.1.4.1.34501.1.9]
name=commands