applications/luci-statistics: move all models to the per-plugin level, provide titles...
[project/luci.git] / applications / luci-statistics / luasrc / statistics / rrdtool / definitions / processes.lua
1 --[[
2
3 Luci statistics - processes plugin diagram definition
4 (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 ]]--
15
16 module("luci.statistics.rrdtool.definitions.processes", package.seeall)
17
18 function rrdargs( graph, plugin, plugin_instance, dtype, is_index )
19
20         if is_index then 
21                 return {
22                         title = "%H: Processes",
23                         vlabel = "Processes/s",
24                         data = {
25                                 instances = {
26                                         ps_state = {
27                                                 "sleeping", "running", "paging", "blocked", "stopped", "zombies"
28                                         }
29                                 },
30
31                                 options = {
32                                         ps_state_sleeping = { color = "0000ff" },
33                                         ps_state_running  = { color = "008000" },
34                                         ps_state_paging   = { color = "ffff00" },
35                                         ps_state_blocked  = { color = "ff5000" },
36                                         ps_state_stopped  = { color = "555555" },
37                                         ps_state_zombies  = { color = "ff0000" }
38                                 }
39                         }
40                 }
41         else
42                 return {
43                         {
44                                 title = "%H: CPU time used by %pi",
45                                 vlabel = "Jiffies",
46                                 data = {
47                                         sources = {
48                                                 ps_cputime = { "syst", "user" }
49                                         },
50
51                                         options = {
52                                                 ps_cputime__user = {
53                                                         color   = "0000ff",
54                                                         overlay = true
55                                                 },
56
57                                                 ps_cputime__syst = {
58                                                         color   = "ff0000",
59                                                         overlay = true
60                                                 }
61                                         }
62                                 }
63                         },
64
65                         {
66                                 title = "%H: Threads and processes belonging to %pi",
67                                 vlabel = "Count",
68                                 data = {
69                                         sources = {
70                                                 ps_count = { "threads", "processes" }
71                                         },
72
73                                         options = {
74                                                 ps_count__threads   = { color = "00ff00" },
75                                                 ps_count__processes = { color = "0000bb" }
76                                         }
77                                 }
78                         },
79
80                         {
81                                 title = "%H: Page faults in %pi",
82                                 vlabel = "Pagefaults",
83                                 data = {
84                                         sources = {
85                                                 ps_pagefaults = { "minflt", "majflt" }
86                                         },
87
88                                         options = {
89                                                 ps_pagefaults__minflt = { color = "ff0000" },
90                                                 ps_pagefaults__majflt = { color = "ff5500" }
91                                         }
92                                 }
93                         },
94
95                         {
96                                 title = "%H: Virtual memory size of %pi",
97                                 vlabel = "Bytes",
98                                 number_format = "%5.1lf%sB",
99                                 data = {
100                                         types = { "ps_rss" },
101
102                                         options = {
103                                                 ps_rss = { color = "0000ff" }
104                                         }
105                                 }
106                         }
107                 }
108         end
109 end