GSMonitor系统资源统计函数
- gs_get_cpustat(start_time timestamptz, end_time timestamptz)
描述:查询一段时间内CPU资源信息的接口,调用该函数必须具有MONADMIN权限或者SYSADMIN权限。
参数说明:
参数名称
参数说明
取值范围
start_time
必选。查询起始时间。
timestamptz类型。
end_time
必选。查询终止时间。
timestamptz类型。
返回值类型:setof record
返回字段说明:
字段名称
字段类型
字段说明
collection_time
timestamptz
采集时间。
cpu_name
text
名称。
%total
float8
总:用户+内核占CPU百分比。
%user
float8
用户态:用户空间占CPU百分比。
%system
float8
系统态:内核空间占CPU百分比。
%idle
float8
空闲CPU百分比。
%iowait
float8
等待IO的CPU百分比。
lavg_1
float8
1分钟负载(单位:个)。
lavg_5
float8
5分钟负载(单位:个)。
lavg_15
float8
15分钟负载(单位:个)。
- gs_get_procstat(start_time timestamptz, end_time timestamptz, sort_order text[, display_type text])
描述:查询一段时间内进程相关信息的接口,调用该函数必须具有MONADMIN权限或者SYSADMIN权限。
参数说明:
参数名称
参数说明
取值范围
start_time
必选。查询起始时间。
timestamptz类型。
end_time
必选。查询终止时间。
timestamptz类型。
sort_order
必选。排序规则。
text类型。取值范围为'IO_R'、'IO_W'、'CPU'、'MEM'(不区分大小写)。
- 'IO_R':按照IO读速率进行降序排序。
- 'IO_W':按照IO写速率进行降序排序。
- 'CPU':按照CPU利用率进行降序排序。
- 'MEM':按照内存使用大小进行降序排序。
display_type
可选。展示方式。
text类型。当前只支持'pretty'(不区分大小写),表示显示隶属关系。
返回值类型:setof record
返回字段说明:
字段名称
字段类型
字段说明
collection_time
timestamptz
采集时间。
pid
int8
进程名称。
tid
int8
线程名称。
state
text
状态。
ppid
int8
父进程ID。
priority
int8
优先级(动态)。
nice
int8
优先级(静态)。
num_threads
int8
线程数量。
utime
float8
用户态运行时间(单位:jiffies 时间片)。
stime
float8
核心态运行时间(单位:jiffies 时间片)。
ssize
int8
共享内存大小(单位:字节)。
vsize
int8
进程虚拟内存大小(单位:字节)。
io_r
float8
IO读速率(单位:次/s)。
io_w
float8
IO写速率(单位:次/s)。
io
float8
IO总速率(单位:次/s)。
rss
int8
进程使用的驻留集大小(单位:页)。
%cpu_usage
float8
CPU使用率。
comm
text
进程的命令名。
- gs_get_iostat(start_time timestamptz, end_time timestamptz[, display_type text])
描述:查询一段时间内IO资源信息的接口,调用该函数必须具有MONADMIN权限或者SYSADMIN权限。
参数说明:
参数名称
参数说明
取值范围
start_time
必选。查询起始时间。
timestamptz类型。
end_time
必选。查询终止时间。
timestamptz类型。
display_type
可选。展示方式。
text类型。当前只支持'pretty'(不区分大小写),表示显示隶属关系。
返回值类型:setof record
返回字段说明:
字段名称
字段类型
字段说明
collection_time
timestamptz
采集时间。
devname
text
设备名称。
rkB/s
float8
IO读速率(单位:kB/s)。
wkB/s
float8
IO写速率(单位:kB/s)。
r/s
float8
每秒读取磁盘的IO操作次数(单位:次/s)。
w/s
float8
每秒写入磁盘的IO操作次数(单位:次/s)。
rawait
float8
读取操作的平均等待时间(单位:毫秒)。
wawait
float8
写入操作的平均等待时间(单位:毫秒)。
svctm
float8
IO平均服务时间(单位:毫秒)。
avgqu-sz
int8
当前IO等待队列数。
%util
float8
磁盘使用率:设备花费在IO操作的时间百分比。
- gs_get_memstat(start_time timestamptz, end_time timestamptz)
描述:查询一段时间内内存资源信息的接口,调用该函数必须具有MONADMIN权限或者SYSADMIN权限。
参数说明:
参数名称
参数说明
取值范围
start_time
必选。查询起始时间。
timestamptz类型。
end_time
必选。查询终止时间。
timestamptz类型。
返回值类型:setof record
返回字段说明:
字段名称
字段类型
字段说明
collection_time
timestamptz
采集时间。
mem_total
int8
内存总大小(单位:字节)。
mem_used
int8
已使用内存大小(单位:字节)。
mem_free
int8
空闲内存大小(单位:字节)。
mem_usage
float8
内存使用率。
buffer
int8
缓冲区占内存大小(单位:字节)。
cache
int8
缓存栈内存大小(单位:字节)。
mem_available
int8
可供启动新应用程序的内存大小(单位:字节)。
active
int8
活跃使用高速缓冲内存的大小(单位:字节)。
inactive
int8
不经常使用高速缓冲内存的大小(单位:字节)。
swap_total
int8
交换空间总大小(单位:字节)。
swap_free
int8
空闲交换空间大小(单位:字节)。
- gs_get_netstat(start_time timestamptz, end_time timestamptz)
描述:查询一段时间内网络资源信息的接口,调用该函数必须具有MONADMIN权限或者SYSADMIN权限。
参数说明:
参数名称
参数说明
取值范围
start_time
必选。查询起始时间。
timestamptz类型。
end_time
必选。查询终止时间。
timestamptz类型。
返回值类型:setof record
返回字段说明:
字段名称
字段类型
字段说明
collection_time
timestamptz
采集时间。
interface
text
接口名称。
tag
text
标签。
rkb/s
float8
接收速率(Kbps)。
tkb/s
float8
发送速率(Kbps)。
kb/s
float8
总速率(Kbps)。
rp/s
float8
接收包速率(个/s)。
tp/s
float8
发送包速率(个/s)。
p/s
float8
数据包总速率(个/s)。
rerr/s
float8
接收包错误速率(个/s)。
terr/s
float8
发送包错误率(个/s)。
%err
float8
总错误率。