[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[monit-dev] [monit] r235 committed - event type consolidation
From: |
monit |
Subject: |
[monit-dev] [monit] r235 committed - event type consolidation |
Date: |
Mon, 06 Sep 2010 12:49:43 +0000 |
Revision: 235
Author: martin2812
Date: Mon Sep 6 05:48:55 2010
Log: event type consolidation
http://code.google.com/p/monit/source/detail?r=235
Modified:
/trunk/CHANGES.txt
/trunk/control.c
/trunk/event.c
/trunk/event.h
/trunk/http/cervlet.c
/trunk/monitor.c
/trunk/monitor.h
/trunk/p.y
/trunk/util.c
/trunk/validate.c
/trunk/xml.c
=======================================
--- /trunk/CHANGES.txt Wed Aug 25 12:43:56 2010
+++ /trunk/CHANGES.txt Mon Sep 6 05:48:55 2010
@@ -399,7 +399,7 @@
override option is:
set mailserver foo.bar.baz using hostname "my.monit.host"
-* A new EVENT_ACTION type was added which reports actions
+* A new Event_Action type was added which reports actions
performed on Monit's administrator request (either via web
interface or CLI). If you don't want to received these events,
you can set the mail-filter for "action" event type.
=======================================
--- /trunk/control.c Mon Jul 26 12:10:25 2010
+++ /trunk/control.c Mon Sep 6 05:48:55 2010
@@ -473,9 +473,9 @@
}
if (!Util_isProcessRunning(s))
- Event_post(s, EVENT_EXEC, STATE_FAILED, s->action_EXEC, "failed to
start");
+ Event_post(s, Event_Exec, STATE_FAILED, s->action_EXEC, "failed to
start");
else
- Event_post(s, EVENT_EXEC, STATE_SUCCEEDED, s->action_EXEC, "started");
+ Event_post(s, Event_Exec, STATE_SUCCEEDED, s->action_EXEC, "started");
return;
}
@@ -502,10 +502,10 @@
}
if (Util_isProcessRunning(s)) {
- Event_post(s, EVENT_EXEC, STATE_FAILED, s->action_EXEC, "failed to
stop");
+ Event_post(s, Event_Exec, STATE_FAILED, s->action_EXEC, "failed to
stop");
return FALSE;
} else {
- Event_post(s, EVENT_EXEC, STATE_SUCCEEDED, s->action_EXEC, "stopped");
+ Event_post(s, Event_Exec, STATE_SUCCEEDED, s->action_EXEC, "stopped");
}
return TRUE;
=======================================
--- /trunk/event.c Fri Jul 30 13:55:29 2010
+++ /trunk/event.c Mon Sep 6 05:48:55 2010
@@ -80,29 +80,29 @@
/* -------------------------------------------------------------
Definitions */
EventTable_T Event_Table[]= {
- {EVENT_ACTION, "Action done", "Action
done", "Action done", "Action done"},
- {EVENT_CHECKSUM, "Checksum failed", "Checksum
succeeded", "Checksum changed", "Checksum not changed"},
- {EVENT_CONNECTION, "Connection failed", "Connection
succeeded", "Connection changed", "Connection not changed"},
- {EVENT_CONTENT, "Content failed", "Content
succeeded", "Content match", "Content doesn't match"},
- {EVENT_DATA, "Data access error", "Data access
succeeded", "Data access changed", "Data access not changed"},
- {EVENT_EXEC, "Execution failed", "Execution
succeeded", "Execution changed", "Execution not changed"},
- {EVENT_FSFLAG, "Filesystem flags failed", "Filesystem flags
succeeded", "Filesystem flags changed", "Filesystem flags not changed"},
- {EVENT_GID, "GID failed", "GID
succeeded", "GID changed", "GID not changed"},
- {EVENT_HEARTBEAT, "Heartbeat failed", "Heartbeat
succeeded", "Heartbeat changed", "Heartbeat not changed"},
- {EVENT_ICMP, "ICMP failed", "ICMP
succeeded", "ICMP changed", "ICMP not changed"},
- {EVENT_INSTANCE, "Monit instance failed", "Monit instance
succeeded", "Monit instance changed", "Monit instance not changed"},
- {EVENT_INVALID, "Invalid type", "Type
succeeded", "Type changed", "Type not changed"},
- {EVENT_NONEXIST, "Does not
exist", "Exists", "Existence
changed", "Existence not changed"},
- {EVENT_PERMISSION, "Permission failed", "Permission
succeeded", "Permission changed", "Permission not changed"},
- {EVENT_PID, "PID failed", "PID
succeeded", "PID changed", "PID not changed"},
- {EVENT_PPID, "PPID failed", "PPID
succeeded", "PPID changed", "PPID not changed"},
- {EVENT_RESOURCE, "Resource limit matched", "Resource limit
succeeded", "Resource limit changed", "Resource limit not changed"},
- {EVENT_SIZE, "Size failed", "Size
succeeded", "Size changed", "Size not changed"},
- {EVENT_TIMEOUT, "Timeout", "Timeout
recovery", "Timeout changed", "Timeout not changed"},
- {EVENT_TIMESTAMP, "Timestamp failed", "Timestamp
succeeded", "Timestamp changed", "Timestamp not changed"},
- {EVENT_UID, "UID failed", "UID
succeeded", "UID changed", "UID not changed"},
+ {Event_Action, "Action done", "Action
done", "Action done", "Action done"},
+ {Event_Checksum, "Checksum failed", "Checksum
succeeded", "Checksum changed", "Checksum not changed"},
+ {Event_Connection, "Connection failed", "Connection
succeeded", "Connection changed", "Connection not changed"},
+ {Event_Content, "Content failed", "Content
succeeded", "Content match", "Content doesn't match"},
+ {Event_Data, "Data access error", "Data access
succeeded", "Data access changed", "Data access not changed"},
+ {Event_Exec, "Execution failed", "Execution
succeeded", "Execution changed", "Execution not changed"},
+ {Event_Fsflag, "Filesystem flags failed", "Filesystem flags
succeeded", "Filesystem flags changed", "Filesystem flags not changed"},
+ {Event_Gid, "GID failed", "GID
succeeded", "GID changed", "GID not changed"},
+ {Event_Heartbeat, "Heartbeat failed", "Heartbeat
succeeded", "Heartbeat changed", "Heartbeat not changed"},
+ {Event_Icmp, "ICMP failed", "ICMP
succeeded", "ICMP changed", "ICMP not changed"},
+ {Event_Instance, "Monit instance failed", "Monit instance
succeeded", "Monit instance changed", "Monit instance not changed"},
+ {Event_Invalid, "Invalid type", "Type
succeeded", "Type changed", "Type not changed"},
+ {Event_Nonexist, "Does not
exist", "Exists", "Existence
changed", "Existence not changed"},
+ {Event_Permission, "Permission failed", "Permission
succeeded", "Permission changed", "Permission not changed"},
+ {Event_Pid, "PID failed", "PID
succeeded", "PID changed", "PID not changed"},
+ {Event_PPid, "PPID failed", "PPID
succeeded", "PPID changed", "PPID not changed"},
+ {Event_Resource, "Resource limit matched", "Resource limit
succeeded", "Resource limit changed", "Resource limit not changed"},
+ {Event_Size, "Size failed", "Size
succeeded", "Size changed", "Size not changed"},
+ {Event_Timeout, "Timeout", "Timeout
recovery", "Timeout changed", "Timeout not changed"},
+ {Event_Timestamp, "Timestamp failed", "Timestamp
succeeded", "Timestamp changed", "Timestamp not changed"},
+ {Event_Uid, "UID failed", "UID
succeeded", "UID changed", "UID not changed"},
/* Virtual events */
- {EVENT_NULL, "No Event", "No
Event", "No Event", "No Event"}
+ {Event_Null, "No Event", "No
Event", "No Event", "No Event"}
};
@@ -336,7 +336,7 @@
}
/* the internal instance and action events are handled as changed any
time since we need to deliver alert whenever it occurs */
- if (E->id == EVENT_INSTANCE || E->id == EVENT_ACTION || (count >=
action->count && (S != E->state || S == STATE_CHANGED)))
+ if (E->id == Event_Instance || E->id == Event_Action || (count >=
action->count && (S != E->state || S == STATE_CHANGED)))
return TRUE;
return FALSE;
@@ -438,9 +438,9 @@
/**
* Get a textual description of actual event action. For instance if the
- * event type is possitive EVENT_NONEXIST, the textual description of
+ * event type is possitive Event_Nonexist, the textual description of
* failed state related action is "restart". Likewise if the event type is
- * negative EVENT_CHECKSUM the textual description of recovery related
action
+ * negative Event_Checksumthe textual description of recovery related
action
* is "alert" and so on.
* @param E An event object
* @return A string describing the event type in clear text. If the
@@ -644,7 +644,7 @@
* logged. Instance and action events are logged always with priority
* info. */
if (E->state != STATE_INIT || E->state_map & 0x1) {
- if (E->state == STATE_SUCCEEDED || E->state == STATE_CHANGEDNOT ||
E->id == EVENT_INSTANCE || E->id == EVENT_ACTION)
+ if (E->state == STATE_SUCCEEDED || E->state == STATE_CHANGEDNOT ||
E->id == Event_Instance || E->id == Event_Action)
LogInfo("'%s' %s\n", S->name, E->message);
else
LogError("'%s' %s\n", S->name, E->message);
@@ -654,7 +654,7 @@
}
if (E->state == STATE_FAILED || E->state == STATE_CHANGED) {
- if (E->id != EVENT_INSTANCE && E->id != EVENT_ACTION) { // We are not
interested in setting error flag for instance and action events
+ if (E->id != Event_Instance && E->id != Event_Action) { // We are not
interested in setting error flag for instance and action events
S->error |= E->id;
/* The error hint provides second dimension for error bitmap and
differentiates between failed/changed event states (failed=0, chaged=1) */
if (E->state == STATE_CHANGED)
@@ -705,7 +705,7 @@
/* Action event is handled already. For Instance events
* we don't want actions like stop to be executed
* to prevent the disabling of system service monitoring */
- if (A->id == ACTION_ALERT || E->id == EVENT_INSTANCE) {
+ if (A->id == ACTION_ALERT || E->id == Event_Instance) {
return;
} else if (A->id == ACTION_EXEC) {
LogInfo("'%s' exec: %s\n", s->name, A->exec->arg[0]);
=======================================
--- /trunk/event.h Fri Jan 8 03:20:43 2010
+++ /trunk/event.h Mon Sep 6 05:48:55 2010
@@ -32,29 +32,33 @@
#include "monitor.h"
-#define EVENT_NULL 0x0
-#define EVENT_CHECKSUM 0x1
-#define EVENT_RESOURCE 0x2
-#define EVENT_TIMEOUT 0x4
-#define EVENT_TIMESTAMP 0x8
-#define EVENT_SIZE 0x10
-#define EVENT_CONNECTION 0x20
-#define EVENT_PERMISSION 0x40
-#define EVENT_UID 0x80
-#define EVENT_GID 0x100
-#define EVENT_NONEXIST 0x200
-#define EVENT_INVALID 0x400
-#define EVENT_DATA 0x800
-#define EVENT_EXEC 0x1000
-#define EVENT_FSFLAG 0x2000
-#define EVENT_ICMP 0x4000
-#define EVENT_CONTENT 0x8000
-#define EVENT_INSTANCE 0x10000
-#define EVENT_ACTION 0x20000
-#define EVENT_PID 0x40000
-#define EVENT_PPID 0x80000
-#define EVENT_HEARTBEAT 0x100000
-#define EVENT_ALL 0xFFFFFFFF
+
+typedef enum {
+ Event_Null = 0x0,
+ Event_Checksum = 0x1,
+ Event_Resource = 0x2,
+ Event_Timeout = 0x4,
+ Event_Timestamp = 0x8,
+ Event_Size = 0x10,
+ Event_Connection = 0x20,
+ Event_Permission = 0x40,
+ Event_Uid = 0x80,
+ Event_Gid = 0x100,
+ Event_Nonexist = 0x200,
+ Event_Invalid = 0x400,
+ Event_Data = 0x800,
+ Event_Exec = 0x1000,
+ Event_Fsflag = 0x2000,
+ Event_Icmp = 0x4000,
+ Event_Content = 0x8000,
+ Event_Instance = 0x10000,
+ Event_Action = 0x20000,
+ Event_Pid = 0x40000,
+ Event_PPid = 0x80000,
+ Event_Heartbeat = 0x100000,
+ Event_All = 0xFFFFFFFF
+} Event_Type;
+
#define IS_EVENT_SET(value, mask) ((value & mask) != 0)
@@ -164,8 +168,8 @@
/**
* Get a textual description of actual event type. For instance if the
- * event type is possitive EVENT_TIMESTAMP, the textual description is
- * "Timestamp error". Likewise if the event type is negative EVENT_CHECKSUM
+ * event type is possitive Event_Timestamp, the textual description is
+ * "Timestamp error". Likewise if the event type is negative Event_Checksum
* the textual description is "Checksum recovery" and so on.
* @param E An event object
* @return A string describing the event type in clear text. If the
@@ -184,9 +188,9 @@
/**
* Get a textual description of actual event action. For instance if the
- * event type is possitive EVENT_NONEXIST, the textual description of
+ * event type is possitive Event_Nonexist, the textual description of
* failed state related action is "restart". Likewise if the event type is
- * negative EVENT_CHECKSUM the textual description of recovery related
action
+ * negative Event_Checksum the textual description of recovery related
action
* is "alert" and so on.
* @param E An event object
* @return A string describing the event type in clear text. If the
=======================================
--- /trunk/http/cervlet.c Thu Sep 2 02:13:00 2010
+++ /trunk/http/cervlet.c Mon Sep 6 05:48:55 2010
@@ -1002,11 +1002,11 @@
if(Run.doprocess) {
out_print(res,
"<td align=\"right\"><font%s>%.1f%%</font></td>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->cpu_percent/10.0);
out_print(res,
"<td align=\"right\"><font%s>%.1f%%
[%ld kB]</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->mem_percent/10.0, s->inf->mem_kbyte);
}
@@ -1427,50 +1427,50 @@
"<td>%s</td></tr>", r->to?r->to:"");
out_print(res, "<tr><td>Alert on</td><td>");
- if(r->events == EVENT_NULL) {
+ if(r->events == Event_Null) {
out_print(res, "No events");
- } else if(r->events == EVENT_ALL) {
+ } else if(r->events == Event_All) {
out_print(res, "All events");
} else {
- if(IS_EVENT_SET(r->events, EVENT_ACTION))
+ if(IS_EVENT_SET(r->events, Event_Action))
out_print(res, "Action ");
- if(IS_EVENT_SET(r->events, EVENT_CHECKSUM))
+ if(IS_EVENT_SET(r->events, Event_Checksum))
out_print(res, "Checksum ");
- if(IS_EVENT_SET(r->events, EVENT_CONNECTION))
+ if(IS_EVENT_SET(r->events, Event_Connection))
out_print(res, "Connection ");
- if(IS_EVENT_SET(r->events, EVENT_CONTENT))
+ if(IS_EVENT_SET(r->events, Event_Content))
out_print(res, "Content ");
- if(IS_EVENT_SET(r->events, EVENT_DATA))
+ if(IS_EVENT_SET(r->events, Event_Data))
out_print(res, "Data ");
- if(IS_EVENT_SET(r->events, EVENT_EXEC))
+ if(IS_EVENT_SET(r->events, Event_Exec))
out_print(res, "Exec ");
- if(IS_EVENT_SET(r->events, EVENT_FSFLAG))
+ if(IS_EVENT_SET(r->events, Event_Fsflag))
out_print(res, "Fsflags ");
- if(IS_EVENT_SET(r->events, EVENT_GID))
+ if(IS_EVENT_SET(r->events, Event_Gid))
out_print(res, "Gid ");
- if(IS_EVENT_SET(r->events, EVENT_ICMP))
+ if(IS_EVENT_SET(r->events, Event_Icmp))
out_print(res, "Icmp ");
- if(IS_EVENT_SET(r->events, EVENT_INSTANCE))
+ if(IS_EVENT_SET(r->events, Event_Instance))
out_print(res, "Instance ");
- if(IS_EVENT_SET(r->events, EVENT_INVALID))
+ if(IS_EVENT_SET(r->events, Event_Invalid))
out_print(res, "Invalid ");
- if(IS_EVENT_SET(r->events, EVENT_NONEXIST))
+ if(IS_EVENT_SET(r->events, Event_Nonexist))
out_print(res, "Nonexist ");
- if(IS_EVENT_SET(r->events, EVENT_PERMISSION))
+ if(IS_EVENT_SET(r->events, Event_Permission))
out_print(res, "Permission ");
- if(IS_EVENT_SET(r->events, EVENT_PID))
+ if(IS_EVENT_SET(r->events, Event_Pid))
out_print(res, "PID ");
- if(IS_EVENT_SET(r->events, EVENT_PPID))
+ if(IS_EVENT_SET(r->events, Event_PPid))
out_print(res, "PPID ");
- if(IS_EVENT_SET(r->events, EVENT_RESOURCE))
+ if(IS_EVENT_SET(r->events, Event_Resource))
out_print(res, "Resource ");
- if(IS_EVENT_SET(r->events, EVENT_SIZE))
+ if(IS_EVENT_SET(r->events, Event_Size))
out_print(res, "Size ");
- if(IS_EVENT_SET(r->events, EVENT_TIMEOUT))
+ if(IS_EVENT_SET(r->events, Event_Timeout))
out_print(res, "Timeout ");
- if(IS_EVENT_SET(r->events, EVENT_TIMESTAMP))
+ if(IS_EVENT_SET(r->events, Event_Timestamp))
out_print(res, "Timestamp ");
- if(IS_EVENT_SET(r->events, EVENT_UID))
+ if(IS_EVENT_SET(r->events, Event_Uid))
out_print(res, "Uid ");
}
@@ -1969,7 +1969,7 @@
out_print(res,
"<tr><td>Permission</td><td><font%s>%o</font></td></tr>",
- (s->error & EVENT_PERMISSION)?" color='#ff0000'":"",
+ (s->error & Event_Permission)?" color='#ff0000'":"",
s->inf->st_mode & 07777);
}
@@ -1992,7 +1992,7 @@
out_print(res,
"<tr><td>UID</td><td><font%s>%d</font></td></tr>",
- (s->error & EVENT_UID)?" color='#ff0000'":"",
+ (s->error & Event_Uid)?" color='#ff0000'":"",
(int)s->inf->st_uid);
}
@@ -2015,7 +2015,7 @@
out_print(res,
"<tr><td>GID</td><td><font%s>%d</font></td></tr>",
- (s->error & EVENT_GID)?" color='#ff0000'":"",
+ (s->error & Event_Gid)?" color='#ff0000'":"",
(int)s->inf->st_gid);
}
@@ -2040,7 +2040,7 @@
out_print(res,
"<tr><td>Timestamp</td><td><font%s>%s</font></td></tr>",
- (s->error & EVENT_TIMESTAMP)?" color='#ff0000'":"", time);
+ (s->error & Event_Timestamp)?" color='#ff0000'":"", time);
}
}
@@ -2086,7 +2086,7 @@
out_print(res,
"<tr><td>Blocks free total</td>"
"<td><font%s>%ld [%.1f MB] [%.1f%%]</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->f_blocksfreetotal,
(float)s->inf->f_blocksfreetotal / (float)1048576 *
(float)s->inf->f_bsize,
(float)100 * (float)s->inf->f_blocksfreetotal /
(float)s->inf->f_blocks);
@@ -2099,7 +2099,7 @@
"<tr><td>Inodes total</td><td>%ld</td></tr>", s->inf->f_files);
out_print(res,
"<tr><td>Inodes free</td><td><font%s>%ld
[%.1f%%]</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->f_filesfree,
(float)100 * (float)s->inf->f_filesfree /
(float)s->inf->f_files);
@@ -2122,7 +2122,7 @@
out_print(res,
"<tr><td>Size</td><td><font%s>%llu B</td></tr>",
- (s->error & EVENT_SIZE)?" color='#ff0000'":"",
+ (s->error & Event_Size)?" color='#ff0000'":"",
(unsigned long long) s->inf->st_size);
}
@@ -2142,8 +2142,8 @@
out_print(res,
"<tr><td>Match regex</td><td><font%s>%s</td></tr>",
- (s->error & EVENT_CONTENT)?" color='#ff0000'":"",
- (s->error & EVENT_CONTENT)?"yes":"no");
+ (s->error & Event_Content)?" color='#ff0000'":"",
+ (s->error & Event_Content)?"yes":"no");
}
}
}
@@ -2161,7 +2161,7 @@
out_print(res,
"<tr><td>Checksum</td><td><font%s>%s(%s)</font></td></tr>",
- (s->error & EVENT_CHECKSUM)?" color='#ff0000'":"", s->inf->cs_sum,
+ (s->error & Event_Checksum)?" color='#ff0000'":"", s->inf->cs_sum,
checksumnames[s->checksum->type]);
}
@@ -2224,30 +2224,30 @@
if(s->type == TYPE_PROCESS) {
out_print(res,
"<tr><td>CPU usage</td><td><font%s>%.1f%%</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->cpu_percent/10.0);
out_print(res,
"<tr><td>Memory usage</td><td><font%s>%.1f%%
[%ldkB]</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->mem_percent/10.0, s->inf->mem_kbyte);
out_print(res,
"<tr><td>Children</td><td><font%s>%d</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->children);
out_print(res,
"<tr><td>Total CPU usage (incl. children)</td><td><font%s>%.1f%%"
"</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->total_cpu_percent/10.0);
out_print(res,
"<tr><td>Total memory usage (incl. children)</td>"
"<td><font%s>%.1f%% [%ldkB]</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
s->inf->total_mem_percent/10.0, s->inf->total_mem_kbyte);
} else if(s->type == TYPE_SYSTEM) {
out_print(res,
"<tr><td>Load average</td><td><font%s>[%.2f] [%.2f]
[%.2f]</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
systeminfo.loadavg[0],
systeminfo.loadavg[1],
systeminfo.loadavg[2]);
@@ -2257,7 +2257,7 @@
" %.1f%%wa"
#endif
"%s",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
systeminfo.total_cpu_user_percent/10.,
systeminfo.total_cpu_syst_percent/10.,
#ifdef HAVE_CPU_WAIT
@@ -2266,12 +2266,12 @@
"</font></td></tr>");
out_print(res,
"<tr><td>Memory usage</td><td><font%s>%ld kB
[%.1f%%]</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
systeminfo.total_mem_kbyte,
systeminfo.total_mem_percent/10.);
out_print(res,
"<tr><td>Swap usage</td><td><font%s>%ld kB
[%.1f%%]</font></td></tr>",
- (s->error & EVENT_RESOURCE)?" color='#ff0000'":"",
+ (s->error & Event_Resource)?" color='#ff0000'":"",
systeminfo.total_swap_kbyte,
systeminfo.total_swap_percent/10.);
}
=======================================
--- /trunk/monitor.c Wed Aug 18 13:20:45 2010
+++ /trunk/monitor.c Mon Sep 6 05:48:55 2010
@@ -374,7 +374,7 @@
monit_http(START_HTTP);
/* send the monit startup notification */
- Event_post(Run.system, EVENT_INSTANCE, STATE_CHANGED,
Run.system->action_MONIT_RELOAD, "Monit reloaded");
+ Event_post(Run.system, Event_Instance, STATE_CHANGED,
Run.system->action_MONIT_RELOAD, "Monit reloaded");
if(Run.mmonits && ((status = pthread_create(&heartbeatThread, NULL,
heartbeat, NULL)) != 0))
LogError("%s: Failed to create the heartbeat thread -- %s\n", prog,
strerror(status));
@@ -475,7 +475,7 @@
LogInfo("%s daemon with pid [%d] killed\n", prog, (int)getpid());
/* send the monit stop notification */
- Event_post(Run.system, EVENT_INSTANCE, STATE_CHANGED,
Run.system->action_MONIT_STOP, "Monit stopped");
+ Event_post(Run.system, Event_Instance, STATE_CHANGED,
Run.system->action_MONIT_STOP, "Monit stopped");
}
gc();
exit(0);
@@ -535,7 +535,7 @@
monit_http(START_HTTP);
/* send the monit startup notification */
- Event_post(Run.system, EVENT_INSTANCE, STATE_CHANGED,
Run.system->action_MONIT_START, "Monit started");
+ Event_post(Run.system, Event_Instance, STATE_CHANGED,
Run.system->action_MONIT_START, "Monit started");
if(Run.mmonits && ((status = pthread_create(&heartbeatThread, NULL,
heartbeat, NULL)) != 0))
LogError("%s: Failed to create the heartbeat thread -- %s\n", prog,
strerror(status));
=======================================
--- /trunk/monitor.h Thu Aug 26 12:31:40 2010
+++ /trunk/monitor.h Mon Sep 6 05:48:55 2010
@@ -754,8 +754,8 @@
EventAction_T action_ACTION; /**< Action requested by CLI or
GUI */
/** Runtime parameters */
- unsigned long long error; /**< Error flags
bitmap */
- unsigned long long error_hint; /**< Failed/Changed hint for error
bitmap */
+ int error; /**< Error flags
bitmap */
+ int error_hint; /**< Failed/Changed hint for error
bitmap */
Info_T inf; /**< Service check
result */
struct timeval collected; /**< When were data
collected */
int doaction; /**< Action scheduled by http
thread */
=======================================
--- /trunk/p.y Wed Aug 25 12:43:56 2010
+++ /trunk/p.y Mon Sep 6 05:48:55 2010
@@ -488,7 +488,7 @@
addmail($<string>2, &mailset, &Run.maillist, eventset,
$<number>7);
}
| SET alertmail formatlist reminder {
- addmail($<string>2, &mailset, &Run.maillist,
EVENT_ALL, $<number>4);
+ addmail($<string>2, &mailset, &Run.maillist,
Event_All, $<number>4);
}
| SET alertmail NOT '{' eventoptionlist '}' formatlist
reminder {
addmail($<string>2, &mailset, &Run.maillist, ~eventset,
$<number>8);
@@ -1234,13 +1234,13 @@
addmail($<string>1, &mailset, ¤t->maillist,
eventset, $<number>6);
}
| alertmail formatlist reminder {
- addmail($<string>1, &mailset, ¤t->maillist,
EVENT_ALL, $<number>3);
+ addmail($<string>1, &mailset, ¤t->maillist,
Event_All, $<number>3);
}
| alertmail NOT '{' eventoptionlist '}' formatlist
reminder {
addmail($<string>1, &mailset, ¤t->maillist,
~eventset, $<number>7);
}
| noalertmail {
- addmail($<string>1, &mailset, ¤t->maillist,
EVENT_NULL, 0);
+ addmail($<string>1, &mailset, ¤t->maillist,
Event_Null, 0);
}
;
@@ -1254,26 +1254,26 @@
| eventoptionlist eventoption
;
-eventoption : ACTION { eventset |= EVENT_ACTION; }
- | CHECKSUM { eventset |= EVENT_CHECKSUM; }
- | CONNECTION { eventset |= EVENT_CONNECTION; }
- | CONTENT { eventset |= EVENT_CONTENT; }
- | DATA { eventset |= EVENT_DATA; }
- | EXEC { eventset |= EVENT_EXEC; }
- | FSFLAG { eventset |= EVENT_FSFLAG; }
- | GID { eventset |= EVENT_GID; }
- | ICMP { eventset |= EVENT_ICMP; }
- | INSTANCE { eventset |= EVENT_INSTANCE; }
- | INVALID { eventset |= EVENT_INVALID; }
- | NONEXIST { eventset |= EVENT_NONEXIST; }
- | PERMISSION { eventset |= EVENT_PERMISSION; }
- | PID { eventset |= EVENT_PID; }
- | PPID { eventset |= EVENT_PPID; }
- | RESOURCE { eventset |= EVENT_RESOURCE; }
- | SIZE { eventset |= EVENT_SIZE; }
- | TIMEOUT { eventset |= EVENT_TIMEOUT; }
- | TIMESTAMP { eventset |= EVENT_TIMESTAMP; }
- | UID { eventset |= EVENT_UID; }
+eventoption : ACTION { eventset |= Event_Action; }
+ | CHECKSUM { eventset |= Event_Checksum; }
+ | CONNECTION { eventset |= Event_Connection; }
+ | CONTENT { eventset |= Event_Content; }
+ | DATA { eventset |= Event_Data; }
+ | EXEC { eventset |= Event_Exec; }
+ | FSFLAG { eventset |= Event_Fsflag; }
+ | GID { eventset |= Event_Gid; }
+ | ICMP { eventset |= Event_Icmp; }
+ | INSTANCE { eventset |= Event_Instance; }
+ | INVALID { eventset |= Event_Invalid; }
+ | NONEXIST { eventset |= Event_Nonexist; }
+ | PERMISSION { eventset |= Event_Permission; }
+ | PID { eventset |= Event_Pid; }
+ | PPID { eventset |= Event_PPid; }
+ | RESOURCE { eventset |= Event_Resource; }
+ | SIZE { eventset |= Event_Size; }
+ | TIMEOUT { eventset |= Event_Timeout; }
+ | TIMESTAMP { eventset |= Event_Timestamp; }
+ | UID { eventset |= Event_Uid; }
;
formatlist : /* EMPTY */
@@ -3179,7 +3179,7 @@
*/
static void reset_mailset() {
memset(&mailset, 0, sizeof(struct mymail));
- eventset = EVENT_NULL;
+ eventset = Event_Null;
}
=======================================
--- /trunk/util.c Thu Jul 29 04:35:44 2010
+++ /trunk/util.c Mon Sep 6 05:48:55 2010
@@ -1992,8 +1992,8 @@
*/
int Util_hasServiceStatus(Service_T s) {
return(!((s->monitor!=MONITOR_YES)||
- (s->error&EVENT_NONEXIST)||
- (s->error&EVENT_DATA) ));
+ (s->error&Event_Nonexist)||
+ (s->error&Event_Data) ));
}
@@ -2082,7 +2082,7 @@
}
s->nstart= 0;
s->ncycle= 0;
- s->error = EVENT_NULL;
+ s->error = Event_Null;
if(s->eventlist)
gc_event(&s->eventlist);
Util_resetInfo(s);
@@ -2235,50 +2235,50 @@
* Print registered events list
*/
static void printevents(unsigned int events) {
- if(events == EVENT_NULL) {
+ if(events == Event_Null) {
printf("No events");
- } else if(events == EVENT_ALL) {
+ } else if(events == Event_All) {
printf("All events");
} else {
- if(IS_EVENT_SET(events, EVENT_ACTION))
+ if(IS_EVENT_SET(events, Event_Action))
printf("Action ");
- if(IS_EVENT_SET(events, EVENT_CHECKSUM))
+ if(IS_EVENT_SET(events, Event_Checksum))
printf("Checksum ");
- if(IS_EVENT_SET(events, EVENT_CONNECTION))
+ if(IS_EVENT_SET(events, Event_Connection))
printf("Connection ");
- if(IS_EVENT_SET(events, EVENT_CONTENT))
+ if(IS_EVENT_SET(events, Event_Content))
printf("Content ");
- if(IS_EVENT_SET(events, EVENT_DATA))
+ if(IS_EVENT_SET(events, Event_Data))
printf("Data ");
- if(IS_EVENT_SET(events, EVENT_EXEC))
+ if(IS_EVENT_SET(events, Event_Exec))
printf("Exec ");
- if(IS_EVENT_SET(events, EVENT_FSFLAG))
+ if(IS_EVENT_SET(events, Event_Fsflag))
printf("Fsflags ");
- if(IS_EVENT_SET(events, EVENT_GID))
+ if(IS_EVENT_SET(events, Event_Gid))
printf("Gid ");
- if(IS_EVENT_SET(events, EVENT_ICMP))
+ if(IS_EVENT_SET(events, Event_Icmp))
printf("Icmp ");
- if(IS_EVENT_SET(events, EVENT_INSTANCE))
+ if(IS_EVENT_SET(events, Event_Instance))
printf("Instance ");
- if(IS_EVENT_SET(events, EVENT_INVALID))
+ if(IS_EVENT_SET(events, Event_Invalid))
printf("Invalid ");
- if(IS_EVENT_SET(events, EVENT_NONEXIST))
+ if(IS_EVENT_SET(events, Event_Nonexist))
printf("Nonexist ");
- if(IS_EVENT_SET(events, EVENT_PERMISSION))
+ if(IS_EVENT_SET(events, Event_Permission))
printf("Permission ");
- if(IS_EVENT_SET(events, EVENT_PID))
+ if(IS_EVENT_SET(events, Event_Pid))
printf("PID ");
- if(IS_EVENT_SET(events, EVENT_PPID))
+ if(IS_EVENT_SET(events, Event_PPid))
printf("PPID ");
- if(IS_EVENT_SET(events, EVENT_RESOURCE))
+ if(IS_EVENT_SET(events, Event_Resource))
printf("Resource ");
- if(IS_EVENT_SET(events, EVENT_SIZE))
+ if(IS_EVENT_SET(events, Event_Size))
printf("Size ");
- if(IS_EVENT_SET(events, EVENT_TIMEOUT))
+ if(IS_EVENT_SET(events, Event_Timeout))
printf("Timeout ");
- if(IS_EVENT_SET(events, EVENT_TIMESTAMP))
+ if(IS_EVENT_SET(events, Event_Timestamp))
printf("Timestamp ");
- if(IS_EVENT_SET(events, EVENT_UID))
+ if(IS_EVENT_SET(events, Event_Uid))
printf("Uid ");
}
printf("\n");
=======================================
--- /trunk/validate.c Sat Jul 10 04:56:16 2010
+++ /trunk/validate.c Mon Sep 6 05:48:55 2010
@@ -208,10 +208,10 @@
/* Test for running process */
if (!(pid = Util_isProcessRunning(s))) {
- Event_post(s, EVENT_NONEXIST, STATE_FAILED,
s->action_NONEXIST, "process is not running");
+ Event_post(s, Event_Nonexist, STATE_FAILED,
s->action_NONEXIST, "process is not running");
return FALSE;
} else
- Event_post(s, EVENT_NONEXIST, STATE_SUCCEEDED,
s->action_NONEXIST, "process is running with pid %d", (int)pid);
+ Event_post(s, Event_Nonexist, STATE_SUCCEEDED,
s->action_NONEXIST, "process is running with pid %d", (int)pid);
if (Run.doprocess) {
if (update_process_data(s, ptree, ptreesize, pid)) {
@@ -251,36 +251,36 @@
/* We need to resolve symbolic link so if it points to device,
* we'll be able to find it in mnttab */
if (lstat(s->path, &stat_buf) != 0) {
- Event_post(s, EVENT_NONEXIST, STATE_FAILED,
s->action_NONEXIST, "filesystem doesn't exist");
+ Event_post(s, Event_Nonexist, STATE_FAILED,
s->action_NONEXIST, "filesystem doesn't exist");
return FALSE;
}
if (S_ISLNK(stat_buf.st_mode)) {
if (! realpath(s->path, path_buf)) {
- Event_post(s, EVENT_NONEXIST, STATE_FAILED,
s->action_NONEXIST, "symbolic filesystem link error -- %s", STRERROR);
+ Event_post(s, Event_Nonexist, STATE_FAILED,
s->action_NONEXIST, "symbolic filesystem link error -- %s", STRERROR);
return FALSE;
}
p = path_buf;
- Event_post(s, EVENT_NONEXIST, STATE_SUCCEEDED,
s->action_NONEXIST, "symbolic filesystem link %s -> %s", s->path, p);
+ Event_post(s, Event_Nonexist, STATE_SUCCEEDED,
s->action_NONEXIST, "symbolic filesystem link %s -> %s", s->path, p);
if (stat(p, &stat_buf) != 0) {
- Event_post(s, EVENT_NONEXIST, STATE_FAILED,
s->action_NONEXIST, "filesystem doesn't exist");
+ Event_post(s, Event_Nonexist, STATE_FAILED,
s->action_NONEXIST, "filesystem doesn't exist");
return FALSE;
}
}
- Event_post(s, EVENT_NONEXIST, STATE_SUCCEEDED,
s->action_NONEXIST, "filesystem exist");
+ Event_post(s, Event_Nonexist, STATE_SUCCEEDED,
s->action_NONEXIST, "filesystem exist");
s->inf->st_mode = stat_buf.st_mode;
s->inf->st_uid = stat_buf.st_uid;
s->inf->st_gid = stat_buf.st_gid;
if (!filesystem_usage(s->inf, p)) {
- Event_post(s, EVENT_DATA, STATE_FAILED, s->action_DATA, "unable to
read filesystem %s state", p);
+ Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "unable to
read filesystem %s state", p);
return FALSE;
}
s->inf->inode_percent = (int)((1000.0 * (s->inf->f_files -
s->inf->f_filesfree)) / (float)s->inf->f_files);
s->inf->space_percent = (int)((1000.0 * (s->inf->f_blocks -
s->inf->f_blocksfree)) / (float)s->inf->f_blocks);
s->inf->inode_total = s->inf->f_files - s->inf->f_filesfree;
s->inf->space_total = s->inf->f_blocks - s->inf->f_blocksfreetotal;
- Event_post(s, EVENT_DATA, STATE_SUCCEEDED, s->action_DATA, "succeeded
getting filesystem statistic for %s", p);
+ Event_post(s, Event_Data, STATE_SUCCEEDED, s->action_DATA, "succeeded
getting filesystem statistic for %s", p);
if (s->perm)
check_perm(s);
@@ -311,7 +311,7 @@
ASSERT(s);
if (stat(s->path, &stat_buf) != 0) {
- Event_post(s, EVENT_NONEXIST, STATE_FAILED, s->action_NONEXIST, "file
doesn't exist");
+ Event_post(s, Event_Nonexist, STATE_FAILED, s->action_NONEXIST, "file
doesn't exist");
return FALSE;
} else {
s->inf->st_mode = stat_buf.st_mode;
@@ -326,15 +326,15 @@
s->inf->st_size = stat_buf.st_size;
s->inf->timestamp = MAX(stat_buf.st_mtime, stat_buf.st_ctime);
DEBUG("'%s' file exists check succeeded\n", s->name);
- Event_post(s, EVENT_NONEXIST, STATE_SUCCEEDED,
s->action_NONEXIST, "file exist");
+ Event_post(s, Event_Nonexist, STATE_SUCCEEDED,
s->action_NONEXIST, "file exist");
}
if (!S_ISREG(s->inf->st_mode)) {
- Event_post(s, EVENT_INVALID, STATE_FAILED, s->action_INVALID, "is not
a regular file");
+ Event_post(s, Event_Invalid, STATE_FAILED, s->action_INVALID, "is not
a regular file");
return FALSE;
} else {
DEBUG("'%s' is a regular file\n", s->name);
- Event_post(s, EVENT_INVALID, STATE_SUCCEEDED, s->action_INVALID, "is a
regular file");
+ Event_post(s, Event_Invalid, STATE_SUCCEEDED, s->action_INVALID, "is a
regular file");
}
if (s->checksum)
@@ -374,7 +374,7 @@
ASSERT(s);
if (stat(s->path, &stat_buf) != 0) {
- Event_post(s, EVENT_NONEXIST, STATE_FAILED,
s->action_NONEXIST, "directory doesn't exist");
+ Event_post(s, Event_Nonexist, STATE_FAILED,
s->action_NONEXIST, "directory doesn't exist");
return FALSE;
} else {
s->inf->st_mode = stat_buf.st_mode;
@@ -382,15 +382,15 @@
s->inf->st_gid = stat_buf.st_gid;
s->inf->timestamp = MAX(stat_buf.st_mtime, stat_buf.st_ctime);
DEBUG("'%s' directory exists check succeeded\n", s->name);
- Event_post(s, EVENT_NONEXIST, STATE_SUCCEEDED,
s->action_NONEXIST, "directory exist");
+ Event_post(s, Event_Nonexist, STATE_SUCCEEDED,
s->action_NONEXIST, "directory exist");
}
if (!S_ISDIR(s->inf->st_mode)) {
- Event_post(s, EVENT_INVALID, STATE_FAILED, s->action_INVALID, "is not
directory");
+ Event_post(s, Event_Invalid, STATE_FAILED, s->action_INVALID, "is not
directory");
return FALSE;
} else {
DEBUG("'%s' is directory\n", s->name);
- Event_post(s, EVENT_INVALID, STATE_SUCCEEDED, s->action_INVALID, "is
directory");
+ Event_post(s, Event_Invalid, STATE_SUCCEEDED, s->action_INVALID, "is
directory");
}
if (s->perm)
@@ -421,7 +421,7 @@
ASSERT(s);
if (stat(s->path, &stat_buf) != 0) {
- Event_post(s, EVENT_NONEXIST, STATE_FAILED, s->action_NONEXIST, "fifo
doesn't exist");
+ Event_post(s, Event_Nonexist, STATE_FAILED, s->action_NONEXIST, "fifo
doesn't exist");
return FALSE;
} else {
s->inf->st_mode = stat_buf.st_mode;
@@ -429,15 +429,15 @@
s->inf->st_gid = stat_buf.st_gid;
s->inf->timestamp = MAX(stat_buf.st_mtime, stat_buf.st_ctime);
DEBUG("'%s' fifo exists check succeeded\n", s->name);
- Event_post(s, EVENT_NONEXIST, STATE_SUCCEEDED,
s->action_NONEXIST, "fifo exist");
+ Event_post(s, Event_Nonexist, STATE_SUCCEEDED,
s->action_NONEXIST, "fifo exist");
}
if (!S_ISFIFO(s->inf->st_mode)) {
- Event_post(s, EVENT_INVALID, STATE_FAILED, s->action_INVALID, "is not
fifo");
+ Event_post(s, Event_Invalid, STATE_FAILED, s->action_INVALID, "is not
fifo");
return FALSE;
} else {
DEBUG("'%s' is fifo\n", s->name);
- Event_post(s, EVENT_INVALID, STATE_SUCCEEDED, s->action_INVALID, "is
fifo");
+ Event_post(s, Event_Invalid, STATE_SUCCEEDED, s->action_INVALID, "is
fifo");
}
if (s->perm)
@@ -491,11 +491,11 @@
if (icmp->response < 0) {
icmp->is_available = FALSE;
DEBUG("'%s' icmp ping failed\n", s->name);
- Event_post(s, EVENT_ICMP, STATE_FAILED, icmp->action, "failed
ICMP test [%s]", icmpnames[icmp->type]);
+ Event_post(s, Event_Icmp, STATE_FAILED, icmp->action, "failed
ICMP test [%s]", icmpnames[icmp->type]);
} else {
icmp->is_available = TRUE;
DEBUG("'%s' icmp ping succeeded [response time %.3fs]\n",
s->name, icmp->response);
- Event_post(s, EVENT_ICMP, STATE_SUCCEEDED,
icmp->action, "succeeded ICMP test [%s]", icmpnames[icmp->type]);
+ Event_post(s, Event_Icmp, STATE_SUCCEEDED,
icmp->action, "succeeded ICMP test [%s]", icmpnames[icmp->type]);
}
last_ping = icmp;
break;
@@ -600,10 +600,10 @@
if (!rv) {
p->is_available = FALSE;
- Event_post(s, EVENT_CONNECTION, STATE_FAILED, p->action, report);
+ Event_post(s, Event_Connection, STATE_FAILED, p->action, report);
} else {
p->is_available = TRUE;
- Event_post(s, EVENT_CONNECTION, STATE_SUCCEEDED,
p->action, "connection succeeded to %s%s%s", p->address, p->family ==
AF_INET ? " via " : "", p->family == AF_INET ?
Util_portTypeDescription(p) : "");
+ Event_post(s, Event_Connection, STATE_SUCCEEDED,
p->action, "connection succeeded to %s%s%s", p->address, p->family ==
AF_INET ? " via " : "", p->family == AF_INET ?
Util_portTypeDescription(p) : "");
}
}
@@ -617,10 +617,10 @@
ASSERT(s);
if (s->inf->status_flag & PROCESS_ZOMBIE)
- Event_post(s, EVENT_DATA, STATE_FAILED, s->action_DATA, "process with
pid %d is a zombie", s->inf->pid);
+ Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "process with
pid %d is a zombie", s->inf->pid);
else {
DEBUG("'%s' zombie check succeeded [status_flag=%04x]\n", s->name,
s->inf->status_flag);
- Event_post(s, EVENT_DATA, STATE_SUCCEEDED, s->action_DATA, "check
process state succeeded");
+ Event_post(s, Event_Data, STATE_SUCCEEDED, s->action_DATA, "check
process state succeeded");
}
}
@@ -638,9 +638,9 @@
return;
if (s->inf->_pid != s->inf->pid)
- Event_post(s, EVENT_PID, STATE_CHANGED, s->action_PID, "process PID
changed to %d", s->inf->pid);
+ Event_post(s, Event_Pid, STATE_CHANGED, s->action_PID, "process PID
changed to %d", s->inf->pid);
else
- Event_post(s, EVENT_PID, STATE_CHANGEDNOT, s->action_PID, "process PID
has not changed since last cycle");
+ Event_post(s, Event_Pid, STATE_CHANGEDNOT, s->action_PID, "process PID
has not changed since last cycle");
}
@@ -656,9 +656,9 @@
return;
if (s->inf->_ppid != s->inf->ppid)
- Event_post(s, EVENT_PPID, STATE_CHANGED, s->action_PPID, "process PPID
changed to %d", s->inf->ppid);
+ Event_post(s, Event_PPid, STATE_CHANGED, s->action_PPID, "process PPID
changed to %d", s->inf->ppid);
else
- Event_post(s, EVENT_PPID, STATE_CHANGEDNOT, s->action_PPID, "process
PPID has not changed since last cycle");
+ Event_post(s, Event_PPid, STATE_CHANGEDNOT, s->action_PPID, "process
PPID has not changed since last cycle");
}
@@ -824,9 +824,9 @@
}
if (! okay)
- Event_post(s, EVENT_RESOURCE, STATE_FAILED, r->action, "%s", report);
+ Event_post(s, Event_Resource, STATE_FAILED, r->action, "%s", report);
else {
- Event_post(s, EVENT_RESOURCE, STATE_SUCCEEDED, r->action, "%s",
report);
+ Event_post(s, Event_Resource, STATE_SUCCEEDED, r->action, "%s",
report);
DEBUG("%s", report);
}
}
@@ -845,7 +845,7 @@
if (Util_getChecksum(s->path, cs->type, s->inf->cs_sum,
sizeof(s->inf->cs_sum))) {
- Event_post(s, EVENT_DATA, STATE_SUCCEEDED, s->action_DATA, "checksum
computed for %s", s->path);
+ Event_post(s, Event_Data, STATE_SUCCEEDED, s->action_DATA, "checksum
computed for %s", s->path);
switch(cs->type) {
case HASH_MD5:
@@ -868,30 +868,30 @@
/* the checksum was not initialized during monit start, so set
the checksum now and allow further checksum change testing */
cs->test_changes_ok = TRUE;
else
- Event_post(s, EVENT_CHECKSUM, STATE_CHANGED,
cs->action, "checksum was changed for %s", s->path);
+ Event_post(s, Event_Checksum, STATE_CHANGED,
cs->action, "checksum was changed for %s", s->path);
/* reset expected value for next cycle */
snprintf(cs->hash, sizeof(cs->hash), "%s", s->inf->cs_sum);
} else
/* we are testing constant value for failed or succeeded state */
- Event_post(s, EVENT_CHECKSUM, STATE_FAILED, cs->action, "checksum
test failed for %s", s->path);
+ Event_post(s, Event_Checksum, STATE_FAILED, cs->action, "checksum
test failed for %s", s->path);
} else if (cs->test_changes) {
DEBUG("'%s' checksum has not changed\n", s->name);
- Event_post(s, EVENT_CHECKSUM, STATE_CHANGEDNOT,
cs->action, "checksum has not changed");
+ Event_post(s, Event_Checksum, STATE_CHANGEDNOT,
cs->action, "checksum has not changed");
} else {
DEBUG("'%s' has valid checksums\n", s->name);
- Event_post(s, EVENT_CHECKSUM, STATE_SUCCEEDED, cs->action, "checksum
succeeded");
+ Event_post(s, Event_Checksum, STATE_SUCCEEDED, cs->action, "checksum
succeeded");
}
return;
}
- Event_post(s, EVENT_DATA, STATE_FAILED, s->action_DATA, "cannot compute
checksum for %s", s->path);
+ Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "cannot compute
checksum for %s", s->path);
}
@@ -903,10 +903,10 @@
ASSERT(s && s->perm);
if ((s->inf->st_mode & 07777) != s->perm->perm)
- Event_post(s, EVENT_PERMISSION, STATE_FAILED,
s->perm->action, "permission test failed for %s -- current permission
is %04o", s->path, s->inf->st_mode&07777);
+ Event_post(s, Event_Permission, STATE_FAILED,
s->perm->action, "permission test failed for %s -- current permission
is %04o", s->path, s->inf->st_mode&07777);
else {
DEBUG("'%s' permission check succeeded [current permission=%04o]\n",
s->name, s->inf->st_mode&07777);
- Event_post(s, EVENT_PERMISSION, STATE_SUCCEEDED,
s->perm->action, "permission succeeded");
+ Event_post(s, Event_Permission, STATE_SUCCEEDED,
s->perm->action, "permission succeeded");
}
}
@@ -918,10 +918,10 @@
ASSERT(s && s->uid);
if (s->inf->st_uid != s->uid->uid)
- Event_post(s, EVENT_UID, STATE_FAILED, s->uid->action, "uid test
failed for %s -- current uid is %d", s->path, (int)s->inf->st_uid);
+ Event_post(s, Event_Uid, STATE_FAILED, s->uid->action, "uid test
failed for %s -- current uid is %d", s->path, (int)s->inf->st_uid);
else {
DEBUG("'%s' uid check succeeded [current uid=%d]\n", s->name,
(int)s->inf->st_uid);
- Event_post(s, EVENT_UID, STATE_SUCCEEDED, s->uid->action, "uid
succeeded");
+ Event_post(s, Event_Uid, STATE_SUCCEEDED, s->uid->action, "uid
succeeded");
}
}
@@ -933,10 +933,10 @@
ASSERT(s && s->gid);
if (s->inf->st_gid != s->gid->gid )
- Event_post(s, EVENT_GID, STATE_FAILED, s->gid->action, "gid test
failed for %s -- current gid is %d", s->path, (int)s->inf->st_gid);
+ Event_post(s, Event_Gid, STATE_FAILED, s->gid->action, "gid test
failed for %s -- current gid is %d", s->path, (int)s->inf->st_gid);
else {
DEBUG("'%s' gid check succeeded [current gid=%d]\n", s->name,
(int)s->inf->st_gid);
- Event_post(s, EVENT_GID, STATE_SUCCEEDED, s->gid->action, "gid
succeeded");
+ Event_post(s, Event_Gid, STATE_SUCCEEDED, s->gid->action, "gid
succeeded");
}
}
@@ -951,10 +951,10 @@
ASSERT(s && s->timestamplist);
if ((int)time(&now) == -1) {
- Event_post(s, EVENT_DATA, STATE_FAILED, s->action_DATA, "can't obtain
actual system time");
+ Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "can't obtain
actual system time");
return;
} else
- Event_post(s, EVENT_DATA, STATE_SUCCEEDED, s->action_DATA, "actual
system time obtained");
+ Event_post(s, Event_Data, STATE_SUCCEEDED, s->action_DATA, "actual
system time obtained");
for (t = s->timestamplist; t; t = t->next) {
if (t->test_changes) {
@@ -964,10 +964,10 @@
if (t->timestamp != s->inf->timestamp) {
/* reset expected value for next cycle */
t->timestamp = s->inf->timestamp;
- Event_post(s, EVENT_TIMESTAMP, STATE_CHANGED,
t->action, "timestamp was changed for %s", s->path);
+ Event_post(s, Event_Timestamp, STATE_CHANGED,
t->action, "timestamp was changed for %s", s->path);
} else {
DEBUG("'%s' timestamp was not changed for %s\n", s->name, s->path);
- Event_post(s, EVENT_TIMESTAMP, STATE_CHANGEDNOT,
t->action, "timestamp was not changed for %s", s->path);
+ Event_post(s, Event_Timestamp, STATE_CHANGEDNOT,
t->action, "timestamp was not changed for %s", s->path);
}
break;
} else {
@@ -975,10 +975,10 @@
/* we are testing constant value for failed or succeeded state */
if (Util_evalQExpression(t->operator, (int)(now -
s->inf->timestamp), t->time))
- Event_post(s, EVENT_TIMESTAMP, STATE_FAILED, t->action, "timestamp
test failed for %s", s->path);
+ Event_post(s, Event_Timestamp, STATE_FAILED, t->action, "timestamp
test failed for %s", s->path);
else {
DEBUG("'%s' timestamp test succeeded for %s\n", s->name, s->path);
- Event_post(s, EVENT_TIMESTAMP, STATE_SUCCEEDED,
t->action, "timestamp succeeded");
+ Event_post(s, Event_Timestamp, STATE_SUCCEEDED,
t->action, "timestamp succeeded");
}
}
}
@@ -1004,12 +1004,12 @@
sl->size = s->inf->st_size;
} else {
if (sl->size != s->inf->st_size) {
- Event_post(s, EVENT_SIZE, STATE_CHANGED, sl->action, "size was
changed for %s", s->path);
+ Event_post(s, Event_Size, STATE_CHANGED, sl->action, "size was
changed for %s", s->path);
/* reset expected value for next cycle */
sl->size = s->inf->st_size;
} else {
DEBUG("'%s' size has not changed [current size=%llu B]\n",
s->name, s->inf->st_size);
- Event_post(s, EVENT_SIZE, STATE_CHANGEDNOT, sl->action, "size
was not changed", s->path);
+ Event_post(s, Event_Size, STATE_CHANGEDNOT, sl->action, "size
was not changed", s->path);
}
}
break;
@@ -1017,10 +1017,10 @@
/* we are testing constant value for failed or succeeded state */
if (Util_evalQExpression(sl->operator, s->inf->st_size, sl->size))
- Event_post(s, EVENT_SIZE, STATE_FAILED, sl->action, "size test
failed for %s -- current size is %llu B", s->path, s->inf->st_size);
+ Event_post(s, Event_Size, STATE_FAILED, sl->action, "size test
failed for %s -- current size is %llu B", s->path, s->inf->st_size);
else {
DEBUG("'%s' file size check succeeded [current size=%llu B]\n",
s->name, s->inf->st_size);
- Event_post(s, EVENT_SIZE, STATE_SUCCEEDED, sl->action, "size
succeeded");
+ Event_post(s, Event_Size, STATE_SUCCEEDED, sl->action, "size
succeeded");
}
}
}
@@ -1176,10 +1176,10 @@
return;
DEBUG("'%s' Regular expression %s'%s' match on content line\n",
s->name, ml->not ? "not " : "", ml->match_string);
- Event_post(s, EVENT_CONTENT, STATE_CHANGED, ml->action, "content
match [%s]", line);
+ Event_post(s, Event_Content, STATE_CHANGED, ml->action, "content
match [%s]", line);
} else {
DEBUG("'%s' Regular expression %s'%s' doesn't match on content
line\n", s->name, ml->not ? "not " : "", ml->match_string);
- Event_post(s, EVENT_CONTENT, STATE_CHANGEDNOT,
ml->action, "content doesn't match [%s]", line);
+ Event_post(s, Event_Content, STATE_CHANGEDNOT,
ml->action, "content doesn't match [%s]", line);
}
}
}
@@ -1198,7 +1198,7 @@
return;
if (s->inf->_flags != s->inf->flags)
- Event_post(s, EVENT_FSFLAG, STATE_CHANGED,
s->action_FSFLAG, "filesytem flags changed to %#lx", s->inf->flags);
+ Event_post(s, Event_Fsflag, STATE_CHANGED,
s->action_FSFLAG, "filesytem flags changed to %#lx", s->inf->flags);
}
/**
@@ -1222,33 +1222,33 @@
if (td->limit_percent >= 0) {
if (Util_evalQExpression( td->operator, s->inf->inode_percent,
td->limit_percent)) {
- Event_post(s, EVENT_RESOURCE, STATE_FAILED, td->action, "inode
usage %.1f%% matches resource limit [inode usage%s%.1f%%]",
s->inf->inode_percent/10., operatorshortnames[td->operator],
td->limit_percent/10.);
+ Event_post(s, Event_Resource, STATE_FAILED, td->action, "inode
usage %.1f%% matches resource limit [inode usage%s%.1f%%]",
s->inf->inode_percent/10., operatorshortnames[td->operator],
td->limit_percent/10.);
return;
}
} else {
if (Util_evalQExpression(td->operator, s->inf->inode_total,
td->limit_absolute)) {
- Event_post(s, EVENT_RESOURCE, STATE_FAILED, td->action, "inode
usage %ld matches resource limit [inode usage%s%ld]", s->inf->inode_total,
operatorshortnames[td->operator], td->limit_absolute);
+ Event_post(s, Event_Resource, STATE_FAILED, td->action, "inode
usage %ld matches resource limit [inode usage%s%ld]", s->inf->inode_total,
operatorshortnames[td->operator], td->limit_absolute);
return;
}
}
DEBUG("'%s' inode usage check succeeded [current inode
usage=%.1f%%]\n", s->name, s->inf->inode_percent/10.);
- Event_post(s, EVENT_RESOURCE, STATE_SUCCEEDED,
td->action, "filesystem resources succeeded");
+ Event_post(s, Event_Resource, STATE_SUCCEEDED,
td->action, "filesystem resources succeeded");
return;
case RESOURCE_ID_SPACE:
if (td->limit_percent >= 0) {
if (Util_evalQExpression( td->operator, s->inf->space_percent,
td->limit_percent)) {
- Event_post(s, EVENT_RESOURCE, STATE_FAILED, td->action, "space
usage %.1f%% matches resource limit [space usage%s%.1f%%]",
s->inf->space_percent/10., operatorshortnames[td->operator],
td->limit_percent/10.);
+ Event_post(s, Event_Resource, STATE_FAILED, td->action, "space
usage %.1f%% matches resource limit [space usage%s%.1f%%]",
s->inf->space_percent/10., operatorshortnames[td->operator],
td->limit_percent/10.);
return;
}
} else {
if (Util_evalQExpression(td->operator, s->inf->space_total,
td->limit_absolute)) {
- Event_post(s, EVENT_RESOURCE, STATE_FAILED, td->action, "space
usage %ld blocks matches resource limit " "[space usage%s%ld blocks]",
s->inf->space_total, operatorshortnames[td->operator], td->limit_absolute);
+ Event_post(s, Event_Resource, STATE_FAILED, td->action, "space
usage %ld blocks matches resource limit " "[space usage%s%ld blocks]",
s->inf->space_total, operatorshortnames[td->operator], td->limit_absolute);
return;
}
}
DEBUG("'%s' space usage check succeeded [current space
usage=%.1f%%]\n", s->name, s->inf->space_percent/10.);
- Event_post(s, EVENT_RESOURCE, STATE_SUCCEEDED,
td->action, "filesystem resources succeeded");
+ Event_post(s, Event_Resource, STATE_SUCCEEDED,
td->action, "filesystem resources succeeded");
return;
default:
@@ -1276,7 +1276,7 @@
if (max < ar->cycle)
max = ar->cycle;
if (s->nstart >= ar->count && s->ncycle <= ar->cycle)
- Event_post(s, EVENT_TIMEOUT, STATE_FAILED, ar->action, "service
restarted %d times within %d cycles(s) - %s", s->nstart, s->ncycle,
actionnames[ar->action->failed->id]);
+ Event_post(s, Event_Timeout, STATE_FAILED, ar->action, "service
restarted %d times within %d cycles(s) - %s", s->nstart, s->ncycle,
actionnames[ar->action->failed->id]);
}
/* Stop counting and reset if the cycle interval is succeeded */
@@ -1320,7 +1320,7 @@
int rv = FALSE;
if (s->doaction != ACTION_IGNORE) {
rv = control_service(s->name, s->doaction);
- Event_post(s, EVENT_ACTION, STATE_CHANGED, s->action_ACTION, "%s
action done", actionnames[s->doaction]);
+ Event_post(s, Event_Action, STATE_CHANGED, s->action_ACTION, "%s
action done", actionnames[s->doaction]);
s->doaction = ACTION_IGNORE;
*s->token = 0;
}
=======================================
--- /trunk/xml.c Sat Sep 4 12:03:10 2010
+++ /trunk/xml.c Mon Sep 6 05:48:55 2010
@@ -234,8 +234,8 @@
Util_stringbuffer(B,
"<collected_sec>%ld</collected_sec>"
"<collected_usec>%ld</collected_usec>"
- "<status>%llu</status>"
- "<status_hint>%llu</status_hint>"
+ "<status>%d</status>"
+ "<status_hint>%d</status_hint>"
"<monitor>%d</monitor>"
"<monitormode>%d</monitormode>"
"<pendingaction>%d</pendingaction>",
@@ -470,7 +470,7 @@
"<message><![CDATA[%s]]></message>",
tv->tv_sec,
tv->tv_usec,
- Event_get_id(E) == EVENT_INSTANCE ? "Monit" : Event_get_source_name(E),
+ Event_get_id(E) == Event_Instance ? "Monit" : Event_get_source_name(E),
Event_get_source_type(E),
Event_get_id(E),
Event_get_state(E),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [monit-dev] [monit] r235 committed - event type consolidation,
monit <=