Changeset 191
- Timestamp:
- 03/29/10 10:43:21 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/Alarm.cc
r181 r191 38 38 char *AlarmSummary; 39 39 int MasterAlarm; 40 int *State; 40 int *State; 41 bool *Warned; 41 42 char **Server; 42 43 unsigned int NumServers; … … 73 74 StatusService = new DimStampedInfo* [NumServers]; 74 75 State = new int [NumServers]; 75 76 Warned = new bool [NumServers]; 77 76 78 for (int i=0; i<NumServers; i++) { 77 79 char *Buffer = new char [strlen(Server[i])+10]; … … 158 160 if (strcmp(ServerName, Alarm.Server[i]) == 0) Exists = true; 159 161 } 160 if (!Exists) Alarm.State[i] = 4; 162 163 if (Exists) { 164 Alarm.Warned[i] = false; 165 continue; 166 } 167 168 Alarm.State[i] = 4; 169 170 // If server unavailable, send alarm message once 171 if (Alarm.Warned[i] == false) { 172 Alarm.Warned[i] = true; 173 char *Message; 174 time_t Time = time(NULL); 175 if (asprintf(&Message, "echo \"Server unavailable at %s\"|mail -s \"Evidence Alarm for '%s'\" %s", ctime(&Time), Alarm.Server[i], Alarm.GetConfig("email","")) != -1) { 176 system(Message); 177 free(Message); 178 } 179 } 161 180 } 162 181
Note:
See TracChangeset
for help on using the changeset viewer.