diff --git a/pkg/hostman/guestfs/fsdriver/linux_init.go b/pkg/hostman/guestfs/fsdriver/linux_init.go index 63e1406180..1eba46df82 100644 --- a/pkg/hostman/guestfs/fsdriver/linux_init.go +++ b/pkg/hostman/guestfs/fsdriver/linux_init.go @@ -69,6 +69,9 @@ After=local-fs.target After=network.target [Service] +LimitNOFILE=65535 +CapabilityBoundingSet=CAP_NET_RAW +AmbientCapabilities=CAP_NET_RAW ExecStart=%s RemainAfterExit=true Type=%s diff --git a/pkg/hostman/system_service/telegraf.go b/pkg/hostman/system_service/telegraf.go index 84387d9842..aa71cb194b 100644 --- a/pkg/hostman/system_service/telegraf.go +++ b/pkg/hostman/system_service/telegraf.go @@ -196,6 +196,8 @@ func (s *STelegraf) GetConfig(kwargs map[string]interface{}) string { conf += "[[inputs.smart]]\n" conf += " path=\"/usr/sbin/smartctl\"\n" conf += "\n" + conf += "[[inputs.sensors]]\n" + conf += "\n" conf += "[[inputs.net]]\n" if nics, ok := kwargs["nics"]; ok { ns, _ := nics.([]map[string]interface{}) diff --git a/pkg/monitor/dbinit/measurements/all.go b/pkg/monitor/dbinit/measurements/all.go new file mode 100644 index 0000000000..f9fa3b2369 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/all.go @@ -0,0 +1,101 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +var All = []SMeasurement{ + bond, + bondSlave, + + cpu, + disk, + diskio, + linuxSysctlFs, + mem, + net, + netint, + nvidia, + processes, + radeontop, + system, + vasmi, + + vmCpu, + vmMem, + vmDisk, + vmDiskio, + vmNetio, + + cloudAccount, + + dcsRedisCpu, + dcsRedisMem, + dcsRedisNetio, + dcsRedisConn, + dcsRedisInstanceOpt, + dcsRedisCachekeys, + dcsRedisDatamem, + + haproxy, + + internalAgent, + internalGather, + internalMemstats, + internalWrite, + + jenkinsNode, + jenkinsJob, + + k8sPod, + k8sDeploy, + k8sNode, + + kernel, + kernelVmstat, + + mysql, + + netstat, + + ntpq, + + ossLatency, + ossNetio, + ossReq, + + ping, + + rabbitmqOverview, + rabbitmqNode, + rabbitmqQueue, + + rdsConn, + rdsCpu, + rdsMem, + rdsNetio, + rdsDisk, + + redis, + redisKeyspace, + + sensors, + + smartctl, + + storage, + + swap, + + temp, +} diff --git a/pkg/monitor/dbinit/measurements/bond.go b/pkg/monitor/dbinit/measurements/bond.go new file mode 100644 index 0000000000..046897b549 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/bond.go @@ -0,0 +1,63 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var bond = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "bond", + DisplayName: "Bond interface", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "active_slave", + DisplayName: "used SNAT port count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "status", + DisplayName: "Status of bond interface (down = 0, up = 1)", + Unit: monitor.METRIC_UNIT_NULL, + }, + }, +} + +var bondSlave = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "bond_slave", + DisplayName: "Slave interfaces of bond interface", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "status", + DisplayName: "Status of bonds's slave interface (down = 0, up = 1)", + Unit: monitor.METRIC_UNIT_NULL, + }, + { + Name: "failures", + DisplayName: "Amount of failures for bond's slave interface", + Unit: monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/cloudaccount.go b/pkg/monitor/dbinit/measurements/cloudaccount.go new file mode 100644 index 0000000000..e2ab939616 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/cloudaccount.go @@ -0,0 +1,32 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var cloudAccount = SMeasurement{ + Context: []SMonitorContext{ + { + "cloudaccount_balance", "Cloud account balance", + monitor.METRIC_RES_TYPE_CLOUDACCOUNT, + monitor.METRIC_DATABASE_METER, + }, + }, + Metrics: []SMetric{ + { + "balance", "balance", monitor.METRIC_UNIT_NULL, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/cpu.go b/pkg/monitor/dbinit/measurements/cpu.go new file mode 100644 index 0000000000..96a806ddc7 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/cpu.go @@ -0,0 +1,91 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var cpu = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "cpu", + DisplayName: "CPU usage", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + { + Name: "agent_cpu", + DisplayName: "CPU usage", + ResourceType: monitor.METRIC_RES_TYPE_AGENT, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "usage_active", + DisplayName: "CPU active state utilization rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_idle", + DisplayName: "CPU idle state utilization rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_system", + DisplayName: "CPU system state utilization rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_user", + DisplayName: "CPU user mode utilization rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_iowait", + DisplayName: "CPU IO usage", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_irq", + DisplayName: "CPU IRQ usage", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_guest", + DisplayName: "CPU guest usage", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_nice", + DisplayName: "CPU priority switch utilization", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_softirq", + DisplayName: "CPU softirq usage", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_steal", + DisplayName: "CPU steal usage", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "usage_guest_nice", + DisplayName: "CPU guest nice usage", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/dcs.go b/pkg/monitor/dbinit/measurements/dcs.go new file mode 100644 index 0000000000..2e2fb1b6e1 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/dcs.go @@ -0,0 +1,125 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var dcsRedisCpu = SMeasurement{ + Context: []SMonitorContext{ + { + "dcs_cpu", "Redis CPU usage", monitor.METRIC_RES_TYPE_REDIS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "usage_percent", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, + }, + { + "server_load", "server load", monitor.METRIC_UNIT_PERCENT, + }, + }, +} + +var dcsRedisMem = SMeasurement{ + Context: []SMonitorContext{ + { + "dcs_mem", "Redis memory", monitor.METRIC_RES_TYPE_REDIS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, + }, + }, +} + +var dcsRedisNetio = SMeasurement{ + Context: []SMonitorContext{ + { + "dcs_netio", "Redis network traffic", + monitor.METRIC_RES_TYPE_REDIS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, + }, + { + "bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, + }, + }, +} + +var dcsRedisConn = SMeasurement{ + Context: []SMonitorContext{ + { + "dcs_conn", "Redis connect", monitor.METRIC_RES_TYPE_REDIS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_percent", "Connection usage", monitor.METRIC_UNIT_PERCENT, + }, + { + "errors", "Connection errors", monitor.METRIC_UNIT_COUNT, + }, + }, +} + +var dcsRedisInstanceOpt = SMeasurement{ + Context: []SMonitorContext{ + { + "dcs_instantopt", "Redis operator", + monitor.METRIC_RES_TYPE_REDIS, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "opt_sec", "Number of commands processed per second", monitor.METRIC_UNIT_COUNT, + }, + }, +} + +var dcsRedisCachekeys = SMeasurement{ + Context: []SMonitorContext{ + { + "dcs_cachekeys", "Redis keys", monitor.METRIC_RES_TYPE_REDIS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "key_count", "Number of cache keys", monitor.METRIC_UNIT_COUNT, + }, + }, +} + +var dcsRedisDatamem = SMeasurement{ + Context: []SMonitorContext{ + { + "dcs_datamem", "Redis data memory", monitor.METRIC_RES_TYPE_REDIS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_byte", "Data node memory usage", monitor.METRIC_UNIT_BYTE, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/disk.go b/pkg/monitor/dbinit/measurements/disk.go new file mode 100644 index 0000000000..4f42cc748c --- /dev/null +++ b/pkg/monitor/dbinit/measurements/disk.go @@ -0,0 +1,81 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var disk = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "disk", + DisplayName: "Disk usage", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + { + Name: "agent_disk", + DisplayName: "Disk usage", + ResourceType: monitor.METRIC_RES_TYPE_AGENT, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "used_percent", + DisplayName: "Percentage of used disks", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "free", + DisplayName: "Free space size", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "used", + DisplayName: "Used disk size", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "total", + DisplayName: "Total disk size", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "inodes_used_percent", + DisplayName: "Percentage of used inodes", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "inodes_free", + DisplayName: "Available inode", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "inodes_used", + DisplayName: "Number of inodes used", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "inodes_total", + DisplayName: "Total inodes", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "read_only", + DisplayName: "Test if disk is read only", + Unit: monitor.METRIC_UNIT_NULL, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/diskio.go b/pkg/monitor/dbinit/measurements/diskio.go new file mode 100644 index 0000000000..20819e06b8 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/diskio.go @@ -0,0 +1,161 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var diskio = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "diskio", + DisplayName: "Disk traffic and timing", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + { + Name: "agent_diskio", + DisplayName: "Disk traffic and timing", + ResourceType: monitor.METRIC_RES_TYPE_AGENT, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "bps", + DisplayName: "Disk read and write rate", + Unit: monitor.METRIC_UNIT_BYTEPS, + }, + { + Name: "read_bps", + DisplayName: "Disk read rate", + Unit: monitor.METRIC_UNIT_BYTEPS, + }, + { + Name: "write_bps", + DisplayName: "Disk write rate", + Unit: monitor.METRIC_UNIT_BYTEPS, + }, + { + Name: "read_iops", + DisplayName: "Disk read operate rate", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "write_iops", + DisplayName: "Disk write operate rate", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "iops", + DisplayName: "Disk read/write operate rate", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "reads", + DisplayName: "Number of reads", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "writes", + DisplayName: "Number of writes", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "iocount", + DisplayName: "Accumulated I/O request count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "read_bytes", + DisplayName: "Bytes read", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "write_bytes", + DisplayName: "Bytes write", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "iobytes", + DisplayName: "Bytes of both read and write", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "read_time", + DisplayName: "Time to wait for read", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "write_time", + DisplayName: "Time to wait for write", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "io_time", + DisplayName: "I / O request queuing time", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "read_await", + DisplayName: "Time to wait for read", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "write_await", + DisplayName: "Time to wait for write", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "await", + DisplayName: "I / O request queuing time", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "merged_reads", + DisplayName: "Merged disk read request count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "merged_writes", + DisplayName: "Merged disk write request count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "merged_iocount", + DisplayName: "Merged Accumulated I/O request count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "weighted_io_time", + DisplayName: "I / O request waiting time", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "iops_in_progress", + DisplayName: "Number of I / O requests issued but not yet completed", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "ioutil", + DisplayName: "IO utilization in percentage", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "avgqu_sz", + DisplayName: "Averate queing request count per seconds", + Unit: monitor.METRIC_UNIT_NULL, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/doc.go b/pkg/monitor/dbinit/measurements/doc.go new file mode 100644 index 0000000000..865727fd02 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/doc.go @@ -0,0 +1,15 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements // import "yunion.io/x/onecloud/pkg/monitor/dbinit/measurements" diff --git a/pkg/monitor/dbinit/measurements/haproxy.go b/pkg/monitor/dbinit/measurements/haproxy.go new file mode 100644 index 0000000000..50d311db7c --- /dev/null +++ b/pkg/monitor/dbinit/measurements/haproxy.go @@ -0,0 +1,34 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var haproxy = SMeasurement{ + Context: []SMonitorContext{ + { + "haproxy", "load balance", monitor.METRIC_RES_TYPE_ELB, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_snat_port", "used SNAT port count", monitor.METRIC_UNIT_COUNT, + }, + { + "snat_conn_count", "SNAT connection count", monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/internal.go b/pkg/monitor/dbinit/measurements/internal.go new file mode 100644 index 0000000000..a73129563d --- /dev/null +++ b/pkg/monitor/dbinit/measurements/internal.go @@ -0,0 +1,149 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var internalMemstats = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "internal_memstats", + DisplayName: "Memory usage statistics of telegraf agent", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "alloc_bytes", + DisplayName: "alloc_bytes", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "frees", + }, + { + Name: "heap_alloc_bytes", + }, + { + Name: "heap_idle_bytes", + }, + { + Name: "heap_in_use_bytes", + }, + { + Name: "heap_objects_bytes", + }, + { + Name: "heap_released_bytes", + }, + { + Name: "heap_sys_bytes", + }, + { + Name: "mallocs", + }, + { + Name: "num_gc", + }, + { + Name: "pointer_lookups", + }, + { + Name: "sys_bytes", + }, + { + Name: "total_alloc_bytes", + }, + }, +} + +var internalAgent = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "internal_agent", + DisplayName: "Agent wide statistics of telegraf agent", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "gather_errors", + }, + { + Name: "metrics_dropped", + }, + { + Name: "metrics_gathered", + }, + { + Name: "metrics_written", + }, + }, +} + +var internalGather = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "internal_gather", + DisplayName: "Gather statistics of telegraf agent", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "gather_time_ns", + }, + { + Name: "metrics_gathered", + }, + }, +} + +var internalWrite = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "internal_write", + DisplayName: "Write statistics of telegraf agent", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "buffer_limit", + }, + { + Name: "buffer_size", + }, + { + Name: "metrics_added", + }, + { + Name: "metrics_written", + }, + { + Name: "metrics_dropped", + }, + { + Name: "metrics_filtered", + }, + { + Name: "write_time_ns", + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/jenkins.go b/pkg/monitor/dbinit/measurements/jenkins.go new file mode 100644 index 0000000000..c059eef42a --- /dev/null +++ b/pkg/monitor/dbinit/measurements/jenkins.go @@ -0,0 +1,63 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var jenkinsNode = SMeasurement{ + Context: []SMonitorContext{ + { + "jenkins_node", "jenkins node", + monitor.METRIC_RES_TYPE_JENKINS, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "disk_available", "disk_available", monitor.METRIC_UNIT_BYTE, + }, + { + "temp_available", "temp_available", monitor.METRIC_UNIT_BYTE, + }, + { + "memory_available", "memory_available", monitor.METRIC_UNIT_BYTE, + }, + { + "memory_total", "memory_total", monitor.METRIC_UNIT_BYTE, + }, + { + "swap_available", "swap_available", monitor.METRIC_UNIT_BYTE, + }, + { + "swap_total", "swap_total", monitor.METRIC_UNIT_BYTE, + }, + }, +} + +var jenkinsJob = SMeasurement{ + Context: []SMonitorContext{ + { + "jenkins_job", "jenkins job", + monitor.METRIC_RES_TYPE_JENKINS, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "duration", "duration", monitor.METRIC_UNIT_MS, + }, + { + "number", "number", monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/k8s.go b/pkg/monitor/dbinit/measurements/k8s.go new file mode 100644 index 0000000000..84def22cf4 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/k8s.go @@ -0,0 +1,99 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var k8sPod = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "k8s_pod", + DisplayName: "k8s pod", + ResourceType: monitor.METRIC_RES_TYPE_K8S, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "cpu_used_percent", + DisplayName: "CPU active state utilization rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "mem_used_percent", + DisplayName: "Used memory rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "restart_total", + DisplayName: "pod restart count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + }, +} + +var k8sDeploy = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "k8s_deploy", + DisplayName: "k8s deploy", + ResourceType: monitor.METRIC_RES_TYPE_K8S, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "pod_oom_total", + DisplayName: "oom pod count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pod_restarting_total", + DisplayName: "restarting pod count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + }, +} + +var k8sNode = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "k8s_node", + DisplayName: "k8s node", + ResourceType: monitor.METRIC_RES_TYPE_K8S, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "cpu_used_percent", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, + }, + { + "mem_used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, + }, + { + "disk_used_percent", "Percentage of used disks", monitor.METRIC_UNIT_PERCENT, + }, + { + "bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, + }, + { + "bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, + }, + { + "pod_restart_total", "pod restart count in node", monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/kernel.go b/pkg/monitor/dbinit/measurements/kernel.go new file mode 100644 index 0000000000..8a5b21be93 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/kernel.go @@ -0,0 +1,65 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var kernel = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "kernel", + DisplayName: "kernel metrics", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "boot_time", + DisplayName: "seconds since epoch, btime", + Unit: monitor.METRIC_UNIT_SEC, + }, + { + Name: "context_switches", + DisplayName: "context switch count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "disk_pages_in", + DisplayName: "page in count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "disk_pages_out", + DisplayName: "page out count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "interrupts", + DisplayName: "interrupts count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "processes_forked", + DisplayName: "processes forked count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "entropy_avail", + DisplayName: "entropy available", + Unit: monitor.METRIC_UNIT_NULL, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/kernel_vmstat.go b/pkg/monitor/dbinit/measurements/kernel_vmstat.go new file mode 100644 index 0000000000..31ce2f9d47 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/kernel_vmstat.go @@ -0,0 +1,485 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var kernelVmstat = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "kernel_vmstat", + DisplayName: "kernel vmstat", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "nr_free_pages", + DisplayName: "nr_free_pages", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_inactive_anon", + DisplayName: "(integer, nr_inactive_anon)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_active_anon", + DisplayName: "(integer, nr_active_anon)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_inactive_file", + DisplayName: "(integer, nr_inactive_file)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_active_file", + DisplayName: "(integer, nr_active_file)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_unevictable", + DisplayName: "(integer, nr_unevictable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_mlock", + DisplayName: "(integer, nr_mlock)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_anon_pages", + DisplayName: "(integer, nr_anon_pages)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_mapped", + DisplayName: "(integer, nr_mapped)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_file_pages", + DisplayName: "(integer, nr_file_pages)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_dirty", + DisplayName: "(integer, nr_dirty)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_writeback", + DisplayName: "(integer, nr_writeback)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_slab_reclaimable", + DisplayName: "(integer, nr_slab_reclaimable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_slab_unreclaimable", + DisplayName: "(integer, nr_slab_unreclaimable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_page_table_pages", + DisplayName: "(integer, nr_page_table_pages)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_kernel_stack", + DisplayName: "(integer, nr_kernel_stack)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_unstable", + DisplayName: "(integer, nr_unstable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_bounce", + DisplayName: "(integer, nr_bounce)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_vmscan_write", + DisplayName: "(integer, nr_vmscan_write)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_writeback_temp", + DisplayName: "(integer, nr_writeback_temp)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_isolated_anon", + DisplayName: "(integer, nr_isolated_anon)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_isolated_file", + DisplayName: "(integer, nr_isolated_file)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_shmem", + DisplayName: "(integer, nr_shmem)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "numa_hit", + DisplayName: "(integer, numa_hit)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "numa_miss", + DisplayName: "(integer, numa_miss)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "numa_foreign", + DisplayName: "(integer, numa_foreign)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "numa_interleave", + DisplayName: "(integer, numa_interleave)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "numa_local", + DisplayName: "(integer, numa_local)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "numa_other", + DisplayName: "(integer, numa_other)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_anon_transparent_hugepages", + DisplayName: "(integer, nr_anon_transparent_hugepages)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgpgin", + DisplayName: "(integer, pgpgin)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgpgout", + DisplayName: "(integer, pgpgout)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pswpin", + DisplayName: "(integer, pswpin)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pswpout", + DisplayName: "(integer, pswpout)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgalloc_dma", + DisplayName: "(integer, pgalloc_dma)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgalloc_dma32", + DisplayName: "(integer, pgalloc_dma32)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgalloc_normal", + DisplayName: "(integer, pgalloc_normal)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgalloc_movable", + DisplayName: "(integer, pgalloc_movable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgfree", + DisplayName: "(integer, pgfree)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgactivate", + DisplayName: "(integer, pgactivate)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgdeactivate", + DisplayName: "(integer, pgdeactivate)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgfault", + DisplayName: "(integer, pgfault)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgmajfault", + DisplayName: "(integer, pgmajfault)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgrefill_dma", + DisplayName: "(integer, pgrefill_dma)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgrefill_dma32", + DisplayName: "(integer, pgrefill_dma32)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgrefill_normal", + DisplayName: "(integer, pgrefill_normal)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgrefill_movable", + DisplayName: "(integer, pgrefill_movable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgsteal_dma", + DisplayName: "(integer, pgsteal_dma)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgsteal_dma32", + DisplayName: "(integer, pgsteal_dma32)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgsteal_normal", + DisplayName: "(integer, pgsteal_normal)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgsteal_movable", + DisplayName: "(integer, pgsteal_movable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgscan_kswapd_dma", + DisplayName: "(integer, pgscan_kswapd_dma)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgscan_kswapd_dma32", + DisplayName: "(integer, pgscan_kswapd_dma32)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgscan_kswapd_normal", + DisplayName: "(integer, pgscan_kswapd_normal)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgscan_kswapd_movable", + DisplayName: "(integer, pgscan_kswapd_movable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgscan_direct_dma", + DisplayName: "(integer, pgscan_direct_dma)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgscan_direct_dma32", + DisplayName: "(integer, pgscan_direct_dma32)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgscan_direct_normal", + DisplayName: "(integer, pgscan_direct_normal)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgscan_direct_movable", + DisplayName: "(integer, pgscan_direct_movable)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "zone_reclaim_failed", + DisplayName: "(integer, zone_reclaim_failed)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pginodesteal", + DisplayName: "(integer, pginodesteal)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "slabs_scanned", + DisplayName: "(integer, slabs_scanned)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "kswapd_steal", + DisplayName: "(integer, kswapd_steal)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "kswapd_inodesteal", + DisplayName: "(integer, kswapd_inodesteal)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "kswapd_low_wmark_hit_quickly", + DisplayName: "(integer, kswapd_low_wmark_hit_quickly)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "kswapd_high_wmark_hit_quickly", + DisplayName: "(integer, kswapd_high_wmark_hit_quickly)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "kswapd_skip_congestion_wait", + DisplayName: "(integer, kswapd_skip_congestion_wait)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pageoutrun", + DisplayName: "(integer, pageoutrun)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "allocstall", + DisplayName: "(integer, allocstall)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "pgrotated", + DisplayName: "(integer, pgrotated)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "compact_blocks_moved", + DisplayName: "(integer, compact_blocks_moved)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "compact_pages_moved", + DisplayName: "(integer, compact_pages_moved)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "compact_pagemigrate_failed", + DisplayName: "(integer, compact_pagemigrate_failed)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "compact_stall", + DisplayName: "(integer, compact_stall)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "compact_fail", + DisplayName: "(integer, compact_fail)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "compact_success", + DisplayName: "(integer, compact_success)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "htlb_buddy_alloc_success", + DisplayName: "(integer, htlb_buddy_alloc_success)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "htlb_buddy_alloc_fail", + DisplayName: "(integer, htlb_buddy_alloc_fail)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "unevictable_pgs_culled", + DisplayName: "(integer, unevictable_pgs_culled)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "unevictable_pgs_scanned", + DisplayName: "(integer, unevictable_pgs_scanned)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "unevictable_pgs_rescued", + DisplayName: "(integer, unevictable_pgs_rescued)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "unevictable_pgs_mlocked", + DisplayName: "(integer, unevictable_pgs_mlocked)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "unevictable_pgs_munlocked", + DisplayName: "(integer, unevictable_pgs_munlocked)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "unevictable_pgs_cleared", + DisplayName: "(integer, unevictable_pgs_cleared)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "unevictable_pgs_stranded", + DisplayName: "(integer, unevictable_pgs_stranded)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "unevictable_pgs_mlockfreed", + DisplayName: "(integer, unevictable_pgs_mlockfreed)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "thp_fault_alloc", + DisplayName: "(integer, thp_fault_alloc)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "thp_fault_fallback", + DisplayName: "(integer, thp_fault_fallback)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "thp_collapse_alloc", + DisplayName: "(integer, thp_collapse_alloc)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "thp_collapse_alloc_failed", + DisplayName: "(integer, thp_collapse_alloc_failed)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "thp_split", + DisplayName: "(integer, thp_split)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/linux_sysctl_fs.go b/pkg/monitor/dbinit/measurements/linux_sysctl_fs.go new file mode 100644 index 0000000000..570932eec7 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/linux_sysctl_fs.go @@ -0,0 +1,65 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var linuxSysctlFs = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "linux_sysctl_fs", + DisplayName: "Provides Linux sysctl fs metrics", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "file_nr", + DisplayName: "The number of allocated file handles", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "file_max", + DisplayName: "The maximum number of file handles that the Linux kernel will allocate.", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "inode_nr", + DisplayName: "The number of inodes the system has allocated", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "inode_free_nr", + DisplayName: "The number of free inodes", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "aio_nr", + DisplayName: "The running total of the number of events specified on the io_setup system call for all currently active aio contexts", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "aio_max_nr", + DisplayName: "The running total of the number of events specified on the io_setup system call for all currently active aio contexts", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "nr_open", + DisplayName: "the maximum number of file-handles a process can allocate", + Unit: monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/measurement_test.go b/pkg/monitor/dbinit/measurements/measurement_test.go new file mode 100644 index 0000000000..a38aafce30 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/measurement_test.go @@ -0,0 +1,40 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import ( + "fmt" + "os" + "testing" +) + +func TestOutputMetrics(t *testing.T) { + f, err := os.Create("metrics.csv") + if err != nil { + t.Fatalf("create metrics.csv fail %s", err) + } + defer f.Close() + qCSV := func(str string) string { + return fmt.Sprintf("%q", str) + } + f.WriteString("Measurement,MeasurementNote,ResourceType,Database,Metric,MetricNote,MetricUnit\n") + for _, measurement := range All { + for _, ctx := range measurement.Context { + for _, metric := range measurement.Metrics { + f.WriteString(fmt.Sprintf("%s,%s,%s,%s,%s,%s,%s\n", qCSV(ctx.Name), qCSV(ctx.DisplayName), qCSV(ctx.ResourceType), qCSV(ctx.Database), qCSV(metric.Name), qCSV(metric.DisplayName), qCSV(metric.Unit))) + } + } + } +} diff --git a/pkg/monitor/dbinit/measurements/mem.go b/pkg/monitor/dbinit/measurements/mem.go new file mode 100644 index 0000000000..c75f690d56 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/mem.go @@ -0,0 +1,96 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var mem = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "mem", + DisplayName: "Memory", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + { + Name: "agent_mem", + DisplayName: "Memory", + ResourceType: monitor.METRIC_RES_TYPE_AGENT, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "used_percent", + DisplayName: "Used memory rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "available_percent", + DisplayName: "Available memory rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "free_percent", + DisplayName: "Free memory rate", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "used", + DisplayName: "Used memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "free", + DisplayName: "Free memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "active", + DisplayName: "The amount of active memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "inactive", + DisplayName: "The amount of inactive memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "cached", + DisplayName: "Cache memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "buffered", + DisplayName: "Buffer memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "slab", + DisplayName: "Number of kernel caches", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "available", + DisplayName: "Available memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "total", + DisplayName: "Total memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/metrics.csv b/pkg/monitor/dbinit/measurements/metrics.csv new file mode 100644 index 0000000000..28caf4bad5 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/metrics.csv @@ -0,0 +1,514 @@ +Measurement,MeasurementNote,ResourceType,Database,Metric,MetricNote,MetricUnit +"bond","Bond interface","host","telegraf","active_slave","used SNAT port count","count" +"bond","Bond interface","host","telegraf","status","Status of bond interface (down = 0, up = 1)","NULL" +"bond_slave","Slave interfaces of bond interface","host","telegraf","status","Status of bonds's slave interface (down = 0, up = 1)","NULL" +"bond_slave","Slave interfaces of bond interface","host","telegraf","failures","Amount of failures for bond's slave interface","count" +"cpu","CPU usage","host","telegraf","usage_active","CPU active state utilization rate","%" +"cpu","CPU usage","host","telegraf","usage_idle","CPU idle state utilization rate","%" +"cpu","CPU usage","host","telegraf","usage_system","CPU system state utilization rate","%" +"cpu","CPU usage","host","telegraf","usage_user","CPU user mode utilization rate","%" +"cpu","CPU usage","host","telegraf","usage_iowait","CPU IO usage","%" +"cpu","CPU usage","host","telegraf","usage_irq","CPU IRQ usage","%" +"cpu","CPU usage","host","telegraf","usage_guest","CPU guest usage","%" +"cpu","CPU usage","host","telegraf","usage_nice","CPU priority switch utilization","%" +"cpu","CPU usage","host","telegraf","usage_softirq","CPU softirq usage","%" +"cpu","CPU usage","host","telegraf","usage_steal","CPU steal usage","%" +"cpu","CPU usage","host","telegraf","usage_guest_nice","CPU guest nice usage","%" +"agent_cpu","CPU usage","agent","telegraf","usage_active","CPU active state utilization rate","%" +"agent_cpu","CPU usage","agent","telegraf","usage_idle","CPU idle state utilization rate","%" +"agent_cpu","CPU usage","agent","telegraf","usage_system","CPU system state utilization rate","%" +"agent_cpu","CPU usage","agent","telegraf","usage_user","CPU user mode utilization rate","%" +"agent_cpu","CPU usage","agent","telegraf","usage_iowait","CPU IO usage","%" +"agent_cpu","CPU usage","agent","telegraf","usage_irq","CPU IRQ usage","%" +"agent_cpu","CPU usage","agent","telegraf","usage_guest","CPU guest usage","%" +"agent_cpu","CPU usage","agent","telegraf","usage_nice","CPU priority switch utilization","%" +"agent_cpu","CPU usage","agent","telegraf","usage_softirq","CPU softirq usage","%" +"agent_cpu","CPU usage","agent","telegraf","usage_steal","CPU steal usage","%" +"agent_cpu","CPU usage","agent","telegraf","usage_guest_nice","CPU guest nice usage","%" +"disk","Disk usage","host","telegraf","used_percent","Percentage of used disks","%" +"disk","Disk usage","host","telegraf","free","Free space size","byte" +"disk","Disk usage","host","telegraf","used","Used disk size","byte" +"disk","Disk usage","host","telegraf","total","Total disk size","byte" +"disk","Disk usage","host","telegraf","inodes_used_percent","Percentage of used inodes","%" +"disk","Disk usage","host","telegraf","inodes_free","Available inode","count" +"disk","Disk usage","host","telegraf","inodes_used","Number of inodes used","count" +"disk","Disk usage","host","telegraf","inodes_total","Total inodes","count" +"disk","Disk usage","host","telegraf","read_only","Test if disk is read only","NULL" +"agent_disk","Disk usage","agent","telegraf","used_percent","Percentage of used disks","%" +"agent_disk","Disk usage","agent","telegraf","free","Free space size","byte" +"agent_disk","Disk usage","agent","telegraf","used","Used disk size","byte" +"agent_disk","Disk usage","agent","telegraf","total","Total disk size","byte" +"agent_disk","Disk usage","agent","telegraf","inodes_used_percent","Percentage of used inodes","%" +"agent_disk","Disk usage","agent","telegraf","inodes_free","Available inode","count" +"agent_disk","Disk usage","agent","telegraf","inodes_used","Number of inodes used","count" +"agent_disk","Disk usage","agent","telegraf","inodes_total","Total inodes","count" +"agent_disk","Disk usage","agent","telegraf","read_only","Test if disk is read only","NULL" +"diskio","Disk traffic and timing","host","telegraf","read_bps","Disk read rate","bps" +"diskio","Disk traffic and timing","host","telegraf","write_bps","Disk write rate","bps" +"diskio","Disk traffic and timing","host","telegraf","read_iops","Disk read operate rate","count" +"diskio","Disk traffic and timing","host","telegraf","write_iops","Disk write operate rate","count" +"diskio","Disk traffic and timing","host","telegraf","iops","Disk read/write operate rate","count" +"diskio","Disk traffic and timing","host","telegraf","reads","Number of reads","count" +"diskio","Disk traffic and timing","host","telegraf","writes","Number of writes","count" +"diskio","Disk traffic and timing","host","telegraf","iocount","Accumulated I/O request count","count" +"diskio","Disk traffic and timing","host","telegraf","read_bytes","Bytes read","byte" +"diskio","Disk traffic and timing","host","telegraf","write_bytes","Bytes write","byte" +"diskio","Disk traffic and timing","host","telegraf","iobytes","Bytes of both read and write","byte" +"diskio","Disk traffic and timing","host","telegraf","read_time","Time to wait for read","ms" +"diskio","Disk traffic and timing","host","telegraf","write_time","Time to wait for write","ms" +"diskio","Disk traffic and timing","host","telegraf","io_time","I / O request queuing time","ms" +"diskio","Disk traffic and timing","host","telegraf","read_await","Time to wait for read","ms" +"diskio","Disk traffic and timing","host","telegraf","write_await","Time to wait for write","ms" +"diskio","Disk traffic and timing","host","telegraf","await","I / O request queuing time","ms" +"diskio","Disk traffic and timing","host","telegraf","merged_reads","Merged disk read request count","count" +"diskio","Disk traffic and timing","host","telegraf","merged_writes","Merged disk write request count","count" +"diskio","Disk traffic and timing","host","telegraf","merged_iocount","Merged Accumulated I/O request count","count" +"diskio","Disk traffic and timing","host","telegraf","weighted_io_time","I / O request waiting time","ms" +"diskio","Disk traffic and timing","host","telegraf","iops_in_progress","Number of I / O requests issued but not yet completed","count" +"diskio","Disk traffic and timing","host","telegraf","ioutil","IO utilization in percentage","%" +"diskio","Disk traffic and timing","host","telegraf","avgqu_sz","Averate queing request count per seconds","NULL" +"agent_diskio","Disk traffic and timing","agent","telegraf","read_bps","Disk read rate","bps" +"agent_diskio","Disk traffic and timing","agent","telegraf","write_bps","Disk write rate","bps" +"agent_diskio","Disk traffic and timing","agent","telegraf","read_iops","Disk read operate rate","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","write_iops","Disk write operate rate","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","iops","Disk read/write operate rate","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","reads","Number of reads","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","writes","Number of writes","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","iocount","Accumulated I/O request count","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","read_bytes","Bytes read","byte" +"agent_diskio","Disk traffic and timing","agent","telegraf","write_bytes","Bytes write","byte" +"agent_diskio","Disk traffic and timing","agent","telegraf","iobytes","Bytes of both read and write","byte" +"agent_diskio","Disk traffic and timing","agent","telegraf","read_time","Time to wait for read","ms" +"agent_diskio","Disk traffic and timing","agent","telegraf","write_time","Time to wait for write","ms" +"agent_diskio","Disk traffic and timing","agent","telegraf","io_time","I / O request queuing time","ms" +"agent_diskio","Disk traffic and timing","agent","telegraf","read_await","Time to wait for read","ms" +"agent_diskio","Disk traffic and timing","agent","telegraf","write_await","Time to wait for write","ms" +"agent_diskio","Disk traffic and timing","agent","telegraf","await","I / O request queuing time","ms" +"agent_diskio","Disk traffic and timing","agent","telegraf","merged_reads","Merged disk read request count","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","merged_writes","Merged disk write request count","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","merged_iocount","Merged Accumulated I/O request count","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","weighted_io_time","I / O request waiting time","ms" +"agent_diskio","Disk traffic and timing","agent","telegraf","iops_in_progress","Number of I / O requests issued but not yet completed","count" +"agent_diskio","Disk traffic and timing","agent","telegraf","ioutil","IO utilization in percentage","%" +"agent_diskio","Disk traffic and timing","agent","telegraf","avgqu_sz","Averate queing request count per seconds","NULL" +"linux_sysctl_fs","Provides Linux sysctl fs metrics","host","telegraf","file_nr","The number of allocated file handles","count" +"linux_sysctl_fs","Provides Linux sysctl fs metrics","host","telegraf","file_max","The maximum number of file handles that the Linux kernel will allocate.","count" +"linux_sysctl_fs","Provides Linux sysctl fs metrics","host","telegraf","inode_nr","The number of inodes the system has allocated","count" +"linux_sysctl_fs","Provides Linux sysctl fs metrics","host","telegraf","inode_free_nr","The number of free inodes","count" +"linux_sysctl_fs","Provides Linux sysctl fs metrics","host","telegraf","aio_nr","The running total of the number of events specified on the io_setup system call for all currently active aio contexts","count" +"linux_sysctl_fs","Provides Linux sysctl fs metrics","host","telegraf","aio_max_nr","The running total of the number of events specified on the io_setup system call for all currently active aio contexts","count" +"linux_sysctl_fs","Provides Linux sysctl fs metrics","host","telegraf","nr_open","the maximum number of file-handles a process can allocate","count" +"mem","Memory","host","telegraf","used_percent","Used memory rate","%" +"mem","Memory","host","telegraf","available_percent","Available memory rate","%" +"mem","Memory","host","telegraf","free_percent","Free memory rate","%" +"mem","Memory","host","telegraf","used","Used memory","byte" +"mem","Memory","host","telegraf","free","Free memory","byte" +"mem","Memory","host","telegraf","active","The amount of active memory","byte" +"mem","Memory","host","telegraf","inactive","The amount of inactive memory","byte" +"mem","Memory","host","telegraf","cached","Cache memory","byte" +"mem","Memory","host","telegraf","buffered","Buffer memory","byte" +"mem","Memory","host","telegraf","slab","Number of kernel caches","byte" +"mem","Memory","host","telegraf","available","Available memory","byte" +"mem","Memory","host","telegraf","total","Total memory","byte" +"agent_mem","Memory","agent","telegraf","used_percent","Used memory rate","%" +"agent_mem","Memory","agent","telegraf","available_percent","Available memory rate","%" +"agent_mem","Memory","agent","telegraf","free_percent","Free memory rate","%" +"agent_mem","Memory","agent","telegraf","used","Used memory","byte" +"agent_mem","Memory","agent","telegraf","free","Free memory","byte" +"agent_mem","Memory","agent","telegraf","active","The amount of active memory","byte" +"agent_mem","Memory","agent","telegraf","inactive","The amount of inactive memory","byte" +"agent_mem","Memory","agent","telegraf","cached","Cache memory","byte" +"agent_mem","Memory","agent","telegraf","buffered","Buffer memory","byte" +"agent_mem","Memory","agent","telegraf","slab","Number of kernel caches","byte" +"agent_mem","Memory","agent","telegraf","available","Available memory","byte" +"agent_mem","Memory","agent","telegraf","total","Total memory","byte" +"net","Network interface and protocol usage","host","telegraf","bps_sent","Send traffic per second","bps" +"net","Network interface and protocol usage","host","telegraf","bps_recv","Received traffic per second","bps" +"net","Network interface and protocol usage","host","telegraf","pps_recv","Received packets per second","pps" +"net","Network interface and protocol usage","host","telegraf","pps_sent","Send packets per second","pps" +"net","Network interface and protocol usage","host","telegraf","bytes_sent","The total number of bytes sent by the network interface","byte" +"net","Network interface and protocol usage","host","telegraf","bytes_recv","The total number of bytes received by the network interface","byte" +"net","Network interface and protocol usage","host","telegraf","packets_sent","The total number of packets sent by the network interface","count" +"net","Network interface and protocol usage","host","telegraf","packets_recv","The total number of packets received by the network interface","count" +"net","Network interface and protocol usage","host","telegraf","err_in","The total number of receive errors detected by the network interface","count" +"net","Network interface and protocol usage","host","telegraf","err_out","The total number of transmission errors detected by the network interface","count" +"net","Network interface and protocol usage","host","telegraf","drop_in","The total number of received packets dropped by the network interface","count" +"net","Network interface and protocol usage","host","telegraf","drop_out","The total number of transmission packets dropped by the network interface","count" +"agent_net","Network interface and protocol usage","agent","telegraf","bps_sent","Send traffic per second","bps" +"agent_net","Network interface and protocol usage","agent","telegraf","bps_recv","Received traffic per second","bps" +"agent_net","Network interface and protocol usage","agent","telegraf","pps_recv","Received packets per second","pps" +"agent_net","Network interface and protocol usage","agent","telegraf","pps_sent","Send packets per second","pps" +"agent_net","Network interface and protocol usage","agent","telegraf","bytes_sent","The total number of bytes sent by the network interface","byte" +"agent_net","Network interface and protocol usage","agent","telegraf","bytes_recv","The total number of bytes received by the network interface","byte" +"agent_net","Network interface and protocol usage","agent","telegraf","packets_sent","The total number of packets sent by the network interface","count" +"agent_net","Network interface and protocol usage","agent","telegraf","packets_recv","The total number of packets received by the network interface","count" +"agent_net","Network interface and protocol usage","agent","telegraf","err_in","The total number of receive errors detected by the network interface","count" +"agent_net","Network interface and protocol usage","agent","telegraf","err_out","The total number of transmission errors detected by the network interface","count" +"agent_net","Network interface and protocol usage","agent","telegraf","drop_in","The total number of received packets dropped by the network interface","count" +"agent_net","Network interface and protocol usage","agent","telegraf","drop_out","The total number of transmission packets dropped by the network interface","count" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","load","Load utilization","%" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","model_load","Model load utilization","%" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","fw_load","FW load utilization","%" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","inst","INST utilization","%" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","max_inst","MAX INST utilization","%" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","mem","Memory utilization","%" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","critical_mem","Critical memory utilization","%" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","share_mem","Share memory utilization","%" +"ni_rsrc_mon","NETINT device metrics","host","telegraf","p2p_mem","P2P memory utilization","%" +"nvidia_smi","Nvidia GPU metrics","host","telegraf","clocks_current_graphics","GPU current clocks, MHz","" +"nvidia_smi","Nvidia GPU metrics","host","telegraf","clocks_current_memory","GPU current memory clocks, MHz","" +"nvidia_smi","Nvidia GPU metrics","host","telegraf","temperature_gpu","GPU temperature","" +"nvidia_smi","Nvidia GPU metrics","host","telegraf","memory_total","GPU memory total size","" +"nvidia_smi","Nvidia GPU metrics","host","telegraf","memory_free","GPU memory free size","" +"nvidia_smi","Nvidia GPU metrics","host","telegraf","memory_used","GPU memory used size","" +"nvidia_smi","Nvidia GPU metrics","host","telegraf","utilization_gpu","GPU utilization","%" +"nvidia_smi","Nvidia GPU metrics","host","telegraf","utilization_memory","GPU memory utilization","%" +"agent_nvidia_smi","Nvidia GPU metrics in guests","agent","telegraf","clocks_current_graphics","GPU current clocks, MHz","" +"agent_nvidia_smi","Nvidia GPU metrics in guests","agent","telegraf","clocks_current_memory","GPU current memory clocks, MHz","" +"agent_nvidia_smi","Nvidia GPU metrics in guests","agent","telegraf","temperature_gpu","GPU temperature","" +"agent_nvidia_smi","Nvidia GPU metrics in guests","agent","telegraf","memory_total","GPU memory total size","" +"agent_nvidia_smi","Nvidia GPU metrics in guests","agent","telegraf","memory_free","GPU memory free size","" +"agent_nvidia_smi","Nvidia GPU metrics in guests","agent","telegraf","memory_used","GPU memory used size","" +"agent_nvidia_smi","Nvidia GPU metrics in guests","agent","telegraf","utilization_gpu","GPU utilization","%" +"agent_nvidia_smi","Nvidia GPU metrics in guests","agent","telegraf","utilization_memory","GPU memory utilization","%" +"processes","Processes status","host","telegraf","total","Total processes count","count" +"processes","Processes status","host","telegraf","total_threads","Total threads count","count" +"processes","Processes status","host","telegraf","zombies","Z state, zombie processes count","count" +"processes","Processes status","host","telegraf","running","R state, running processes count","count" +"processes","Processes status","host","telegraf","sleeping","S state, sleeping processes count","count" +"processes","Processes status","host","telegraf","blocked","D, waiting in uninterruptible sleep, or locked, aka disk sleep","count" +"processes","Processes status","host","telegraf","stopped","T state, stopped process count","count" +"processes","Processes status","host","telegraf","dead","X state, dead","count" +"processes","Processes status","host","telegraf","wait","W state, (freebsd only)","count" +"processes","Processes status","host","telegraf","idle","I state, (sleeping for longer than about 20 seconds, bsd and Linux 4+ only)","count" +"processes","Processes status","host","telegraf","paging","W state (linux kernel < 2.6 only)","count" +"processes","Processes status","host","telegraf","parked","(linux only)","count" +"agent_processes","Processes status in guest","agent","telegraf","total","Total processes count","count" +"agent_processes","Processes status in guest","agent","telegraf","total_threads","Total threads count","count" +"agent_processes","Processes status in guest","agent","telegraf","zombies","Z state, zombie processes count","count" +"agent_processes","Processes status in guest","agent","telegraf","running","R state, running processes count","count" +"agent_processes","Processes status in guest","agent","telegraf","sleeping","S state, sleeping processes count","count" +"agent_processes","Processes status in guest","agent","telegraf","blocked","D, waiting in uninterruptible sleep, or locked, aka disk sleep","count" +"agent_processes","Processes status in guest","agent","telegraf","stopped","T state, stopped process count","count" +"agent_processes","Processes status in guest","agent","telegraf","dead","X state, dead","count" +"agent_processes","Processes status in guest","agent","telegraf","wait","W state, (freebsd only)","count" +"agent_processes","Processes status in guest","agent","telegraf","idle","I state, (sleeping for longer than about 20 seconds, bsd and Linux 4+ only)","count" +"agent_processes","Processes status in guest","agent","telegraf","paging","W state (linux kernel < 2.6 only)","count" +"agent_processes","Processes status in guest","agent","telegraf","parked","(linux only)","count" +"radeontop","AMD GPU metrics","host","telegraf","clocks_current_memory","GPU current memory clocks, MHz","" +"radeontop","AMD GPU metrics","host","telegraf","clocks_current_shader","GPU current shader clocks, MHz","" +"radeontop","AMD GPU metrics","host","telegraf","memory_total","GPU memory total size","" +"radeontop","AMD GPU metrics","host","telegraf","memory_free","GPU memory free size","" +"radeontop","AMD GPU metrics","host","telegraf","memory_used","GPU memory used size","" +"radeontop","AMD GPU metrics","host","telegraf","gtt_total","GPU gtt total size","" +"radeontop","AMD GPU metrics","host","telegraf","gtt_free","GPU gtt free size","" +"radeontop","AMD GPU metrics","host","telegraf","gtt_used","GPU gtt used size","" +"radeontop","AMD GPU metrics","host","telegraf","utilization_clock_memory","GPU block memory utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_clock_shader","GPU block shader utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_gpu","GPU utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_memory","GPU memory utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_event_engine","GPU event engine utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_vertex_grouper_tesselator","GPU vertex grouper tesselator utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_texture_addresser","GPU texture addresser utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_shader_exporter","GPU shader export utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_sequencer_instruction_cache","GPU sequencer instruction cache utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_shader_interpolator","GPU shader interpolator utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_scan_converter","GPU scan converter utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_primitive_assembly","GPU primitive assembly utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_depth_block","GPU depth block utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_color_block","GPU color block utilization","%" +"radeontop","AMD GPU metrics","host","telegraf","utilization_gtt","GPU gtt utilization","%" +"system","System load","host","telegraf","load1","Loadavg load1","NULL" +"system","System load","host","telegraf","load5","Loadavg load5","NULL" +"system","System load","host","telegraf","load15","Loadavg load15","NULL" +"system","System load","host","telegraf","load1_pcore","Loadavg load1 per cpu core","NULL" +"system","System load","host","telegraf","load5_pcore","Loadavg load5 per cpu core","NULL" +"system","System load","host","telegraf","load15_pcore","Loadavg load15 per cpu core","NULL" +"vasmi","Vasmi GPU metrics","host","telegraf","temperature_gpu","GPU temperature","" +"vasmi","Vasmi GPU metrics","host","telegraf","utilization_gpu","GPU utilization","%" +"vasmi","Vasmi GPU metrics","host","telegraf","utilization_memory","GPU memory utilization","%" +"vasmi","Vasmi GPU metrics","host","telegraf","utilization_share_memory","GPU share memory utilization","%" +"vasmi","Vasmi GPU metrics","host","telegraf","utilization_encoder","GPU encoder utilization","%" +"vasmi","Vasmi GPU metrics","host","telegraf","utilization_decoder","GPU decoder utilization","%" +"vasmi","Vasmi GPU metrics","host","telegraf","utilization_ai","GPU AI utilization","%" +"vasmi","Vasmi GPU metrics","host","telegraf","clocks_current_gpu","GPU current clocks, MHz","" +"vasmi","Vasmi GPU metrics","host","telegraf","oclk","oclk, MHz","" +"vasmi","Vasmi GPU metrics","host","telegraf","dclk","dclk, MHz","" +"vasmi","Vasmi GPU metrics","host","telegraf","eclk","eclk, MHz","" +"vasmi","Vasmi GPU metrics","host","telegraf","gclk","gclk, MHz","" +"vasmi","Vasmi GPU metrics","host","telegraf","aic_power","AIC power","" +"vm_cpu","Guest CPU usage","guest","telegraf","usage_active","CPU active state utilization rate","%" +"vm_cpu","Guest CPU usage","guest","telegraf","cpu_usage_pcore","CPU utilization rate per core","%" +"vm_cpu","Guest CPU usage","guest","telegraf","cpu_usage_idle_pcore","CPU idle rate per core","%" +"vm_cpu","Guest CPU usage","guest","telegraf","cpu_time_system","CPU system state time","ms" +"vm_cpu","Guest CPU usage","guest","telegraf","cpu_time_user","CPU user state time","ms" +"vm_cpu","Guest CPU usage","guest","telegraf","thread_count","The number of threads used by the process","count" +"vm_mem","Guest memory","guest","telegraf","used_percent","Used memory rate","%" +"vm_mem","Guest memory","guest","telegraf","vms","Virtual memory consumption","byte" +"vm_mem","Guest memory","guest","telegraf","rss","Actual use of physical memory","byte" +"vm_disk","Guest disk","guest","telegraf","used_percent","Used vm disk rate","%" +"vm_diskio","Guest disk traffic","guest","telegraf","read_bps","Disk read rate","Bps" +"vm_diskio","Guest disk traffic","guest","telegraf","write_bps","Disk write rate","Bps" +"vm_diskio","Guest disk traffic","guest","telegraf","read_iops","Disk read operate rate","count" +"vm_diskio","Guest disk traffic","guest","telegraf","write_iops","Disk write operate rate","count" +"vm_diskio","Guest disk traffic","guest","telegraf","read_bytes","Bytes read","byte" +"vm_diskio","Guest disk traffic","guest","telegraf","write_bytes","Bytes write","byte" +"vm_netio","Guest network traffic","guest","telegraf","bps_recv","Received traffic per second","bps" +"vm_netio","Guest network traffic","guest","telegraf","bps_sent","Send traffic per second","bps" +"vm_netio","Guest network traffic","guest","telegraf","pps_recv","Received packets per second","pps" +"vm_netio","Guest network traffic","guest","telegraf","pps_sent","Send packets per second","pps" +"pod_netio","Pod network traffic","container","telegraf","bps_recv","Received traffic per second","bps" +"pod_netio","Pod network traffic","container","telegraf","bps_sent","Send traffic per second","bps" +"pod_netio","Pod network traffic","container","telegraf","pps_recv","Received packets per second","pps" +"pod_netio","Pod network traffic","container","telegraf","pps_sent","Send packets per second","pps" +"cloudaccount_balance","Cloud account balance","cloudaccount","meter_db","balance","balance","NULL" +"container_cpu","Container cpu","container","telegraf","usage_rate","Container cpu usage rate","%" +"container_mem","Container memory","container","telegraf","usage_rate","Container memory usage rate","%" +"container_mem","Container memory","container","telegraf","working_set_bytes","Container memory working set bytes","byte" +"dcs_cpu","Redis CPU usage","redis","telegraf","usage_percent","CPU active state utilization rate","%" +"dcs_cpu","Redis CPU usage","redis","telegraf","server_load","server load","%" +"dcs_mem","Redis memory","redis","telegraf","used_percent","Used memory rate","%" +"dcs_netio","Redis network traffic","redis","telegraf","bps_recv","Received traffic per second","bps" +"dcs_netio","Redis network traffic","redis","telegraf","bps_sent","Send traffic per second","bps" +"dcs_conn","Redis connect","redis","telegraf","used_percent","Connection usage","%" +"dcs_conn","Redis connect","redis","telegraf","errors","Connection errors","count" +"dcs_instantopt","Redis operator","redis","telegraf","opt_sec","Number of commands processed per second","count" +"dcs_cachekeys","Redis keys","redis","telegraf","key_count","Number of cache keys","count" +"dcs_datamem","Redis data memory","redis","telegraf","used_byte","Data node memory usage","byte" +"haproxy","load balance","elb","telegraf","used_snat_port","used SNAT port count","count" +"haproxy","load balance","elb","telegraf","snat_conn_count","SNAT connection count","count" +"internal_agent","Agent wide statistics of telegraf agent","host","telegraf","gather_errors","","" +"internal_agent","Agent wide statistics of telegraf agent","host","telegraf","metrics_dropped","","" +"internal_agent","Agent wide statistics of telegraf agent","host","telegraf","metrics_gathered","","" +"internal_agent","Agent wide statistics of telegraf agent","host","telegraf","metrics_written","","" +"internal_gather","Gather statistics of telegraf agent","host","telegraf","gather_time_ns","","" +"internal_gather","Gather statistics of telegraf agent","host","telegraf","metrics_gathered","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","alloc_bytes","alloc_bytes","count" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","frees","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","heap_alloc_bytes","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","heap_idle_bytes","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","heap_in_use_bytes","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","heap_objects_bytes","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","heap_released_bytes","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","heap_sys_bytes","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","mallocs","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","num_gc","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","pointer_lookups","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","sys_bytes","","" +"internal_memstats","Memory usage statistics of telegraf agent","host","telegraf","total_alloc_bytes","","" +"internal_write","Write statistics of telegraf agent","host","telegraf","buffer_limit","","" +"internal_write","Write statistics of telegraf agent","host","telegraf","buffer_size","","" +"internal_write","Write statistics of telegraf agent","host","telegraf","metrics_added","","" +"internal_write","Write statistics of telegraf agent","host","telegraf","metrics_written","","" +"internal_write","Write statistics of telegraf agent","host","telegraf","metrics_dropped","","" +"internal_write","Write statistics of telegraf agent","host","telegraf","metrics_filtered","","" +"internal_write","Write statistics of telegraf agent","host","telegraf","write_time_ns","","" +"jenkins_node","jenkins node","ext_jenkins","telegraf","disk_available","disk_available","byte" +"jenkins_node","jenkins node","ext_jenkins","telegraf","temp_available","temp_available","byte" +"jenkins_node","jenkins node","ext_jenkins","telegraf","memory_available","memory_available","byte" +"jenkins_node","jenkins node","ext_jenkins","telegraf","memory_total","memory_total","byte" +"jenkins_node","jenkins node","ext_jenkins","telegraf","swap_available","swap_available","byte" +"jenkins_node","jenkins node","ext_jenkins","telegraf","swap_total","swap_total","byte" +"jenkins_job","jenkins job","ext_jenkins","telegraf","duration","duration","ms" +"jenkins_job","jenkins job","ext_jenkins","telegraf","number","number","count" +"k8s_pod","k8s pod","k8s","telegraf","cpu_used_percent","CPU active state utilization rate","%" +"k8s_pod","k8s pod","k8s","telegraf","mem_used_percent","Used memory rate","%" +"k8s_pod","k8s pod","k8s","telegraf","restart_total","pod restart count","count" +"k8s_deploy","k8s deploy","k8s","telegraf","pod_oom_total","oom pod count","count" +"k8s_deploy","k8s deploy","k8s","telegraf","pod_restarting_total","restarting pod count","count" +"k8s_node","k8s node","k8s","telegraf","cpu_used_percent","CPU active state utilization rate","%" +"k8s_node","k8s node","k8s","telegraf","mem_used_percent","Used memory rate","%" +"k8s_node","k8s node","k8s","telegraf","disk_used_percent","Percentage of used disks","%" +"k8s_node","k8s node","k8s","telegraf","bps_sent","Send traffic per second","bps" +"k8s_node","k8s node","k8s","telegraf","bps_recv","Received traffic per second","bps" +"k8s_node","k8s node","k8s","telegraf","pod_restart_total","pod restart count in node","count" +"kernel","kernel metrics","host","telegraf","boot_time","seconds since epoch, btime","s" +"kernel","kernel metrics","host","telegraf","context_switches","context switch count","count" +"kernel","kernel metrics","host","telegraf","disk_pages_in","page in count","count" +"kernel","kernel metrics","host","telegraf","disk_pages_out","page out count","count" +"kernel","kernel metrics","host","telegraf","interrupts","interrupts count","count" +"kernel","kernel metrics","host","telegraf","processes_forked","processes forked count","count" +"kernel","kernel metrics","host","telegraf","entropy_avail","entropy available","NULL" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_free_pages","nr_free_pages","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_inactive_anon","(integer, nr_inactive_anon)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_active_anon","(integer, nr_active_anon)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_inactive_file","(integer, nr_inactive_file)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_active_file","(integer, nr_active_file)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_unevictable","(integer, nr_unevictable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_mlock","(integer, nr_mlock)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_anon_pages","(integer, nr_anon_pages)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_mapped","(integer, nr_mapped)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_file_pages","(integer, nr_file_pages)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_dirty","(integer, nr_dirty)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_writeback","(integer, nr_writeback)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_slab_reclaimable","(integer, nr_slab_reclaimable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_slab_unreclaimable","(integer, nr_slab_unreclaimable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_page_table_pages","(integer, nr_page_table_pages)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_kernel_stack","(integer, nr_kernel_stack)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_unstable","(integer, nr_unstable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_bounce","(integer, nr_bounce)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_vmscan_write","(integer, nr_vmscan_write)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_writeback_temp","(integer, nr_writeback_temp)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_isolated_anon","(integer, nr_isolated_anon)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_isolated_file","(integer, nr_isolated_file)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_shmem","(integer, nr_shmem)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","numa_hit","(integer, numa_hit)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","numa_miss","(integer, numa_miss)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","numa_foreign","(integer, numa_foreign)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","numa_interleave","(integer, numa_interleave)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","numa_local","(integer, numa_local)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","numa_other","(integer, numa_other)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","nr_anon_transparent_hugepages","(integer, nr_anon_transparent_hugepages)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgpgin","(integer, pgpgin)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgpgout","(integer, pgpgout)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pswpin","(integer, pswpin)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pswpout","(integer, pswpout)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgalloc_dma","(integer, pgalloc_dma)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgalloc_dma32","(integer, pgalloc_dma32)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgalloc_normal","(integer, pgalloc_normal)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgalloc_movable","(integer, pgalloc_movable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgfree","(integer, pgfree)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgactivate","(integer, pgactivate)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgdeactivate","(integer, pgdeactivate)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgfault","(integer, pgfault)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgmajfault","(integer, pgmajfault)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgrefill_dma","(integer, pgrefill_dma)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgrefill_dma32","(integer, pgrefill_dma32)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgrefill_normal","(integer, pgrefill_normal)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgrefill_movable","(integer, pgrefill_movable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgsteal_dma","(integer, pgsteal_dma)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgsteal_dma32","(integer, pgsteal_dma32)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgsteal_normal","(integer, pgsteal_normal)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgsteal_movable","(integer, pgsteal_movable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgscan_kswapd_dma","(integer, pgscan_kswapd_dma)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgscan_kswapd_dma32","(integer, pgscan_kswapd_dma32)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgscan_kswapd_normal","(integer, pgscan_kswapd_normal)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgscan_kswapd_movable","(integer, pgscan_kswapd_movable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgscan_direct_dma","(integer, pgscan_direct_dma)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgscan_direct_dma32","(integer, pgscan_direct_dma32)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgscan_direct_normal","(integer, pgscan_direct_normal)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgscan_direct_movable","(integer, pgscan_direct_movable)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","zone_reclaim_failed","(integer, zone_reclaim_failed)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pginodesteal","(integer, pginodesteal)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","slabs_scanned","(integer, slabs_scanned)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","kswapd_steal","(integer, kswapd_steal)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","kswapd_inodesteal","(integer, kswapd_inodesteal)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","kswapd_low_wmark_hit_quickly","(integer, kswapd_low_wmark_hit_quickly)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","kswapd_high_wmark_hit_quickly","(integer, kswapd_high_wmark_hit_quickly)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","kswapd_skip_congestion_wait","(integer, kswapd_skip_congestion_wait)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pageoutrun","(integer, pageoutrun)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","allocstall","(integer, allocstall)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","pgrotated","(integer, pgrotated)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","compact_blocks_moved","(integer, compact_blocks_moved)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","compact_pages_moved","(integer, compact_pages_moved)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","compact_pagemigrate_failed","(integer, compact_pagemigrate_failed)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","compact_stall","(integer, compact_stall)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","compact_fail","(integer, compact_fail)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","compact_success","(integer, compact_success)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","htlb_buddy_alloc_success","(integer, htlb_buddy_alloc_success)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","htlb_buddy_alloc_fail","(integer, htlb_buddy_alloc_fail)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","unevictable_pgs_culled","(integer, unevictable_pgs_culled)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","unevictable_pgs_scanned","(integer, unevictable_pgs_scanned)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","unevictable_pgs_rescued","(integer, unevictable_pgs_rescued)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","unevictable_pgs_mlocked","(integer, unevictable_pgs_mlocked)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","unevictable_pgs_munlocked","(integer, unevictable_pgs_munlocked)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","unevictable_pgs_cleared","(integer, unevictable_pgs_cleared)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","unevictable_pgs_stranded","(integer, unevictable_pgs_stranded)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","unevictable_pgs_mlockfreed","(integer, unevictable_pgs_mlockfreed)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","thp_fault_alloc","(integer, thp_fault_alloc)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","thp_fault_fallback","(integer, thp_fault_fallback)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","thp_collapse_alloc","(integer, thp_collapse_alloc)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","thp_collapse_alloc_failed","(integer, thp_collapse_alloc_failed)","count" +"kernel_vmstat","kernel vmstat","host","telegraf","thp_split","(integer, thp_split)","count" +"mysql","mysql","ext_mysql","telegraf","binary_size_bytes","binary_size_bytes","byte" +"mysql","mysql","ext_mysql","telegraf","binary_files_count","binary_files_count","count" +"mysql","mysql","ext_mysql","telegraf","connections","connections","count" +"mysql","mysql","ext_mysql","telegraf","table_io_waits_total_fetch","table_io_waits_total_fetch","count" +"mysql","mysql","ext_mysql","telegraf","table_io_waits_seconds_total_fetch","table_io_waits_seconds_total_fetch","ms" +"mysql","mysql","ext_mysql","telegraf","index_io_waits_total_fetch","index_io_waits_total_fetch","count" +"mysql","mysql","ext_mysql","telegraf","index_io_waits_seconds_total_fetch","index_io_waits_seconds_total_fetch","ms" +"mysql","mysql","ext_mysql","telegraf","info_schema_table_rows","info_schema_table_rows","count" +"mysql","mysql","ext_mysql","telegraf","info_schema_table_size_data_length","info_schema_table_size_data_length","count" +"mysql","mysql","ext_mysql","telegraf","info_schema_table_size_index_length","info_schema_table_size_index_length","count" +"netstat","netstat","host","telegraf","tcp_established","","count" +"netstat","netstat","host","telegraf","tcp_syn_sent","","count" +"netstat","netstat","host","telegraf","tcp_syn_recv","","count" +"netstat","netstat","host","telegraf","tcp_fin_wait1","","count" +"netstat","netstat","host","telegraf","tcp_fin_wait2","","count" +"netstat","netstat","host","telegraf","tcp_time_wait","","count" +"netstat","netstat","host","telegraf","tcp_close","","count" +"netstat","netstat","host","telegraf","tcp_close_wait","","count" +"netstat","netstat","host","telegraf","tcp_last_ack","","count" +"netstat","netstat","host","telegraf","tcp_listen","","count" +"netstat","netstat","host","telegraf","tcp_closing","","count" +"netstat","netstat","host","telegraf","tcp_none","","count" +"netstat","netstat","host","telegraf","udp_socket","","count" +"ntpq","standard NTP query metrics","host","telegraf","delay","(float, milliseconds)","ms" +"ntpq","standard NTP query metrics","host","telegraf","jitter","(float, milliseconds)","ms" +"ntpq","standard NTP query metrics","host","telegraf","offset","(float, milliseconds)","ms" +"ntpq","standard NTP query metrics","host","telegraf","poll","(int, seconds)","s" +"ntpq","standard NTP query metrics","host","telegraf","reach","(int)","count" +"ntpq","standard NTP query metrics","host","telegraf","when","(int, seconds)","s" +"oss_latency","Object storage latency","oss","telegraf","req_late","Request average E2E delay","ms" +"oss_netio","Object storage network traffic","oss","telegraf","bps_recv","Receive byte","byte" +"oss_netio","Object storage network traffic","oss","telegraf","bps_sent","Send byte","byte" +"oss_req","Object store request","oss","telegraf","req_count","request count","count" +"ping","Ping monitor","host","telegraf","packets_transmitted","used SNAT port count","count" +"ping","Ping monitor","host","telegraf","packets_received","SNAT connection count","count" +"ping","Ping monitor","host","telegraf","percent_packet_loss","Packet loss rate in percetile","%" +"ping","Ping monitor","host","telegraf","ttl","TTL count","count" +"ping","Ping monitor","host","telegraf","average_response_ms","average_response_ms","ms" +"ping","Ping monitor","host","telegraf","minimum_response_ms","minimum response ms","ms" +"ping","Ping monitor","host","telegraf","maximum_response_ms","maximum_response_ms","ms" +"ping","Ping monitor","host","telegraf","standard_deviation_ms","standard_deviation_ms","ms" +"ping","Ping monitor","host","telegraf","percentile50_ms","SNAT connection count","ms" +"ping","Ping monitor","host","telegraf","errors","SNAT connection count","count" +"ping","Ping monitor","host","telegraf","result_code","Ping result code, success = 0, no such host = 1, ping error = 2","NULL" +"pod_cpu","Pod cpu","container","telegraf","usage_rate","Pod cpu usage rate","%" +"pod_mem","Pod memory","container","telegraf","usage_rate","Pod memory usage rate","%" +"pod_mem","Pod memory","container","telegraf","working_set_bytes","Pod memory working set bytes","byte" +"pod_volume","Pod volume","container","telegraf","free","Pod volume free size","byte" +"pod_volume","Pod volume","container","telegraf","used","Pod volume used size","byte" +"pod_volume","Pod volume","container","telegraf","used_percent","Pod volume used percent","%" +"pod_volume","Pod volume","container","telegraf","inodes_total","Pod volume inodes total count","count" +"pod_volume","Pod volume","container","telegraf","inodes_free","Pod volume inodes free count","count" +"pod_volume","Pod volume","container","telegraf","inodes_used","Pod volume inodes used count","count" +"pod_volume","Pod volume","container","telegraf","inodes_used_percent","Pod volume inodes used percent","%" +"rabbitmq_overview","rabbitmq_overview","ext_rabbitmq","telegraf","channels","channels","count" +"rabbitmq_overview","rabbitmq_overview","ext_rabbitmq","telegraf","consumers","consumers","count" +"rabbitmq_overview","rabbitmq_overview","ext_rabbitmq","telegraf","messages","messages","count" +"rabbitmq_overview","rabbitmq_overview","ext_rabbitmq","telegraf","queues","queues","count" +"rabbitmq_node","rabbitmq_node","ext_rabbitmq","telegraf","disk_free","disk_free","byte" +"rabbitmq_node","rabbitmq_node","ext_rabbitmq","telegraf","mem_used","mem_used","byte" +"rabbitmq_queue","rabbitmq_queue","ext_rabbitmq","telegraf","consumer_utilisation","consumer_utilisation","%" +"rabbitmq_queue","rabbitmq_queue","ext_rabbitmq","telegraf","message_bytes","message_bytes","byte" +"rabbitmq_queue","rabbitmq_queue","ext_rabbitmq","telegraf","message_bytes_ram","message_bytes_ram","byte" +"rabbitmq_queue","rabbitmq_queue","ext_rabbitmq","telegraf","messages","messages","count" +"rds_conn","Rds connection","rds","telegraf","used_percent","Connection usage","%" +"rds_conn","Rds connection","rds","telegraf","active_count","active connection count","count" +"rds_conn","Rds connection","rds","telegraf","failed_count","failed connection count","count" +"rds_cpu","Rds CPU usage","rds","telegraf","usage_active","CPU active state utilization rate","%" +"rds_mem","Rds memory","rds","telegraf","used_percent","Used memory rate","%" +"rds_netio","Rds network traffic","rds","telegraf","bps_recv","Received traffic per second","bps" +"rds_netio","Rds network traffic","rds","telegraf","bps_sent","Send traffic per second","bps" +"rds_disk","Rds disk usage","rds","telegraf","used_percent","Percentage of used disks","%" +"redis","redis","ext_redis","telegraf","used_memory","used_memory","byte" +"redis","redis","ext_redis","telegraf","used_memory_peak","used_memory_peak","byte" +"redis","redis","ext_redis","telegraf","used_cpu_sys","used_cpu_sys","%" +"redis","redis","ext_redis","telegraf","used_cpu_user","used_cpu_user","%" +"redis_keyspace","redis_keyspace","ext_redis","telegraf","keys","keys","count" +"redis_keyspace","redis_keyspace","ext_redis","telegraf","expires","expires","count" +"sensors","Collect lm-sensors metrics","host","telegraf","temp_input","lm-sensors temperature input","" +"agent_sensors","Collect lm-sensors metrics","agent","telegraf","temp_input","lm-sensors temperature input","" +"agent_smart_device","Collect smartctl metrics","agent","telegraf","temp_c","Disk device temperature ","" +"smart_device","Collect smartctl metrics","host","telegraf","temp_c","Disk device temperature ","" +"storage","Storage usage","storage","telegraf","usage_active","Storage utilization rate","%" +"storage","Storage usage","storage","telegraf","free","Free storage","Mb" +"swap","The swap plugin collects system swap metrics.","host","telegraf","free","(int, bytes): free swap memory","byte" +"swap","The swap plugin collects system swap metrics.","host","telegraf","total","(int, bytes): total swap memory","byte" +"swap","The swap plugin collects system swap metrics.","host","telegraf","used","(int, bytes): used swap memory","byte" +"swap","The swap plugin collects system swap metrics.","host","telegraf","used_percent","(float, percent): percentage of swap memory used","%" +"swap","The swap plugin collects system swap metrics.","host","telegraf","in","(int, bytes): data swapped in since last boot calculated from page number","byte" +"swap","The swap plugin collects system swap metrics.","host","telegraf","out","(int, bytes): data swapped out since last boot calculated from page number","byte" +"temp","The temp input plugin gather metrics on system temperature","host","telegraf","temp","(float, celcius)","NULL" +"agent_temp","The temp input plugin gather metrics on system temperature","guest","telegraf","temp","(float, celcius)","NULL" diff --git a/pkg/monitor/dbinit/measurements/mysql.go b/pkg/monitor/dbinit/measurements/mysql.go new file mode 100644 index 0000000000..2fe94141f5 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/mysql.go @@ -0,0 +1,58 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var mysql = SMeasurement{ + Context: []SMonitorContext{ + { + "mysql", "mysql", + monitor.METRIC_RES_TYPE_EXT_MYSQL, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "binary_size_bytes", "binary_size_bytes", monitor.METRIC_UNIT_BYTE, + }, + { + "binary_files_count", "binary_files_count", monitor.METRIC_UNIT_COUNT, + }, + { + "connections", "connections", monitor.METRIC_UNIT_COUNT, + }, + { + "table_io_waits_total_fetch", "table_io_waits_total_fetch", monitor.METRIC_UNIT_COUNT, + }, + { + "table_io_waits_seconds_total_fetch", "table_io_waits_seconds_total_fetch", monitor.METRIC_UNIT_MS, + }, + { + "index_io_waits_total_fetch", "index_io_waits_total_fetch", monitor.METRIC_UNIT_COUNT, + }, + { + "index_io_waits_seconds_total_fetch", "index_io_waits_seconds_total_fetch", monitor.METRIC_UNIT_MS, + }, + { + "info_schema_table_rows", "info_schema_table_rows", monitor.METRIC_UNIT_COUNT, + }, + { + "info_schema_table_size_data_length", "info_schema_table_size_data_length", monitor.METRIC_UNIT_COUNT, + }, + { + "info_schema_table_size_index_length", "info_schema_table_size_index_length", monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/net.go b/pkg/monitor/dbinit/measurements/net.go new file mode 100644 index 0000000000..68722bea0b --- /dev/null +++ b/pkg/monitor/dbinit/measurements/net.go @@ -0,0 +1,96 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var net = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "net", + DisplayName: "Network interface and protocol usage", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + { + Name: "agent_net", + DisplayName: "Network interface and protocol usage", + ResourceType: monitor.METRIC_RES_TYPE_AGENT, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "bps_sent", + DisplayName: "Send traffic per second", + Unit: monitor.METRIC_UNIT_BPS, + }, + { + Name: "bps_recv", + DisplayName: "Received traffic per second", + Unit: monitor.METRIC_UNIT_BPS, + }, + { + Name: "pps_recv", + DisplayName: "Received packets per second", + Unit: monitor.METRIC_UNIT_PPS, + }, + { + Name: "pps_sent", + DisplayName: "Send packets per second", + Unit: monitor.METRIC_UNIT_PPS, + }, + { + Name: "bytes_sent", + DisplayName: "The total number of bytes sent by the network interface", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "bytes_recv", + DisplayName: "The total number of bytes received by the network interface", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "packets_sent", + DisplayName: "The total number of packets sent by the network interface", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "packets_recv", + DisplayName: "The total number of packets received by the network interface", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "err_in", + DisplayName: "The total number of receive errors detected by the network interface", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "err_out", + DisplayName: "The total number of transmission errors detected by the network interface", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "drop_in", + DisplayName: "The total number of received packets dropped by the network interface", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "drop_out", + DisplayName: "The total number of transmission packets dropped by the network interface", + Unit: monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/netstat.go b/pkg/monitor/dbinit/measurements/netstat.go new file mode 100644 index 0000000000..6a0cbafb6d --- /dev/null +++ b/pkg/monitor/dbinit/measurements/netstat.go @@ -0,0 +1,95 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var netstat = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "netstat", + DisplayName: "netstat", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "tcp_established", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_syn_sent", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_syn_recv", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_fin_wait1", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_fin_wait2", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_time_wait", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_close", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_close_wait", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_last_ack", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_listen", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_closing", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "tcp_none", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "udp_socket", + DisplayName: "", + Unit: monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/ni_rsrc_mon.go b/pkg/monitor/dbinit/measurements/ni_rsrc_mon.go new file mode 100644 index 0000000000..c3bf9bbb56 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/ni_rsrc_mon.go @@ -0,0 +1,55 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var netint = SMeasurement{ + Context: []SMonitorContext{ + { + "ni_rsrc_mon", "NETINT device metrics", + monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "load", "Load utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "model_load", "Model load utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "fw_load", "FW load utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "inst", "INST utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "max_inst", "MAX INST utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "mem", "Memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "critical_mem", "Critical memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "share_mem", "Share memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "p2p_mem", "P2P memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/ntpq.go b/pkg/monitor/dbinit/measurements/ntpq.go new file mode 100644 index 0000000000..b622c3ca00 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/ntpq.go @@ -0,0 +1,60 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var ntpq = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "ntpq", + DisplayName: "standard NTP query metrics", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "delay", + DisplayName: "(float, milliseconds)", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "jitter", + DisplayName: "(float, milliseconds)", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "offset", + DisplayName: "(float, milliseconds)", + Unit: monitor.METRIC_UNIT_MS, + }, + { + Name: "poll", + DisplayName: "(int, seconds)", + Unit: monitor.METRIC_UNIT_SEC, + }, + { + Name: "reach", + DisplayName: "(int)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "when", + DisplayName: "(int, seconds)", + Unit: monitor.METRIC_UNIT_SEC, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/nvidia.go b/pkg/monitor/dbinit/measurements/nvidia.go new file mode 100644 index 0000000000..cd11d9800d --- /dev/null +++ b/pkg/monitor/dbinit/measurements/nvidia.go @@ -0,0 +1,54 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var nvidia = SMeasurement{ + Context: []SMonitorContext{ + { + "nvidia_smi", "Nvidia GPU metrics", monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, + }, + { + "agent_nvidia_smi", "Nvidia GPU metrics in guests", monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "clocks_current_graphics", "GPU current clocks, MHz", "", + }, + { + "clocks_current_memory", "GPU current memory clocks, MHz", "", + }, + { + "temperature_gpu", "GPU temperature", "", + }, + { + "memory_total", "GPU memory total size", "", + }, + { + "memory_free", "GPU memory free size", "", + }, + { + "memory_used", "GPU memory used size", "", + }, + { + "utilization_gpu", "GPU utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_memory", "GPU memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/oss.go b/pkg/monitor/dbinit/measurements/oss.go new file mode 100644 index 0000000000..cb248424ad --- /dev/null +++ b/pkg/monitor/dbinit/measurements/oss.go @@ -0,0 +1,62 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var ossLatency = SMeasurement{ + Context: []SMonitorContext{ + { + "oss_latency", "Object storage latency", + monitor.METRIC_RES_TYPE_OSS, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "req_late", "Request average E2E delay", monitor.METRIC_UNIT_MS, + }, + }, +} + +var ossNetio = SMeasurement{ + Context: []SMonitorContext{ + { + "oss_netio", "Object storage network traffic", + monitor.METRIC_RES_TYPE_OSS, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "bps_recv", "Receive byte", monitor.METRIC_UNIT_BYTE, + }, + { + "bps_sent", "Send byte", monitor.METRIC_UNIT_BYTE, + }, + }, +} + +var ossReq = SMeasurement{ + Context: []SMonitorContext{ + { + "oss_req", "Object store request", monitor.METRIC_RES_TYPE_OSS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "req_count", "request count", monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/ping.go b/pkg/monitor/dbinit/measurements/ping.go new file mode 100644 index 0000000000..f769607d1e --- /dev/null +++ b/pkg/monitor/dbinit/measurements/ping.go @@ -0,0 +1,69 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var ping = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "ping", + DisplayName: "Ping monitor", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "packets_transmitted", "used SNAT port count", monitor.METRIC_UNIT_COUNT, + }, + { + "packets_received", "SNAT connection count", monitor.METRIC_UNIT_COUNT, + }, + { + "percent_packet_loss", "Packet loss rate in percetile", monitor.METRIC_UNIT_PERCENT, + }, + { + "ttl", "TTL count", monitor.METRIC_UNIT_COUNT, + }, + { + "average_response_ms", "average_response_ms", monitor.METRIC_UNIT_MS, + }, + { + "minimum_response_ms", "minimum response ms", monitor.METRIC_UNIT_MS, + }, + { + "maximum_response_ms", "maximum_response_ms", monitor.METRIC_UNIT_MS, + }, + { + "standard_deviation_ms", "standard_deviation_ms", monitor.METRIC_UNIT_MS, + }, + { + "percentile50_ms", "SNAT connection count", monitor.METRIC_UNIT_MS, + }, + { + "errors", "SNAT connection count", monitor.METRIC_UNIT_COUNT, + }, + /*{ + "reply_received", "SNAT connection count", monitor.METRIC_UNIT_COUNT, + }, + { + "percent_reply_loss", "SNAT connection count", monitor.METRIC_UNIT_COUNT, + },*/ + { + "result_code", "Ping result code, success = 0, no such host = 1, ping error = 2", monitor.METRIC_UNIT_NULL, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/process.go b/pkg/monitor/dbinit/measurements/process.go new file mode 100644 index 0000000000..70a828de02 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/process.go @@ -0,0 +1,108 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var processes = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "processes", + DisplayName: "Processes status", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + { + Name: "agent_processes", + DisplayName: "Processes status in guest", + ResourceType: monitor.METRIC_RES_TYPE_AGENT, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "total", + DisplayName: "Total processes count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "total_threads", + DisplayName: "Total threads count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "zombies", + DisplayName: "Z state, zombie processes count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "running", + DisplayName: "R state, running processes count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "sleeping", + DisplayName: "S state, sleeping processes count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "blocked", + DisplayName: "D, waiting in uninterruptible sleep, or locked, aka disk sleep", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "stopped", + DisplayName: "T state, stopped process count", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "dead", + DisplayName: "X state, dead", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "wait", + DisplayName: "W state, (freebsd only)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "idle", + DisplayName: "I state, (sleeping for longer than about 20 seconds, bsd and Linux 4+ only)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "paging", + DisplayName: "W state (linux kernel < 2.6 only)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + { + Name: "parked", + DisplayName: "(linux only)", + Unit: monitor.METRIC_UNIT_COUNT, + }, + }, +} + +/* +Linux FreeBSD Darwin meaning +R R R running +S S S sleeping +Z Z Z zombie +X none none dead +T T T stopped +I I I idle (sleeping for longer than about 20 seconds) +D D,L U blocked (waiting in uninterruptible sleep, or locked) +W W none paging (linux kernel < 2.6 only), wait (freebsd) +*/ diff --git a/pkg/monitor/dbinit/measurements/rabbitmq.go b/pkg/monitor/dbinit/measurements/rabbitmq.go new file mode 100644 index 0000000000..9bc32e61b4 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/rabbitmq.go @@ -0,0 +1,80 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var rabbitmqOverview = SMeasurement{ + Context: []SMonitorContext{ + { + "rabbitmq_overview", "rabbitmq_overview", + monitor.METRIC_RES_TYPE_EXT_RABBITMQ, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "channels", "channels", monitor.METRIC_UNIT_COUNT, + }, + { + "consumers", "consumers", monitor.METRIC_UNIT_COUNT, + }, + { + "messages", "messages", monitor.METRIC_UNIT_COUNT, + }, + { + "queues", "queues", monitor.METRIC_UNIT_COUNT, + }, + }, +} + +var rabbitmqNode = SMeasurement{ + Context: []SMonitorContext{ + { + "rabbitmq_node", "rabbitmq_node", + monitor.METRIC_RES_TYPE_EXT_RABBITMQ, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "disk_free", "disk_free", monitor.METRIC_UNIT_BYTE, + }, + { + "mem_used", "mem_used", monitor.METRIC_UNIT_BYTE, + }, + }, +} + +var rabbitmqQueue = SMeasurement{ + Context: []SMonitorContext{ + { + "rabbitmq_queue", "rabbitmq_queue", + monitor.METRIC_RES_TYPE_EXT_RABBITMQ, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "consumer_utilisation", "consumer_utilisation", monitor.METRIC_UNIT_PERCENT, + }, + { + "message_bytes", "message_bytes", monitor.METRIC_UNIT_BYTE, + }, + { + "message_bytes_ram", "message_bytes_ram", monitor.METRIC_UNIT_BYTE, + }, + { + "messages", "messages", monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/radeontop.go b/pkg/monitor/dbinit/measurements/radeontop.go new file mode 100644 index 0000000000..d3b368f03f --- /dev/null +++ b/pkg/monitor/dbinit/measurements/radeontop.go @@ -0,0 +1,96 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var radeontop = SMeasurement{ + Context: []SMonitorContext{ + { + "radeontop", "AMD GPU metrics", monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "clocks_current_memory", "GPU current memory clocks, MHz", "", + }, + { + "clocks_current_shader", "GPU current shader clocks, MHz", "", + }, + { + "memory_total", "GPU memory total size", "", + }, + { + "memory_free", "GPU memory free size", "", + }, + { + "memory_used", "GPU memory used size", "", + }, + { + "gtt_total", "GPU gtt total size", "", + }, + { + "gtt_free", "GPU gtt free size", "", + }, + { + "gtt_used", "GPU gtt used size", "", + }, + { + "utilization_clock_memory", "GPU block memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_clock_shader", "GPU block shader utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_gpu", "GPU utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_memory", "GPU memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_event_engine", "GPU event engine utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_vertex_grouper_tesselator", "GPU vertex grouper tesselator utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_texture_addresser", "GPU texture addresser utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_shader_exporter", "GPU shader export utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_sequencer_instruction_cache", "GPU sequencer instruction cache utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_shader_interpolator", "GPU shader interpolator utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_scan_converter", "GPU scan converter utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_primitive_assembly", "GPU primitive assembly utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_depth_block", "GPU depth block utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_color_block", "GPU color block utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_gtt", "GPU gtt utilization", monitor.METRIC_UNIT_PERCENT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/rds.go b/pkg/monitor/dbinit/measurements/rds.go new file mode 100644 index 0000000000..af50f0bc4f --- /dev/null +++ b/pkg/monitor/dbinit/measurements/rds.go @@ -0,0 +1,96 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var rdsConn = SMeasurement{ + Context: []SMonitorContext{ + { + "rds_conn", "Rds connection", monitor.METRIC_RES_TYPE_RDS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_percent", "Connection usage", monitor.METRIC_UNIT_PERCENT, + }, + { + "active_count", "active connection count", monitor.METRIC_UNIT_COUNT, + }, + { + "failed_count", "failed connection count", monitor.METRIC_UNIT_COUNT, + }, + }, +} + +var rdsCpu = SMeasurement{ + Context: []SMonitorContext{ + { + "rds_cpu", "Rds CPU usage", monitor.METRIC_RES_TYPE_RDS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "usage_active", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, + }, + }, +} + +var rdsMem = SMeasurement{ + Context: []SMonitorContext{ + { + "rds_mem", "Rds memory", monitor.METRIC_RES_TYPE_RDS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, + }, + }, +} + +var rdsNetio = SMeasurement{ + Context: []SMonitorContext{ + { + "rds_netio", "Rds network traffic", monitor.METRIC_RES_TYPE_RDS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, + }, + { + "bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, + }, + }, +} + +var rdsDisk = SMeasurement{ + Context: []SMonitorContext{ + { + "rds_disk", "Rds disk usage", monitor.METRIC_RES_TYPE_RDS, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_percent", "Percentage of used disks", monitor.METRIC_UNIT_PERCENT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/redis.go b/pkg/monitor/dbinit/measurements/redis.go new file mode 100644 index 0000000000..2904ee91ff --- /dev/null +++ b/pkg/monitor/dbinit/measurements/redis.go @@ -0,0 +1,57 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var redis = SMeasurement{ + Context: []SMonitorContext{ + { + "redis", "redis", + monitor.METRIC_RES_TYPE_EXT_REDIS, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_memory", "used_memory", monitor.METRIC_UNIT_BYTE, + }, + { + "used_memory_peak", "used_memory_peak", monitor.METRIC_UNIT_BYTE, + }, + { + "used_cpu_sys", "used_cpu_sys", monitor.METRIC_UNIT_PERCENT, + }, + { + "used_cpu_user", "used_cpu_user", monitor.METRIC_UNIT_PERCENT, + }, + }, +} + +var redisKeyspace = SMeasurement{ + Context: []SMonitorContext{ + { + "redis_keyspace", "redis_keyspace", + monitor.METRIC_RES_TYPE_EXT_REDIS, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "keys", "keys", monitor.METRIC_UNIT_COUNT, + }, + { + "expires", "expires", monitor.METRIC_UNIT_COUNT, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/sensor.go b/pkg/monitor/dbinit/measurements/sensor.go new file mode 100644 index 0000000000..8462dcd735 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/sensor.go @@ -0,0 +1,35 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var sensors = SMeasurement{ + Context: []SMonitorContext{ + { + "sensors", "Collect lm-sensors metrics", + monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, + }, + { + "agent_sensors", "Collect lm-sensors metrics", + monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "temp_input", "lm-sensors temperature input", "", + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/smartctl.go b/pkg/monitor/dbinit/measurements/smartctl.go new file mode 100644 index 0000000000..223c9e6776 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/smartctl.go @@ -0,0 +1,35 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var smartctl = SMeasurement{ + Context: []SMonitorContext{ + { + "agent_smart_device", "Collect smartctl metrics", + monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, + }, + { + "smart_device", "Collect smartctl metrics", + monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "temp_c", "Disk device temperature ", "", + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/storage.go b/pkg/monitor/dbinit/measurements/storage.go new file mode 100644 index 0000000000..1a19dfb5d0 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/storage.go @@ -0,0 +1,34 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var storage = SMeasurement{ + Context: []SMonitorContext{ + { + "storage", "Storage usage", + monitor.METRIC_RES_TYPE_STORAGE, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "usage_active", "Storage utilization rate", monitor.METRIC_UNIT_PERCENT, + }, + { + "free", "Free storage", monitor.METRIC_UNIT_MB, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/swap.go b/pkg/monitor/dbinit/measurements/swap.go new file mode 100644 index 0000000000..c369968377 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/swap.go @@ -0,0 +1,60 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var swap = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "swap", + DisplayName: "The swap plugin collects system swap metrics.", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "free", + DisplayName: "(int, bytes): free swap memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "total", + DisplayName: "(int, bytes): total swap memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "used", + DisplayName: "(int, bytes): used swap memory", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "used_percent", + DisplayName: "(float, percent): percentage of swap memory used", + Unit: monitor.METRIC_UNIT_PERCENT, + }, + { + Name: "in", + DisplayName: "(int, bytes): data swapped in since last boot calculated from page number", + Unit: monitor.METRIC_UNIT_BYTE, + }, + { + Name: "out", + DisplayName: "(int, bytes): data swapped out since last boot calculated from page number", + Unit: monitor.METRIC_UNIT_BYTE, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/system.go b/pkg/monitor/dbinit/measurements/system.go new file mode 100644 index 0000000000..a685ae176b --- /dev/null +++ b/pkg/monitor/dbinit/measurements/system.go @@ -0,0 +1,46 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var system = SMeasurement{ + Context: []SMonitorContext{ + { + "system", "System load", + monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "load1", "Loadavg load1", monitor.METRIC_UNIT_NULL, + }, + { + "load5", "Loadavg load5", monitor.METRIC_UNIT_NULL, + }, + { + "load15", "Loadavg load15", monitor.METRIC_UNIT_NULL, + }, + { + "load1_pcore", "Loadavg load1 per cpu core", monitor.METRIC_UNIT_NULL, + }, + { + "load5_pcore", "Loadavg load5 per cpu core", monitor.METRIC_UNIT_NULL, + }, + { + "load15_pcore", "Loadavg load15 per cpu core", monitor.METRIC_UNIT_NULL, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/temp.go b/pkg/monitor/dbinit/measurements/temp.go new file mode 100644 index 0000000000..fec5c6a28e --- /dev/null +++ b/pkg/monitor/dbinit/measurements/temp.go @@ -0,0 +1,41 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var temp = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "temp", + DisplayName: "The temp input plugin gather metrics on system temperature", + ResourceType: monitor.METRIC_RES_TYPE_HOST, + Database: monitor.METRIC_DATABASE_TELE, + }, + { + Name: "agent_temp", + DisplayName: "The temp input plugin gather metrics on system temperature", + ResourceType: monitor.METRIC_RES_TYPE_GUEST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "temp", + DisplayName: "(float, celcius)", + Unit: monitor.METRIC_UNIT_NULL, + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/types.go b/pkg/monitor/dbinit/measurements/types.go new file mode 100644 index 0000000000..4859b3541d --- /dev/null +++ b/pkg/monitor/dbinit/measurements/types.go @@ -0,0 +1,33 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +type SMonitorContext struct { + Name string + DisplayName string + ResourceType string + Database string +} + +type SMetric struct { + Name string + DisplayName string + Unit string +} + +type SMeasurement struct { + Context []SMonitorContext + Metrics []SMetric +} diff --git a/pkg/monitor/dbinit/measurements/vasmi.go b/pkg/monitor/dbinit/measurements/vasmi.go new file mode 100644 index 0000000000..8ed1a73222 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/vasmi.go @@ -0,0 +1,67 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var vasmi = SMeasurement{ + Context: []SMonitorContext{ + { + "vasmi", "Vasmi GPU metrics", + monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "temperature_gpu", "GPU temperature", "", + }, + { + "utilization_gpu", "GPU utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_memory", "GPU memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_share_memory", "GPU share memory utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_encoder", "GPU encoder utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_decoder", "GPU decoder utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "utilization_ai", "GPU AI utilization", monitor.METRIC_UNIT_PERCENT, + }, + { + "clocks_current_gpu", "GPU current clocks, MHz", "", + }, + { + "oclk", "oclk, MHz", "", + }, + { + "dclk", "dclk, MHz", "", + }, + { + "eclk", "eclk, MHz", "", + }, + { + "gclk", "gclk, MHz", "", + }, + { + "aic_power", "AIC power", "", + }, + }, +} diff --git a/pkg/monitor/dbinit/measurements/vm_guest.go b/pkg/monitor/dbinit/measurements/vm_guest.go new file mode 100644 index 0000000000..2e3640f322 --- /dev/null +++ b/pkg/monitor/dbinit/measurements/vm_guest.go @@ -0,0 +1,142 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package measurements + +import "yunion.io/x/onecloud/pkg/apis/monitor" + +var vmCpu = SMeasurement{ + Context: []SMonitorContext{ + { + "vm_cpu", "Guest CPU usage", monitor.METRIC_RES_TYPE_GUEST, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "usage_active", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, + }, + { + "cpu_usage_pcore", "CPU utilization rate per core", monitor.METRIC_UNIT_PERCENT, + }, + { + "cpu_usage_idle_pcore", "CPU idle rate per core", monitor.METRIC_UNIT_PERCENT, + }, + { + "cpu_time_system", "CPU system state time", monitor.METRIC_UNIT_MS, + }, + { + "cpu_time_user", "CPU user state time", monitor.METRIC_UNIT_MS, + }, + { + "thread_count", "The number of threads used by the process", monitor.METRIC_UNIT_COUNT, + }, + }, +} + +var vmMem = SMeasurement{ + Context: []SMonitorContext{ + { + "vm_mem", "Guest memory", monitor.METRIC_RES_TYPE_GUEST, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, + }, + { + "vms", "Virtual memory consumption", monitor.METRIC_UNIT_BYTE, + }, + { + "rss", "Actual use of physical memory", monitor.METRIC_UNIT_BYTE, + }, + }, +} + +var vmDiskio = SMeasurement{ + Context: []SMonitorContext{ + { + "vm_diskio", "Guest disk traffic", monitor.METRIC_RES_TYPE_GUEST, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "read_bps", "Disk read rate", monitor.METRIC_UNIT_BYTEPS, + }, + { + "write_bps", "Disk write rate", monitor.METRIC_UNIT_BYTEPS, + }, + { + "read_iops", "Disk read operate rate", monitor.METRIC_UNIT_COUNT, + }, + { + "write_iops", "Disk write operate rate", monitor.METRIC_UNIT_COUNT, + }, + { + "read_bytes", "Bytes read", monitor.METRIC_UNIT_BYTE, + }, + { + "write_bytes", "Bytes write", monitor.METRIC_UNIT_BYTE, + }, + }, +} + +var vmDisk = SMeasurement{ + Context: []SMonitorContext{ + { + "vm_disk", "Guest disk", monitor.METRIC_RES_TYPE_GUEST, + monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + "used_percent", "Used vm disk rate", monitor.METRIC_UNIT_PERCENT, + }, + }, +} + +var vmNetio = SMeasurement{ + Context: []SMonitorContext{ + { + Name: "vm_netio", + DisplayName: "Guest network traffic", + ResourceType: monitor.METRIC_RES_TYPE_GUEST, + Database: monitor.METRIC_DATABASE_TELE, + }, + }, + Metrics: []SMetric{ + { + Name: "bps_recv", + DisplayName: "Received traffic per second", + Unit: monitor.METRIC_UNIT_BPS, + }, + { + Name: "bps_sent", + DisplayName: "Send traffic per second", + Unit: monitor.METRIC_UNIT_BPS, + }, + { + Name: "pps_recv", + DisplayName: "Received packets per second", + Unit: monitor.METRIC_UNIT_PPS, + }, + { + Name: "pps_sent", + DisplayName: "Send packets per second", + Unit: monitor.METRIC_UNIT_PPS, + }, + }, +} diff --git a/pkg/monitor/dbinit/metric_dbinit.go b/pkg/monitor/dbinit/metric_dbinit.go index 39cc1bc89d..dca117ef2a 100644 --- a/pkg/monitor/dbinit/metric_dbinit.go +++ b/pkg/monitor/dbinit/metric_dbinit.go @@ -19,6 +19,7 @@ import ( "yunion.io/x/onecloud/pkg/apis" "yunion.io/x/onecloud/pkg/apis/monitor" + "yunion.io/x/onecloud/pkg/monitor/dbinit/measurements" ) var MetricNeedDeleteDescriptions = []string{} @@ -68,473 +69,24 @@ func newMetricFieldCreateInput(name, displayName, unit string, score int) monito // order by score asc // score default:99 func init() { + var measurements = measurements.All - // cpu - RegistryMetricCreateInput("cpu", "CPU usage", monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, 1, - []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("usage_active", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("usage_idle", "CPU idle state utilization rate", monitor.METRIC_UNIT_PERCENT, 2), - newMetricFieldCreateInput("usage_system", "CPU system state utilization rate", monitor.METRIC_UNIT_PERCENT, 3), - newMetricFieldCreateInput("usage_user", "CPU user mode utilization rate", monitor.METRIC_UNIT_PERCENT, 4), - newMetricFieldCreateInput("usage_iowait", "CPU IO usage", monitor.METRIC_UNIT_PERCENT, 5), - newMetricFieldCreateInput("usage_irq", "CPU IRQ usage", monitor.METRIC_UNIT_PERCENT, 6), - newMetricFieldCreateInput("usage_guest", "CPU guest usage", monitor.METRIC_UNIT_PERCENT, 7), - newMetricFieldCreateInput("usage_nice", "CPU priority switch utilization", monitor.METRIC_UNIT_PERCENT, 8), - newMetricFieldCreateInput("usage_softirq", "CPU softirq usage", monitor.METRIC_UNIT_PERCENT, 9), - }) - - // disk - RegistryMetricCreateInput("disk", "Disk usage", monitor.METRIC_RES_TYPE_HOST, - monitor.METRIC_DATABASE_TELE, 3, - []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Percentage of used disks", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("free", "Free space size", monitor.METRIC_UNIT_BYTE, 2), - newMetricFieldCreateInput("used", "Used disk size", monitor.METRIC_UNIT_BYTE, 3), - newMetricFieldCreateInput("total", "Total disk size", monitor.METRIC_UNIT_BYTE, 4), - newMetricFieldCreateInput("inodes_used_percent", "Percentage of used inodes", monitor.METRIC_UNIT_PERCENT, 5), - newMetricFieldCreateInput("inodes_free", "Available inode", monitor.METRIC_UNIT_COUNT, 6), - newMetricFieldCreateInput("inodes_used", "Number of inodes used", monitor.METRIC_UNIT_COUNT, 7), - newMetricFieldCreateInput("inodes_total", "Total inodes", monitor.METRIC_UNIT_COUNT, 8), - }) - - // diskio - RegistryMetricCreateInput("diskio", "Disk traffic and timing", - monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, 4, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("read_bps", "Disk read rate", monitor.METRIC_UNIT_BPS, 1), - newMetricFieldCreateInput("write_bps", "Disk write rate", monitor.METRIC_UNIT_BPS, 2), - newMetricFieldCreateInput("read_iops", "Disk read operate rate", monitor.METRIC_UNIT_COUNT, 3), - newMetricFieldCreateInput("write_iops", "Disk write operate rate", monitor.METRIC_UNIT_COUNT, 4), - newMetricFieldCreateInput("reads", "Number of reads", monitor.METRIC_UNIT_COUNT, 5), - newMetricFieldCreateInput("writes", "Number of writes", monitor.METRIC_UNIT_COUNT, 6), - newMetricFieldCreateInput("read_bytes", "Bytes read", monitor.METRIC_UNIT_BYTE, 7), - newMetricFieldCreateInput("write_bytes", "Bytes write", monitor.METRIC_UNIT_BYTE, 8), - newMetricFieldCreateInput("write_time", "Time to wait for write", monitor.METRIC_UNIT_MS, 9), - newMetricFieldCreateInput("io_time", "I / O request queuing time", monitor.METRIC_UNIT_MS, 10), - newMetricFieldCreateInput("weighted_io_time", "I / O request waiting time", monitor.METRIC_UNIT_MS, 11), - newMetricFieldCreateInput("iops_in_progress", "Number of I / O requests issued but not yet completed", monitor.METRIC_UNIT_COUNT, 12), - }) - - // mem - RegistryMetricCreateInput("mem", "Memory", monitor.METRIC_RES_TYPE_HOST, - monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("available_percent", "Available memory rate", monitor.METRIC_UNIT_PERCENT, 2), - newMetricFieldCreateInput("free_percent", "Used free rate", monitor.METRIC_UNIT_PERCENT, 3), - newMetricFieldCreateInput("used", "Used memory", monitor.METRIC_UNIT_BYTE, 4), - newMetricFieldCreateInput("free", "Free memory", monitor.METRIC_UNIT_BYTE, 5), - newMetricFieldCreateInput("active", "The amount of active memory", monitor.METRIC_UNIT_BYTE, 6), - newMetricFieldCreateInput("inactive", "The amount of inactive memory", monitor.METRIC_UNIT_BYTE, 7), - newMetricFieldCreateInput("cached", "Cache memory", monitor.METRIC_UNIT_BYTE, 8), - newMetricFieldCreateInput("buffered", "Buffer memory", monitor.METRIC_UNIT_BYTE, 9), - newMetricFieldCreateInput("slab", "Number of kernel caches", monitor.METRIC_UNIT_BYTE, 10), - newMetricFieldCreateInput("available", "Available memory", monitor.METRIC_UNIT_BYTE, 11), - newMetricFieldCreateInput("total", "Total memory", monitor.METRIC_UNIT_BYTE, 12), - }) - - // net - RegistryMetricCreateInput("net", "Network interface and protocol usage", - monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, 5, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, 1), - newMetricFieldCreateInput("bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, 2), - newMetricFieldCreateInput("pps_recv", "Received packets per second", monitor.METRIC_UNIT_PPS, 3), - newMetricFieldCreateInput("pps_sent", "Send packets per second", monitor.METRIC_UNIT_PPS, 4), - newMetricFieldCreateInput("bytes_sent", "The total number of bytes sent by the network interface", monitor.METRIC_UNIT_BYTE, 5), - newMetricFieldCreateInput("bytes_recv", "The total number of bytes received by the network interface", monitor.METRIC_UNIT_BYTE, 6), - newMetricFieldCreateInput("packets_sent", "The total number of packets sent by the network interface", monitor.METRIC_UNIT_COUNT, 7), - newMetricFieldCreateInput("packets_recv", "The total number of packets received by the network interface", monitor.METRIC_UNIT_COUNT, 8), - newMetricFieldCreateInput("err_in", "The total number of receive errors detected by the network interface", monitor.METRIC_UNIT_COUNT, 9), - newMetricFieldCreateInput("err_out", "The total number of transmission errors detected by the network interface", monitor.METRIC_UNIT_COUNT, 10), - newMetricFieldCreateInput("drop_in", "The total number of received packets dropped by the network interface", monitor.METRIC_UNIT_COUNT, 11), - newMetricFieldCreateInput("drop_out", "The total number of transmission packets dropped by the network interface", monitor.METRIC_UNIT_COUNT, 12), - }) - - // system - RegistryMetricCreateInput("system", "System load", - monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, 6, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("load1", "Loadavg load1", monitor.METRIC_UNIT_NULL, 1), - newMetricFieldCreateInput("load5", "Loadavg load5", monitor.METRIC_UNIT_NULL, 2), - newMetricFieldCreateInput("load15", "Loadavg load15", monitor.METRIC_UNIT_NULL, 3), - newMetricFieldCreateInput("load1_pcore", "Loadavg load1 per cpu core", monitor.METRIC_UNIT_NULL, 4), - newMetricFieldCreateInput("load5_pcore", "Loadavg load5 per cpu core", monitor.METRIC_UNIT_NULL, 5), - newMetricFieldCreateInput("load15_pcore", "Loadavg load15 per cpu core", monitor.METRIC_UNIT_NULL, 6), - //newMetricFieldCreateInput("uptime", "System uptime", monitor.METRIC_UNIT_NULL, 7), - }) - // process - RegistryMetricCreateInput("processes", "Processes status", - monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, 7, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("total", "Total processes count", monitor.METRIC_UNIT_COUNT, 1), - newMetricFieldCreateInput("total_threads", "Total threads count", monitor.METRIC_UNIT_COUNT, 2), - newMetricFieldCreateInput("zombies", "Zombie processes count", monitor.METRIC_UNIT_COUNT, 3), - newMetricFieldCreateInput("running", "Running processes count", monitor.METRIC_UNIT_COUNT, 4), - newMetricFieldCreateInput("sleeping", "Sleeping processes count", monitor.METRIC_UNIT_COUNT, 5), - }) - - RegistryMetricCreateInput("linux_sysctl_fs", "Provides Linux sysctl fs metrics", - monitor.METRIC_RES_TYPE_HOST, monitor.METRIC_DATABASE_TELE, 13, - []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("file_nr", "The number of allocated file handles", "", 1), - newMetricFieldCreateInput("file_max", "The maximum number of file handles that the Linux kernel will allocate.", "", 2), - newMetricFieldCreateInput("inode_nr", "The number of inodes the system has allocated", "", 3), - newMetricFieldCreateInput("inode_free_nr", "The number of free inodes", "", 4), - newMetricFieldCreateInput("aio_nr", "The running total of the number of events specified on the io_setup system call for all currently active aio contexts", "", 5), - newMetricFieldCreateInput("aio_max_nr", "The running total of the number of events specified on the io_setup system call for all currently active aio contexts", "", 6), - }) - - // vm_cpu - RegistryMetricCreateInput("vm_cpu", "Guest CPU usage", monitor.METRIC_RES_TYPE_GUEST, - monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("usage_active", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("cpu_usage_pcore", "CPU utilization rate per core", monitor.METRIC_UNIT_PERCENT, 2), - newMetricFieldCreateInput("cpu_usage_idle_pcore", "CPU idle rate per core", monitor.METRIC_UNIT_PERCENT, 3), - newMetricFieldCreateInput("cpu_time_system", "CPU system state time", monitor.METRIC_UNIT_MS, 4), - newMetricFieldCreateInput("cpu_time_user", "CPU user state time", monitor.METRIC_UNIT_MS, 5), - newMetricFieldCreateInput("thread_count", "The number of threads used by the process", monitor.METRIC_UNIT_COUNT, 6), - }) - - // vm_diskio - RegistryMetricCreateInput("vm_diskio", "Guest disk traffic", monitor.METRIC_RES_TYPE_GUEST, - monitor.METRIC_DATABASE_TELE, 3, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("read_bps", "Disk read rate", monitor.METRIC_UNIT_BYTEPS, 1), - newMetricFieldCreateInput("write_bps", "Disk write rate", monitor.METRIC_UNIT_BYTEPS, 2), - newMetricFieldCreateInput("read_iops", "Disk read operate rate", monitor.METRIC_UNIT_COUNT, 3), - newMetricFieldCreateInput("write_iops", "Disk write operate rate", monitor.METRIC_UNIT_COUNT, 4), - newMetricFieldCreateInput("read_bytes", "Bytes read", monitor.METRIC_UNIT_BYTE, 5), - newMetricFieldCreateInput("write_bytes", "Bytes write", monitor.METRIC_UNIT_BYTE, 6), - }) - - // vm_disk - RegistryMetricCreateInput("vm_disk", "Guest disk", monitor.METRIC_RES_TYPE_GUEST, - monitor.METRIC_DATABASE_TELE, 3, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Used vm disk rate", monitor.METRIC_UNIT_PERCENT, 1), - }) - - // vm_mem - RegistryMetricCreateInput("vm_mem", "Guest memory", monitor.METRIC_RES_TYPE_GUEST, - monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("vms", "Virtual memory consumption", monitor.METRIC_UNIT_BYTE, 2), - newMetricFieldCreateInput("rss", "Actual use of physical memory", monitor.METRIC_UNIT_BYTE, 3), - }) - - // vm_netio - RegistryMetricCreateInput("vm_netio", "Guest network traffic", monitor.METRIC_RES_TYPE_GUEST, - monitor.METRIC_DATABASE_TELE, 4, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, 1), - newMetricFieldCreateInput("bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, 2), - newMetricFieldCreateInput("pps_recv", "Received packets per second", monitor.METRIC_UNIT_PPS, 3), - newMetricFieldCreateInput("pps_sent", "Send packets per second", monitor.METRIC_UNIT_PPS, 4), - }) - - // oss_latency - RegistryMetricCreateInput("oss_latency", "Object storage latency", - monitor.METRIC_RES_TYPE_OSS, monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("req_late", "Request average E2E delay", monitor.METRIC_UNIT_MS, 1), - }) - - // oss_netio - RegistryMetricCreateInput("oss_netio", "Object storage network traffic", - monitor.METRIC_RES_TYPE_OSS, monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("bps_recv", "Receive byte", monitor.METRIC_UNIT_BYTE, 1), - newMetricFieldCreateInput("bps_sent", "Send byte", monitor.METRIC_UNIT_BYTE, 2), - }) - - // oss_req - RegistryMetricCreateInput("oss_req", "Object store request", monitor.METRIC_RES_TYPE_OSS, - monitor.METRIC_DATABASE_TELE, 3, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("req_count", "request count", monitor.METRIC_UNIT_COUNT, 1), - }) - - // rds_conn - RegistryMetricCreateInput("rds_conn", "Rds connection", monitor.METRIC_RES_TYPE_RDS, - monitor.METRIC_DATABASE_TELE, 5, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Connection usage", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("active_count", "active connection count", monitor.METRIC_UNIT_COUNT, 2), - newMetricFieldCreateInput("failed_count", "failed connection count", monitor.METRIC_UNIT_COUNT, 3), - }) - - // rds_cpu - RegistryMetricCreateInput("rds_cpu", "Rds CPU usage", monitor.METRIC_RES_TYPE_RDS, - monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("usage_active", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, 2), - }) - - // rds_mem - RegistryMetricCreateInput("rds_mem", "Rds memory", monitor.METRIC_RES_TYPE_RDS, - monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, 1), - }) - - // rds_netio - RegistryMetricCreateInput("rds_netio", "Rds network traffic", monitor.METRIC_RES_TYPE_RDS, - monitor.METRIC_DATABASE_TELE, 4, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, 1), - newMetricFieldCreateInput("bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, 2), - }) - - // rds_disk - RegistryMetricCreateInput("rds_disk", "Rds disk usage", monitor.METRIC_RES_TYPE_RDS, - monitor.METRIC_DATABASE_TELE, 3, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Percentage of used disks", monitor.METRIC_UNIT_PERCENT, 1), - }) - - // dcs_cpu - RegistryMetricCreateInput("dcs_cpu", "Redis CPU usage", monitor.METRIC_RES_TYPE_REDIS, - monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("usage_percent", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("server_load", "server load", monitor.METRIC_UNIT_PERCENT, 2), - }) - - // dcs_mem - RegistryMetricCreateInput("dcs_mem", "Redis memory", monitor.METRIC_RES_TYPE_REDIS, - monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, 1), - }) - - // dcs_netio - RegistryMetricCreateInput("dcs_netio", "Redis network traffic", - monitor.METRIC_RES_TYPE_REDIS, - monitor.METRIC_DATABASE_TELE, 4, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, 1), - newMetricFieldCreateInput("bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, 2), - }) - - // dcs_conn - RegistryMetricCreateInput("dcs_conn", "Redis connect", monitor.METRIC_RES_TYPE_REDIS, - monitor.METRIC_DATABASE_TELE, 5, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Connection usage", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("errors", "Connection errors", monitor.METRIC_UNIT_COUNT, 1), - }) - - // dcs_instantopt - RegistryMetricCreateInput("dcs_instantopt", "Redis operator", - monitor.METRIC_RES_TYPE_REDIS, monitor.METRIC_DATABASE_TELE, 5, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("opt_sec", "Number of commands processed per second", monitor.METRIC_UNIT_COUNT, 1), - }) - - // dcs_cachekeys - RegistryMetricCreateInput("dcs_cachekeys", "Redis keys", monitor.METRIC_RES_TYPE_REDIS, - monitor.METRIC_DATABASE_TELE, 6, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("key_count", "Number of cache keys", monitor.METRIC_UNIT_COUNT, 1), - }) - - // dcs_datamem - RegistryMetricCreateInput("dcs_datamem", "Redis data memory", monitor.METRIC_RES_TYPE_REDIS, - monitor.METRIC_DATABASE_TELE, 3, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_byte", "Data node memory usage", monitor.METRIC_UNIT_BYTE, 1), - }) - - // cloudaccount_balance - RegistryMetricCreateInput("cloudaccount_balance", "Cloud account balance", - monitor.METRIC_RES_TYPE_CLOUDACCOUNT, - monitor.METRIC_DATABASE_METER, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("balance", "balance", monitor.METRIC_UNIT_NULL, 1), - }) - - // haproxy - RegistryMetricCreateInput("haproxy", "load balance", monitor.METRIC_RES_TYPE_ELB, - monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_snat_port", "used SNAT port count", monitor.METRIC_UNIT_COUNT, 1), - newMetricFieldCreateInput("snat_conn_count", "SNAT connection count", monitor.METRIC_UNIT_COUNT, 1), - }) - - // agent_cpu - RegistryMetricCreateInput("agent_cpu", "CPU usage", monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, 1, - []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("usage_active", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("usage_idle", "CPU idle state utilization rate", monitor.METRIC_UNIT_PERCENT, 2), - newMetricFieldCreateInput("usage_system", "CPU system state utilization rate", monitor.METRIC_UNIT_PERCENT, 3), - newMetricFieldCreateInput("usage_user", "CPU user mode utilization rate", monitor.METRIC_UNIT_PERCENT, 4), - newMetricFieldCreateInput("usage_iowait", "CPU IO usage", monitor.METRIC_UNIT_PERCENT, 5), - newMetricFieldCreateInput("usage_irq", "CPU IRQ usage", monitor.METRIC_UNIT_PERCENT, 6), - newMetricFieldCreateInput("usage_guest", "CPU guest usage", monitor.METRIC_UNIT_PERCENT, 7), - newMetricFieldCreateInput("usage_nice", "CPU priority switch utilization", monitor.METRIC_UNIT_PERCENT, 8), - newMetricFieldCreateInput("usage_softirq", "CPU softirq usage", monitor.METRIC_UNIT_PERCENT, 9), - }) - - // agent_disk - RegistryMetricCreateInput("agent_disk", "Disk usage", monitor.METRIC_RES_TYPE_AGENT, - monitor.METRIC_DATABASE_TELE, 3, - []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Percentage of used disks", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("free", "Free space size", monitor.METRIC_UNIT_BYTE, 2), - newMetricFieldCreateInput("used", "Used disk size", monitor.METRIC_UNIT_BYTE, 3), - newMetricFieldCreateInput("total", "Total disk size", monitor.METRIC_UNIT_BYTE, 4), - newMetricFieldCreateInput("inodes_used_percent", "Percentage of used inodes", monitor.METRIC_UNIT_PERCENT, 5), - newMetricFieldCreateInput("inodes_free", "Available inode", monitor.METRIC_UNIT_COUNT, 6), - newMetricFieldCreateInput("inodes_used", "Number of inodes used", monitor.METRIC_UNIT_COUNT, 7), - newMetricFieldCreateInput("inodes_total", "Total inodes", monitor.METRIC_UNIT_COUNT, 8), - }) - - // agent_diskio - RegistryMetricCreateInput("agent_diskio", "Disk traffic and timing", - monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, 4, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("read_bps", "Disk read rate", monitor.METRIC_UNIT_BPS, 1), - newMetricFieldCreateInput("write_bps", "Disk write rate", monitor.METRIC_UNIT_BPS, 2), - newMetricFieldCreateInput("read_iops", "Disk read operate rate", monitor.METRIC_UNIT_COUNT, 3), - newMetricFieldCreateInput("write_iops", "Disk write operate rate", monitor.METRIC_UNIT_COUNT, 4), - newMetricFieldCreateInput("reads", "Number of reads", monitor.METRIC_UNIT_COUNT, 5), - newMetricFieldCreateInput("writes", "Number of writes", monitor.METRIC_UNIT_COUNT, 6), - newMetricFieldCreateInput("read_bytes", "Bytes read", monitor.METRIC_UNIT_BYTE, 7), - newMetricFieldCreateInput("write_bytes", "Bytes write", monitor.METRIC_UNIT_BYTE, 8), - newMetricFieldCreateInput("write_time", "Time to wait for write", monitor.METRIC_UNIT_MS, 9), - newMetricFieldCreateInput("io_time", "I / O request queuing time", monitor.METRIC_UNIT_MS, 10), - newMetricFieldCreateInput("weighted_io_time", "I / O request waiting time", monitor.METRIC_UNIT_MS, 11), - newMetricFieldCreateInput("iops_in_progress", "Number of I / O requests issued but not yet completed", monitor.METRIC_UNIT_COUNT, 12), - }) - - // agent_mem - RegistryMetricCreateInput("agent_mem", "Memory", monitor.METRIC_RES_TYPE_AGENT, - monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("available_percent", "Available memory rate", monitor.METRIC_UNIT_PERCENT, 2), - newMetricFieldCreateInput("used", "Used memory", monitor.METRIC_UNIT_BYTE, 3), - newMetricFieldCreateInput("free", "Free memory", monitor.METRIC_UNIT_BYTE, 4), - newMetricFieldCreateInput("active", "The amount of active memory", monitor.METRIC_UNIT_BYTE, 5), - newMetricFieldCreateInput("inactive", "The amount of inactive memory", monitor.METRIC_UNIT_BYTE, 6), - newMetricFieldCreateInput("cached", "Cache memory", monitor.METRIC_UNIT_BYTE, 7), - newMetricFieldCreateInput("buffered", "Buffer memory", monitor.METRIC_UNIT_BYTE, 7), - newMetricFieldCreateInput("slab", "Number of kernel caches", monitor.METRIC_UNIT_BYTE, 8), - newMetricFieldCreateInput("available", "Available memory", monitor.METRIC_UNIT_BYTE, 9), - newMetricFieldCreateInput("total", "Total memory", monitor.METRIC_UNIT_BYTE, 10), - }) - - // agent_net - RegistryMetricCreateInput("agent_net", "Network interface and protocol usage", - monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, 5, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, 1), - newMetricFieldCreateInput("bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, 2), - newMetricFieldCreateInput("pps_recv", "Received packets per second", monitor.METRIC_UNIT_PPS, 3), - newMetricFieldCreateInput("pps_sent", "Send packets per second", monitor.METRIC_UNIT_PPS, 4), - newMetricFieldCreateInput("bytes_sent", "The total number of bytes sent by the network interface", monitor.METRIC_UNIT_BYTE, 5), - newMetricFieldCreateInput("bytes_recv", "The total number of bytes received by the network interface", monitor.METRIC_UNIT_BYTE, 6), - newMetricFieldCreateInput("packets_sent", "The total number of packets sent by the network interface", monitor.METRIC_UNIT_COUNT, 7), - newMetricFieldCreateInput("packets_recv", "The total number of packets received by the network interface", monitor.METRIC_UNIT_COUNT, 8), - newMetricFieldCreateInput("err_in", "The total number of receive errors detected by the network interface", monitor.METRIC_UNIT_COUNT, 9), - newMetricFieldCreateInput("err_out", "The total number of transmission errors detected by the network interface", monitor.METRIC_UNIT_COUNT, 10), - newMetricFieldCreateInput("drop_in", "The total number of received packets dropped by the network interface", monitor.METRIC_UNIT_COUNT, 11), - newMetricFieldCreateInput("drop_out", "The total number of transmission packets dropped by the network interface", monitor.METRIC_UNIT_COUNT, 12), - }) - - // agent lm-sensors temperature - RegistryMetricCreateInput("agent_sensors", "Collect lm-sensors metrics", - monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, 6, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("temp_input", "lm-sensors temperature input", "", 1), - }) - - // agent smartctl device temperature - RegistryMetricCreateInput("agent_smart_device", "Collect smartctl metrics", - monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, 7, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("temp_c", "Disk device temperature ", "", 1), - }) - - // agent nvidia_smi - RegistryMetricCreateInput("agent_nvidia_smi", "Collect Nvidia GPU metrics", - monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, 8, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("clocks_current_graphics", "GPU current clocks, MHz", "", 1), - newMetricFieldCreateInput("clocks_current_memory", "GPU current memory clocks, MHz", "", 2), - newMetricFieldCreateInput("temperature_gpu", "GPU temperature", "", 3), - newMetricFieldCreateInput("memory_total", "GPU memory total size", "", 4), - newMetricFieldCreateInput("memory_free", "GPU memory free size", "", 5), - newMetricFieldCreateInput("memory_used", "GPU memory used size", "", 6), - newMetricFieldCreateInput("utilization_gpu", "GPU utilization", "", 7), - newMetricFieldCreateInput("utilization_memory", "GPU memory utilization", "", 8), - }) - - RegistryMetricCreateInput("storage", "Storage usage", - monitor.METRIC_RES_TYPE_STORAGE, monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("usage_active", "Storage utilization rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("free", "Free storage", monitor.METRIC_UNIT_MB, 2), - }) - - //jenkins - RegistryMetricCreateInput("jenkins_node", "jenkins node", - monitor.METRIC_RES_TYPE_JENKINS, monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("disk_available", "disk_available", monitor.METRIC_UNIT_BYTE, 1), - newMetricFieldCreateInput("temp_available", "temp_available", monitor.METRIC_UNIT_BYTE, 2), - newMetricFieldCreateInput("memory_available", "memory_available", monitor.METRIC_UNIT_BYTE, 3), - newMetricFieldCreateInput("memory_total", "memory_total", monitor.METRIC_UNIT_BYTE, 4), - newMetricFieldCreateInput("swap_available", "swap_available", monitor.METRIC_UNIT_BYTE, 5), - newMetricFieldCreateInput("swap_total", "swap_total", monitor.METRIC_UNIT_BYTE, 6), - }) - RegistryMetricCreateInput("jenkins_job", "jenkins job", - monitor.METRIC_RES_TYPE_JENKINS, monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("duration", "duration", monitor.METRIC_UNIT_MS, 1), - newMetricFieldCreateInput("number", "number", monitor.METRIC_UNIT_COUNT, 2), - }) - - //ext mysql - RegistryMetricCreateInput("mysql", "mysql", - monitor.METRIC_RES_TYPE_EXT_MYSQL, monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("binary_size_bytes", "binary_size_bytes", monitor.METRIC_UNIT_BYTE, 1), - newMetricFieldCreateInput("binary_files_count", "binary_files_count", monitor.METRIC_UNIT_COUNT, 2), - newMetricFieldCreateInput("connections", "connections", monitor.METRIC_UNIT_COUNT, 3), - newMetricFieldCreateInput("table_io_waits_total_fetch", "table_io_waits_total_fetch", monitor.METRIC_UNIT_COUNT, 4), - newMetricFieldCreateInput("table_io_waits_seconds_total_fetch", "table_io_waits_seconds_total_fetch", monitor.METRIC_UNIT_MS, 5), - newMetricFieldCreateInput("index_io_waits_total_fetch", "index_io_waits_total_fetch", monitor.METRIC_UNIT_COUNT, 6), - newMetricFieldCreateInput("index_io_waits_seconds_total_fetch", "index_io_waits_seconds_total_fetch", monitor.METRIC_UNIT_MS, 7), - newMetricFieldCreateInput("info_schema_table_rows", "info_schema_table_rows", monitor.METRIC_UNIT_COUNT, 8), - newMetricFieldCreateInput("info_schema_table_size_data_length", "info_schema_table_size_data_length", monitor.METRIC_UNIT_COUNT, 8), - newMetricFieldCreateInput("info_schema_table_size_index_length", "info_schema_table_size_index_length", monitor.METRIC_UNIT_COUNT, 9), - }) - - //ext redis - RegistryMetricCreateInput("redis", "redis", - monitor.METRIC_RES_TYPE_EXT_REDIS, monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("used_memory", "used_memory", monitor.METRIC_UNIT_BYTE, 1), - newMetricFieldCreateInput("used_memory_peak", "used_memory_peak", monitor.METRIC_UNIT_BYTE, 2), - newMetricFieldCreateInput("used_cpu_sys", "used_cpu_sys", monitor.METRIC_UNIT_PERCENT, 3), - newMetricFieldCreateInput("used_cpu_user", "used_cpu_user", monitor.METRIC_UNIT_PERCENT, 4), - }) - RegistryMetricCreateInput("redis_keyspace", "redis_keyspace", - monitor.METRIC_RES_TYPE_EXT_REDIS, monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("keys", "keys", monitor.METRIC_UNIT_COUNT, 1), - newMetricFieldCreateInput("expires", "expires", monitor.METRIC_UNIT_COUNT, 2), - }) - - //ext rabbitmq - RegistryMetricCreateInput("rabbitmq_overview", "rabbitmq_overview", - monitor.METRIC_RES_TYPE_EXT_RABBITMQ, monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("channels", "channels", monitor.METRIC_UNIT_COUNT, 1), - newMetricFieldCreateInput("consumers", "consumers", monitor.METRIC_UNIT_COUNT, 2), - newMetricFieldCreateInput("messages", "messages", monitor.METRIC_UNIT_COUNT, 3), - newMetricFieldCreateInput("queues", "queues", monitor.METRIC_UNIT_COUNT, 4), - }) - RegistryMetricCreateInput("rabbitmq_node", "rabbitmq_node", - monitor.METRIC_RES_TYPE_EXT_RABBITMQ, monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("disk_free", "disk_free", monitor.METRIC_UNIT_BYTE, 2), - newMetricFieldCreateInput("mem_used", "mem_used", monitor.METRIC_UNIT_BYTE, 1), - }) - RegistryMetricCreateInput("rabbitmq_queue", "rabbitmq_queue", - monitor.METRIC_RES_TYPE_EXT_RABBITMQ, monitor.METRIC_DATABASE_TELE, 3, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("consumer_utilisation", "consumer_utilisation", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("message_bytes", "message_bytes", monitor.METRIC_UNIT_BYTE, 2), - newMetricFieldCreateInput("message_bytes_ram", "message_bytes_ram", monitor.METRIC_UNIT_BYTE, 3), - newMetricFieldCreateInput("messages", "messages", monitor.METRIC_UNIT_COUNT, 4), - }) - - // k8s - // pod - RegistryMetricCreateInput("k8s_pod", "k8s pod", - monitor.METRIC_RES_TYPE_K8S, monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("cpu_used_percent", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("mem_used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, 2), - newMetricFieldCreateInput("restart_total", "pod restart count", monitor.METRIC_UNIT_COUNT, 3), - }) - // deploy/daemonset - RegistryMetricCreateInput("k8s_deploy", "k8s deploy", - monitor.METRIC_RES_TYPE_K8S, monitor.METRIC_DATABASE_TELE, 2, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("pod_oom_total", "oom pod count", monitor.METRIC_UNIT_COUNT, 1), - newMetricFieldCreateInput("pod_restarting_total", "restarting pod count", monitor.METRIC_UNIT_COUNT, 2), - }) - // node - RegistryMetricCreateInput("k8s_node", "k8s node", - monitor.METRIC_RES_TYPE_K8S, monitor.METRIC_DATABASE_TELE, 3, []monitor.MetricFieldCreateInput{ - newMetricFieldCreateInput("cpu_used_percent", "CPU active state utilization rate", monitor.METRIC_UNIT_PERCENT, 1), - newMetricFieldCreateInput("mem_used_percent", "Used memory rate", monitor.METRIC_UNIT_PERCENT, 2), - newMetricFieldCreateInput("disk_used_percent", "Percentage of used disks", monitor.METRIC_UNIT_PERCENT, 3), - newMetricFieldCreateInput("bps_sent", "Send traffic per second", monitor.METRIC_UNIT_BPS, 3), - newMetricFieldCreateInput("bps_recv", "Received traffic per second", monitor.METRIC_UNIT_BPS, 4), - newMetricFieldCreateInput("pod_restart_total", "pod restart count in node", monitor.METRIC_UNIT_COUNT, 4), - }) + metricCount := 0 + scoreIdx := 0 + for mIdx := range measurements { + measurement := measurements[mIdx] + for ctxIdx := range measurement.Context { + ctx := measurement.Context[ctxIdx] + inputs := []monitor.MetricFieldCreateInput{} + for metricIdx := range measurement.Metrics { + metric := measurement.Metrics[metricIdx] + inputs = append(inputs, newMetricFieldCreateInput(metric.Name, metric.DisplayName, metric.Unit, metricIdx+1)) + metricCount++ + } + RegistryMetricCreateInput(ctx.Name, ctx.DisplayName, ctx.ResourceType, ctx.Database, scoreIdx+1, inputs) + scoreIdx++ + } + } + log.Infof("[monitor.dbinit] Register %d metrics", metricCount) }