summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--doc/JAILS-MIB.txt13
-rw-r--r--doc/bsnmp-jails.86
-rw-r--r--module/bsnmp-jails.c9
-rw-r--r--module/jails-tree.def8
5 files changed, 33 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f6a2fb3..3e622ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
0.4
- Add support for monitoring CPU time of a jail.
- - Now number of threads shows up.
+ - Number of threads in jail exposed via SNMP.
+ - Tracking of combined RSS memory of jail.
0.3
- Support multiple IPs per jail.
diff --git a/doc/JAILS-MIB.txt b/doc/JAILS-MIB.txt
index d4fc1b7..0b07843 100644
--- a/doc/JAILS-MIB.txt
+++ b/doc/JAILS-MIB.txt
@@ -75,7 +75,8 @@ JailEntry ::=
jailThreads Integer32,
jailCpuTime TimeTicks,
jailDiskSpace Counter64,
- jailDiskFiles Integer32
+ jailDiskFiles Counter64,
+ jailResidentSize Counter64
}
jailIndex OBJECT-TYPE
@@ -149,10 +150,18 @@ jailDiskSpace OBJECT-TYPE
::= { jailEntry 30 }
jailDiskFiles OBJECT-TYPE
- SYNTAX Integer32
+ SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Number of files (inodes) in this jail. Zero means unknown."
::= { jailEntry 31 }
+jailResidentSize OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "The sum of the resident set size (RSS) of all processes in jail. An inaccurate representation of memory usage of the jail."
+ ::= { jailEntry 40 }
+
+
END
diff --git a/doc/bsnmp-jails.8 b/doc/bsnmp-jails.8
index aaa264d..d0aa2ec 100644
--- a/doc/bsnmp-jails.8
+++ b/doc/bsnmp-jails.8
@@ -80,6 +80,12 @@ The number of processes running in the jail.
The number of threads running in the jail.
.It Ar jails.jailTable.jailEntry.jailCpuTime.X
The amount of CPU time (in SNMP time ticks) the jail has used.
+.It Ar jails.jailTable.jailEntry.jailDiskSpace.X
+Amount of disk space taken by this jail. Zero means unknown.
+.It Ar jails.jailTable.jailEntry.jailDiskFiles.X
+Number of files (inodes) in this jail. Zero means unknown.
+.It Ar jails.jailTable.jailEntry.jailResidentSize.X
+The sum of the resident set size (RSS) of all processes in jail. In bytes. An inaccurate representation of memory usage of the jail.
.It Ar jails.jailNetworkFilter
A tcpdump style filter for the network traffic. Only matched traffic
is counted in the jail statistics.
diff --git a/module/bsnmp-jails.c b/module/bsnmp-jails.c
index b6eca88..542d30c 100644
--- a/module/bsnmp-jails.c
+++ b/module/bsnmp-jails.c
@@ -169,6 +169,7 @@ struct jaildat {
uint32_t cpu_time_offset;
uint32_t n_processes;
uint32_t n_threads;
+ uint64_t rss_memory;
/* Top process information */
uint32_t n_ptops;
@@ -887,6 +888,7 @@ process_refresh_all (void)
int nentries, i, jid;
uint32_t cpu_time;
void *alloc;
+ int pagesize;
/* Get a process listing */
kp = kvm_getprocs (kvm_handle, KERN_PROC_PROC, 0, &nentries);
@@ -897,6 +899,7 @@ process_refresh_all (void)
/* Sort the input we get, in reverse */
qsort (kp, nentries, sizeof (*kp), process_compar_kp_pid);
+ pagesize = getpagesize ();
/* Mark all processes in the jail for later sweep */
TAILQ_FOREACH (jail, &jaildats, link) {
@@ -905,6 +908,7 @@ process_refresh_all (void)
jail->n_processes = 0;
jail->n_threads = 0;
+ jail->rss_memory = 0;
jail->cpu_time_total = jail->cpu_time_offset;
}
@@ -923,6 +927,8 @@ process_refresh_all (void)
jail->n_processes += 1;
jail->n_threads += kp[i].ki_numthreads;
+ jail->rss_memory += (kp[i].ki_rssize * pagesize);
+
/* Find the top level process within jail to account to */
tkp = &kp[i];
@@ -1453,6 +1459,9 @@ op_jailentry (struct snmp_context *ctx, struct snmp_value *value,
case LEAF_jailDiskFiles:
value->v.counter64 = jail->disk_files;
return SNMP_ERR_NOERROR;
+ case LEAF_jailResidentSize:
+ value->v.counter64 = jail->rss_memory;
+ return SNMP_ERR_NOERROR;
default:
ASSERT (0);
return SNMP_ERR_NOSUCHNAME;
diff --git a/module/jails-tree.def b/module/jails-tree.def
index 3be0826..c89e07f 100644
--- a/module/jails-tree.def
+++ b/module/jails-tree.def
@@ -53,11 +53,13 @@
(13 jailOutPackets COUNTER64 GET)
(20 jailProcesses INTEGER GET)
- (21 jailThreads INTEGER GET)
+ (21 jailThreads INTEGER GET)
(25 jailCpuTime TIMETICKS GET)
- (30 jailDiskSpace COUNTER64 GET)
- (31 jailDiskFiles COUNTER64 GET)
+ (30 jailDiskSpace COUNTER64 GET)
+ (31 jailDiskFiles COUNTER64 GET)
+
+ (40 jailResidentSize COUNTER64 GET)
)
)