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