luci-app-statistics: add new item callback for menu entry
[project/luci.git] / applications / luci-app-statistics / luasrc / statistics / rrdtool / definitions / processes.lua
1 -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 module("luci.statistics.rrdtool.definitions.processes", package.seeall)
5
6 function item()
7 return luci.i18n.translate("Processes")
8 end
9
10 function rrdargs( graph, plugin, plugin_instance, dtype )
11
12 if plugin_instance == "" then
13 return {
14 title = "%H: Processes",
15 vlabel = "Processes/s",
16 data = {
17 instances = {
18 ps_state = {
19 "sleeping", "running", "paging",
20 "blocked", "stopped", "zombies"
21 }
22 },
23
24 options = {
25 ps_state_sleeping = { color = "0000ff", title = "Sleeping" },
26 ps_state_running = { color = "008000", title = "Running" },
27 ps_state_paging = { color = "ffff00", title = "Paging" },
28 ps_state_blocked = { color = "ff5000", title = "Blocked" },
29 ps_state_stopped = { color = "555555", title = "Stopped" },
30 ps_state_zombies = { color = "ff0000", title = "Zombies" }
31 }
32 }
33 }
34 else
35 return {
36 {
37 title = "%H: CPU time used by %pi",
38 vlabel = "Jiffies",
39 data = {
40 sources = {
41 ps_cputime = { "syst", "user" }
42 },
43
44 options = {
45 ps_cputime__user = {
46 color = "0000ff",
47 title = "User",
48 overlay = true
49 },
50
51 ps_cputime__syst = {
52 color = "ff0000",
53 title = "System",
54 overlay = true
55 }
56 }
57 }
58 },
59
60 {
61 title = "%H: Threads and processes belonging to %pi",
62 vlabel = "Count",
63 detail = true,
64 data = {
65 sources = {
66 ps_count = { "threads", "processes" }
67 },
68
69 options = {
70 ps_count__threads = { color = "00ff00", title = "Threads" },
71 ps_count__processes = { color = "0000bb", title = "Processes" }
72 }
73 }
74 },
75
76 {
77 title = "%H: Page faults in %pi",
78 vlabel = "Page faults",
79 detail = true,
80 data = {
81 sources = {
82 ps_pagefaults = { "minflt", "majflt" }
83 },
84
85 options = {
86 ps_pagefaults__minflt = { color = "0000ff", title = "Minor" },
87 ps_pagefaults__majflt = { color = "ff0000", title = "Major" }
88 }
89 }
90 },
91
92 {
93 title = "%H: Resident segment size (RSS) of %pi",
94 vlabel = "Bytes",
95 detail = true,
96 number_format = "%5.1lf%sB",
97 data = {
98 types = { "ps_rss" },
99
100 options = {
101 ps_rss = { color = "0000ff", title = "Resident segment" }
102 }
103 }
104 },
105
106 {
107 title = "%H: Virtual memory size (VSZ) of %pi",
108 vlabel = "Bytes",
109 detail = true,
110 number_format = "%5.1lf%sB",
111 data = {
112 types = { "ps_vm" },
113
114 options = {
115 ps_vm = { color = "0000ff", title = "Virtual memory" }
116 }
117 }
118 }
119 }
120 end
121 end