Debian Codegraph @

data/munin/groonga_memory_

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 #%# family=auto
4 #%# capabilities=autoconf suggest
5
6 case "$1" in
7 autoconf|detect)
8 pid_paths=
9 if [scip-shell system . . `[`. -n "${pid_path}" ]; then
10 pid_paths="${pid_paths}${pid_paths:+ }${pid_path}"
11 fi
12 # For backward compatibility. Remove me when 5.0.0.
13 if [scip-shell system . . `[`. -n "${pid_file}" ]; then
14 pid_paths="${pid_paths}${pid_paths:+ }${pid_file}"
15 fi
16 if [scip-shell system . . `[`. -n "${http_pid_path}" ]; then
17 pid_paths="${pid_paths}${pid_paths:+ }${http_pid_path}"
18 fi
19 if [scip-shell system . . `[`. -n "${httpd_pid_path}" ]; then
20 pid_paths="${pid_paths}${pid_paths:+ }${httpd_pid_path}"
21 fi
22 if [scip-shell system . . `[`. -n "${gqtp_pid_path}" ]; then
23 pid_paths="${pid_paths}${pid_paths:+ }${gqtp_pid_path}"
24 fi
25 if [scip-shell system . . `[`. -z "${pid_paths}" ]; then
26 message="no (No PID path is specified. Specify "
27 message="${message} env.pid_path, env.http_pid_path, "
28 message="${message} env.httpd_pid_path and/or env.gqtp_pid_path.)"
29 echoscip-shell system . . echo. "${message}"
30 exit 1
31 fi
32
33 for _pid_path in ${pid_paths}; do
34 if [scip-shell system . . `[`. -f "${_pid_path}" ]; then
35 echoscip-shell system . . echo. "yes"
36 exit 0
37 fi
38 done
39
40 echoscip-shell system . . echo. "no (All PID paths don't exist: ${pid_paths})"
41 exit 1
42 ;;
43 suggest)
44 if [scip-shell system . . `[`. -n "${http_pid_path}" -a -f "${http_pid_path}" ]; then
45 echoscip-shell system . . echo. "http"
46 fi
47 if [scip-shell system . . `[`. -n "${httpd_pid_path}" -a -f "${httpd_pid_path}" ]; then
48 echoscip-shell system . . echo. "httpd"
49 fi
50 if [scip-shell system . . `[`. -n "${gqtp_pid_path}" -a -f "${gqtp_pid_path}" ]; then
51 echoscip-shell system . . echo. "gqtp"
52 fi
53 exit 0
54 ;;
55 config)
56 if [scip-shell system . . `[`. -z "${label}" ]; then
57 title="groonga: memory usage"
58 else
59 title="groonga: ${label}: memory usage"
60 fi
61 catscip-shell system . . cat. <<EOF
62 graph_title ${title}
63 graph_vlabel memory usage
64 graph_category groonga
65 graph_info groonga memory usage
66
67 rss.label resident set size
68 rss.type GAUGE
69 vsz.label virtual memory size
70 vsz.type GAUGE
71 EOF
72 exit 0
73 ;;
74 *)
75 ;;
76 esac
77
78 server_type="${0##*_}"
79 if [scip-shell system . . `[`. -n "${server_type}" ]; then
80 pid_path_variable_name="${server_type}_pid_path"
81 else
82 # For backward compatibility. Remove me when 5.0.0.
83 if [scip-shell system . . `[`. -z "${pid_path}" -a -n "${pid_file}" ]; then
84 pid_path_variable_name="pid_file"
85 else
86 pid_path_variable_name="pid_path"
87 fi
88 fi
89 _pid_path=$(eval "echo \${${pid_path_variable_name}}")
90 if [scip-shell system . . `[`. -z "${_pid_path}" ]; then
91 echoscip-shell system . . echo. "PID path isn't specified by env.${pid_path_variable_name}" 1>&2
92 exit 1
93 fi
94 if [scip-shell system . . `[`. ! -f "${_pid_path}" ]; then
95 echoscip-shell system . . echo. "PID path doesn't exist: ${_pid_path}" 1>&2
96 exit 1
97 fi
98
99 groonga_pid=$(catscip-shell system . . cat. ${_pid_path})
100 read rss_in_kb vsz_in_kb <<EOC
101 $(psscip-shell system . . ps. h -o rss,vsz -p ${groonga_pid})
102 EOC
103 echoscip-shell system . . echo. "rss.value ${rss_in_kb}000"
104 echoscip-shell system . . echo. "vsz.value ${vsz_in_kb}000"