Skip to content

Commit 39f1c86

Browse files
committed
Add processes created
1 parent 1ea4fcb commit 39f1c86

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

system/cpu_stats/conf.d/cpu_stats.pyconf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ collection_group {
1414
value_threshold = 0.0
1515
}
1616

17+
metric {
18+
name = "procs_created"
19+
title = "Processes/Threads created"
20+
value_threshold = 0.0
21+
}
22+
1723
metric {
1824
name_match = "softirq_(.+)"
1925
value_threshold = 1.0
@@ -25,4 +31,5 @@ collection_group {
2531
}
2632

2733

34+
2835
}

system/cpu_stats/python_modules/cpu_stats.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
LAST_METRICS = dict(METRICS)
2727
METRICS_CACHE_MAX = 5
2828

29+
30+
2931
stat_file = "/proc/stat"
3032

3133
###############################################################################
@@ -87,6 +89,9 @@ def get_delta(name):
8789

8890
name = name.replace(NAME_PREFIX,"") # remove prefix from name
8991

92+
if name == "procs_created":
93+
name = "processes"
94+
9095
try:
9196
delta = (float(curr_metrics['data'][name][0]) - float(last_metrics['data'][name][0])) /(curr_metrics['time'] - last_metrics['time'])
9297
if delta < 0:
@@ -154,6 +159,12 @@ def metric_init(params):
154159
"description": "Context Switches",
155160
}))
156161

162+
descriptors.append(create_desc(Desc_Skel, {
163+
"name" : "procs_created",
164+
"units" : "proc/sec",
165+
"description": "Number of processes and threads created",
166+
}))
167+
157168
descriptors.append(create_desc(Desc_Skel, {
158169
"name" : "cpu_intr",
159170
"units" : "intr/sec",

0 commit comments

Comments
 (0)