Merge pull request #1818 from dibdot/lxc_fix
[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 rrdargs( graph, plugin, plugin_instance, dtype )
7
8     if  plugin_instance == "" then
9         return {
10                         title = "%H: Processes",
11                         vlabel = "Processes/s",
12                         data = {
13                                 instances = {
14                                         ps_state = {
15                                                 "sleeping", "running", "paging",
16                                                 "blocked", "stopped", "zombies"
17                                         }
18                                 },
19
20                                 options = {
21                                         ps_state_sleeping = { color = "0000ff", title = "Sleeping" },
22                                         ps_state_running  = { color = "008000", title = "Running" },
23                                         ps_state_paging   = { color = "ffff00", title = "Paging" },
24                                         ps_state_blocked  = { color = "ff5000", title = "Blocked" },
25                                         ps_state_stopped  = { color = "555555", title = "Stopped" },
26                                         ps_state_zombies  = { color = "ff0000", title = "Zombies" }
27                                 }
28                         }
29         }
30     else
31         return {
32                 {
33                         title = "%H: CPU time used by %pi",
34                         vlabel = "Jiffies",
35                         data = {
36                                 sources = {
37                                         ps_cputime = { "syst", "user" }
38                                 },
39
40                                 options = {
41                                         ps_cputime__user = {
42                                                 color   = "0000ff",
43                                                 title   = "User",
44                                                 overlay = true
45                                         },
46
47                                         ps_cputime__syst = {
48                                                 color   = "ff0000",
49                                                 title   = "System",
50                                                 overlay = true
51                                         }
52                                 }
53                         }
54                 },
55
56                 {
57                         title = "%H: Threads and processes belonging to %pi",
58                         vlabel = "Count",
59                         detail = true,
60                         data = {
61                                 sources = {
62                                         ps_count = { "threads", "processes" }
63                                 },
64
65                                 options = {
66                                         ps_count__threads   = { color = "00ff00", title = "Threads" },
67                                         ps_count__processes = { color = "0000bb", title = "Processes" }
68                                 }
69                         }
70                 },
71
72                 {
73                         title = "%H: Page faults in %pi",
74                         vlabel = "Page faults",
75                         detail = true,
76                         data = {
77                                 sources = {
78                                         ps_pagefaults = { "minflt", "majflt" }
79                                 },
80
81                                 options = {
82                                         ps_pagefaults__minflt = { color = "0000ff", title = "Minor" },
83                                         ps_pagefaults__majflt = { color = "ff0000", title = "Major" }
84                                 }
85                         }
86                 },
87
88                 {
89                         title = "%H: Resident segment size (RSS) of %pi",
90                         vlabel = "Bytes",
91                         detail = true,
92                         number_format = "%5.1lf%sB",
93                         data = {
94                                 types = { "ps_rss" },
95
96                                 options = {
97                                         ps_rss = { color = "0000ff", title = "Resident segment" }
98                                 }
99                         }
100                 },
101
102                 {
103                         title = "%H: Virtual memory size (VSZ) of %pi",
104                         vlabel = "Bytes",
105                         detail = true,
106                         number_format = "%5.1lf%sB",
107                         data = {
108                                 types = { "ps_vm" },
109
110                                 options = {
111                                         ps_vm = { color = "0000ff", title = "Virtual memory" }
112                                 }
113                         }
114                 }
115         }
116     end
117 end