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