From 2316a0d0c4a584b565f2cf9d2d1ec38ac4592e97 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Fri, 16 Jan 2009 01:42:29 +0000 Subject: Add support for listing threads --- ChangeLog | 1 + doc/JAILS-MIB.txt | 14 ++++++++++++-- doc/bsnmp-jails.8 | 2 ++ module/bsnmp-jails.c | 6 ++++++ module/jails-tree.def | 3 ++- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d59ee8..f6a2fb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 0.4 - Add support for monitoring CPU time of a jail. + - Now number of threads shows up. 0.3 - Support multiple IPs per jail. diff --git a/doc/JAILS-MIB.txt b/doc/JAILS-MIB.txt index c7016fc..d4fc1b7 100644 --- a/doc/JAILS-MIB.txt +++ b/doc/JAILS-MIB.txt @@ -72,7 +72,10 @@ JailEntry ::= jailOutOctets Counter64, jailOutPackets Counter64, jailProcesses Integer32, - jailCpuTime TimeTicks + jailThreads Integer32, + jailCpuTime TimeTicks, + jailDiskSpace Counter64, + jailDiskFiles Integer32 } jailIndex OBJECT-TYPE @@ -124,12 +127,19 @@ jailProcesses OBJECT-TYPE DESCRIPTION "Number of processes running in this jail." ::= { jailEntry 20 } +jailThreads OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Number of threads running in this jail." + ::= { jailEntry 21 } + jailCpuTime OBJECT-TYPE SYNTAX TimeTicks MAX-ACCESS read-only STATUS current DESCRIPTION "Amount of CPU time taken by this jail." - ::= { jailEntry 21 } + ::= { jailEntry 25 } jailDiskSpace OBJECT-TYPE SYNTAX Counter64 diff --git a/doc/bsnmp-jails.8 b/doc/bsnmp-jails.8 index 93ea091..aaa264d 100644 --- a/doc/bsnmp-jails.8 +++ b/doc/bsnmp-jails.8 @@ -76,6 +76,8 @@ The number of octets sent by the jail over the network. The number of packets sent by the jail over the network. .It Ar jails.jailTable.jailEntry.jailProcesses.X The number of processes running in the jail. +.It Ar jails.jailTable.jailEntry.jailThreads.X +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.jailNetworkFilter diff --git a/module/bsnmp-jails.c b/module/bsnmp-jails.c index b88cdd7..b6eca88 100644 --- a/module/bsnmp-jails.c +++ b/module/bsnmp-jails.c @@ -168,6 +168,7 @@ struct jaildat { uint32_t cpu_time_total; uint32_t cpu_time_offset; uint32_t n_processes; + uint32_t n_threads; /* Top process information */ uint32_t n_ptops; @@ -903,6 +904,7 @@ process_refresh_all (void) jail->ptops[i].status = PROC_GONE; jail->n_processes = 0; + jail->n_threads = 0; jail->cpu_time_total = jail->cpu_time_offset; } @@ -920,6 +922,7 @@ process_refresh_all (void) continue; jail->n_processes += 1; + jail->n_threads += kp[i].ki_numthreads; /* Find the top level process within jail to account to */ tkp = &kp[i]; @@ -1438,6 +1441,9 @@ op_jailentry (struct snmp_context *ctx, struct snmp_value *value, case LEAF_jailProcesses: value->v.integer = jail->n_processes; return SNMP_ERR_NOERROR; + case LEAF_jailThreads: + value->v.integer = jail->n_threads; + return SNMP_ERR_NOERROR; case LEAF_jailCpuTime: value->v.integer = jail->cpu_time_total; return SNMP_ERR_NOERROR; diff --git a/module/jails-tree.def b/module/jails-tree.def index 06bb10f..3be0826 100644 --- a/module/jails-tree.def +++ b/module/jails-tree.def @@ -53,7 +53,8 @@ (13 jailOutPackets COUNTER64 GET) (20 jailProcesses INTEGER GET) - (21 jailCpuTime TIMETICKS GET) + (21 jailThreads INTEGER GET) + (25 jailCpuTime TIMETICKS GET) (30 jailDiskSpace COUNTER64 GET) (31 jailDiskFiles COUNTER64 GET) -- cgit v1.2.3