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

View File

@ -1850,6 +1850,20 @@ mgcpGatewayUp OBJECT-TYPE
-- mgcpAlarms END -- 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 -- alarms END

View File

@ -1282,6 +1282,14 @@ name=mgcpGatewayUp
access=accessible-for-notify access=accessible-for-notify
type=DisplayString 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] [1.3.6.1.4.1.34501.1.9]
name=commands name=commands