When forcing an alarm, print out the event id
This commit is contained in:
parent
251ccc0ba9
commit
8404f0ef64
13
src/zmu.cpp
13
src/zmu.cpp
|
@ -463,10 +463,10 @@ int main(int argc, char *argv[]) {
|
|||
} // end if auth
|
||||
|
||||
if ( mon_id > 0 ) {
|
||||
fprintf(stderr,"Monitor %d\n", mon_id);
|
||||
//fprintf(stderr,"Monitor %d\n", mon_id);
|
||||
Monitor *monitor = Monitor::Load(mon_id, function&(ZMU_QUERY|ZMU_ZONES), Monitor::QUERY);
|
||||
if ( monitor ) {
|
||||
fprintf(stderr,"Monitor %d(%s)\n", monitor->Id(), monitor->Name());
|
||||
//fprintf(stderr,"Monitor %d(%s)\n", monitor->Id(), monitor->Name());
|
||||
if ( verbose ) {
|
||||
printf("Monitor %d(%s)\n", monitor->Id(), monitor->Name());
|
||||
}
|
||||
|
@ -479,9 +479,9 @@ int main(int argc, char *argv[]) {
|
|||
bool have_output = false;
|
||||
if ( function & ZMU_STATE ) {
|
||||
Monitor::State state = monitor->GetState();
|
||||
if ( verbose )
|
||||
if ( verbose ) {
|
||||
printf("Current state: %s\n", state==Monitor::ALARM?"Alarm":(state==Monitor::ALERT?"Alert":"Idle"));
|
||||
else {
|
||||
} else {
|
||||
if ( have_output ) printf("%c", separator);
|
||||
printf("%d", state);
|
||||
have_output = true;
|
||||
|
@ -560,6 +560,11 @@ int main(int argc, char *argv[]) {
|
|||
if ( verbose )
|
||||
printf( "Forcing alarm on\n" );
|
||||
monitor->ForceAlarmOn( config.forced_alarm_score, "Forced Web" );
|
||||
while ( monitor->GetState() != Monitor::ALARM ) {
|
||||
// Wait for monitor to notice.
|
||||
usleep(1000);
|
||||
}
|
||||
printf( "Alarmed event id: %" PRIu64 "\n", monitor->GetLastEventId() );
|
||||
}
|
||||
if ( function & ZMU_NOALARM ) {
|
||||
if ( verbose )
|
||||
|
|
Loading…
Reference in New Issue