-
Notifications
You must be signed in to change notification settings - Fork 11
/
pgnodemx--1.7.sql
354 lines (319 loc) · 8.13 KB
/
pgnodemx--1.7.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
/* pgnodemx--1.7.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pgnodemx" to load this file. \quit
CREATE FUNCTION cgroup_mode()
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_mode'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_path
(
OUT controller TEXT,
OUT path TEXT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_path'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_process_count()
RETURNS INT4
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_process_count'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_scalar_bigint(TEXT)
RETURNS BIGINT
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_scalar_bigint'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_scalar_float8(TEXT)
RETURNS FLOAT8
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_scalar_float8'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_scalar_text(TEXT)
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_scalar_text'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_setof_bigint(TEXT)
RETURNS SETOF BIGINT
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_setof_bigint'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_setof_text(TEXT)
RETURNS SETOF TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_setof_text'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_array_text(TEXT)
RETURNS TEXT[]
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_array_text'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_array_bigint(TEXT)
RETURNS BIGINT[]
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_array_bigint'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_setof_kv
(
IN filename TEXT,
OUT key TEXT,
OUT val BIGINT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_setof_kv'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_setof_ksv
(
IN filename TEXT,
OUT key TEXT,
OUT subkey TEXT,
OUT val BIGINT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_setof_ksv'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION cgroup_setof_nkv
(
IN filename TEXT,
OUT key TEXT,
OUT subkey TEXT,
OUT val FLOAT8
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_cgroup_setof_nkv'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION envvar_text(TEXT)
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_envvar_text'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION envvar_bigint(TEXT)
RETURNS BIGINT
AS 'MODULE_PATHNAME', 'pgnodemx_envvar_bigint'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION kdapi_scalar_bigint(TEXT)
RETURNS BIGINT
AS 'MODULE_PATHNAME', 'pgnodemx_kdapi_scalar_bigint'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION kdapi_setof_kv
(
IN filename TEXT,
OUT key TEXT,
OUT val TEXT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_kdapi_setof_kv'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION fips_mode()
RETURNS BOOL
AS 'MODULE_PATHNAME', 'pgnodemx_fips_mode'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION symbol_filename(TEXT)
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_symbol_filename'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION pgnodemx_version()
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_version'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION proc_diskstats
(
OUT major_number BIGINT,
OUT minor_number BIGINT,
OUT device_name TEXT,
OUT reads_completed_successfully NUMERIC,
OUT reads_merged NUMERIC,
OUT sectors_read NUMERIC,
OUT time_spent_reading_ms BIGINT,
OUT writes_completed NUMERIC,
OUT writes_merged NUMERIC,
OUT sectors_written NUMERIC,
OUT time_spent_writing_ms BIGINT,
OUT ios_currently_in_progress BIGINT,
OUT time_spent_doing_ios_ms BIGINT,
OUT weighted_time_spent_doing_ios_ms BIGINT,
OUT discards_completed_successfully NUMERIC,
OUT discards_merged NUMERIC,
OUT sectors_discarded NUMERIC,
OUT time_spent_discarding BIGINT,
OUT flush_requests_completed_successfully NUMERIC,
OUT time_spent_flushing BIGINT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_diskstats'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION proc_mountinfo
(
OUT mount_id BIGINT,
OUT parent_id BIGINT,
OUT major_number BIGINT,
OUT minor_number BIGINT,
OUT root TEXT,
OUT mount_point TEXT,
OUT mount_options TEXT,
OUT fs_type TEXT,
OUT mount_source TEXT,
OUT super_options TEXT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_mountinfo'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION proc_meminfo
(
OUT key TEXT,
OUT val BIGINT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_meminfo'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION proc_network_stats
(
OUT interface TEXT,
OUT rx_bytes BIGINT,
OUT rx_packets BIGINT,
OUT rx_errs BIGINT,
OUT rx_drop BIGINT,
OUT rx_fifo BIGINT,
OUT rx_frame BIGINT,
OUT rx_compressed BIGINT,
OUT rx_multicast BIGINT,
OUT tx_bytes BIGINT,
OUT tx_packets BIGINT,
OUT tx_errs BIGINT,
OUT tx_drop BIGINT,
OUT tx_fifo BIGINT,
OUT tx_frame BIGINT,
OUT tx_compressed BIGINT,
OUT tx_multicast BIGINT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_network_stats'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION fsinfo
(
IN pathname TEXT,
OUT major_number NUMERIC,
OUT minor_number NUMERIC,
OUT type TEXT,
OUT block_size NUMERIC,
OUT blocks NUMERIC,
OUT total_bytes NUMERIC,
OUT free_blocks NUMERIC,
OUT free_bytes NUMERIC,
OUT available_blocks NUMERIC,
OUT available_bytes NUMERIC,
OUT total_file_nodes NUMERIC,
OUT free_file_nodes NUMERIC,
OUT mount_flags TEXT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_fsinfo'
LANGUAGE C STABLE STRICT;
CREATE FUNCTION proc_pid_io(
OUT pid INTEGER,
OUT rchar NUMERIC,
OUT wchar NUMERIC,
OUT syscr NUMERIC,
OUT syscw NUMERIC,
OUT reads NUMERIC,
OUT writes NUMERIC,
OUT cwrites NUMERIC)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_pid_io'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION proc_pid_cmdline(
OUT pid INTEGER,
OUT fullcomm TEXT,
OUT uid INTEGER,
OUT username TEXT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_pid_cmdline'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION proc_pid_stat(
OUT pid INTEGER,
OUT comm TEXT,
OUT state TEXT,
OUT ppid INTEGER,
OUT pgrp INTEGER,
OUT session INTEGER,
OUT tty_nr INTEGER,
OUT tpgid INTEGER,
OUT flags BIGINT,
OUT minflt NUMERIC,
OUT cminflt NUMERIC,
OUT majflt NUMERIC,
OUT cmajflt NUMERIC,
OUT utime NUMERIC,
OUT stime NUMERIC,
OUT cutime BIGINT,
OUT cstime BIGINT,
OUT priority BIGINT,
OUT nice BIGINT,
OUT num_threads BIGINT,
OUT itrealvalue BIGINT,
OUT starttime NUMERIC,
OUT vsize NUMERIC,
OUT rss BIGINT,
OUT rsslim NUMERIC,
OUT startcode NUMERIC,
OUT endcode NUMERIC,
OUT startstack NUMERIC,
OUT kstkesp NUMERIC,
OUT kstkeip NUMERIC,
OUT signal NUMERIC,
OUT blocked NUMERIC,
OUT sigignore NUMERIC,
OUT sigcatch NUMERIC,
OUT wchan NUMERIC,
OUT nswap NUMERIC,
OUT cnswap NUMERIC,
OUT exit_signal INTEGER,
OUT processor INTEGER,
OUT rt_priority BIGINT,
OUT policy BIGINT,
OUT delayacct_blkio_ticks NUMERIC,
OUT guest_time NUMERIC,
OUT cguest_time BIGINT,
OUT start_data NUMERIC,
OUT end_data NUMERIC,
OUT start_brk NUMERIC,
OUT arg_start NUMERIC,
OUT arg_end NUMERIC,
OUT env_start NUMERIC,
OUT env_end NUMERIC,
OUT exit_code INTEGER)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_pid_stat'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION kpages_to_bytes(NUMERIC)
RETURNS NUMERIC
AS 'MODULE_PATHNAME', 'pgnodemx_pages_to_bytes'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION proc_cputime(
OUT "user" BIGINT,
OUT nice BIGINT,
OUT system BIGINT,
OUT idle BIGINT,
OUT iowait BIGINT)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_cputime'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION proc_loadavg(
OUT load1 FLOAT,
OUT load5 FLOAT,
OUT load15 FLOAT,
OUT last_pid INTEGER)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_proc_loadavg'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION exec_path()
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_exec_path'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION stat_file(
IN filename TEXT,
OUT uid NUMERIC,
OUT username TEXT,
OUT gid NUMERIC,
OUT groupname TEXT,
OUT filemode TEXT
)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'pgnodemx_stat_file'
LANGUAGE C IMMUTABLE STRICT;
CREATE FUNCTION openssl_version()
RETURNS TEXT
AS 'MODULE_PATHNAME', 'pgnodemx_openssl_version'
LANGUAGE C IMMUTABLE STRICT;