Add vertica new metrics
Added metrics for used license percentage, total amount of metric definitions and measurements Change-Id: I75a850e68fd6ec32f03a7645a1b14c2883557ee3
This commit is contained in:
@@ -1500,6 +1500,7 @@ instances:
|
||||
|
||||
| Metric Name | Dimensions | Semantics |
|
||||
| ----------- | ---------- | --------- |
|
||||
| vertica.license_usage_percent | hostname, service=vertica| Percentage of the license size taken up. |
|
||||
| vertica.connection_status | hostname, node_name, service=vertica | Value of DB connection status (0=Healthy). |
|
||||
| vertica.node_status | hostname, node_name, service=vertica| Status of node connection (0=UP). |
|
||||
| vertica.projection.ros_count | hostname, node_name, projection_name, service=vertica| The number of ROS containers in the projection. |
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP
|
||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
|
||||
|
||||
import monasca_agent.collector.checks as checks
|
||||
from monasca_agent.common.util import timeout_command
|
||||
|
||||
LICENSE_STATUS_QUERY = "SELECT COALESCE(" \
|
||||
"(SELECT usage_percent * 100 " \
|
||||
"FROM v_catalog.license_audits " \
|
||||
"WHERE audited_data ='Total' " \
|
||||
"ORDER BY audit_start_timestamp " \
|
||||
"DESC LIMIT 1), 0) license_usage_percent;"
|
||||
|
||||
NODE_METRICS_QUERY = "SELECT node_state " \
|
||||
"FROM NODES " \
|
||||
"WHERE node_name = '{0}';"
|
||||
|
||||
RESOURCE_METRICS_QUERY = "SELECT COALESCE(request_queue_depth, 0) request_queue_depth, " \
|
||||
"wos_used_bytes, " \
|
||||
"COALESCE(resource_request_reject_count, 0) resource_rejections, " \
|
||||
"COALESCE(disk_space_request_reject_count, 0) disk_space_rejections " \
|
||||
"FROM resource_usage " \
|
||||
"WHERE node_name = '{0}';"
|
||||
|
||||
PROJECTION_METRICS_QUERY = "SELECT projection_name, wos_used_bytes, ros_count, " \
|
||||
"COALESCE(tuple_mover_moveouts, 0) tuple_mover_moveouts, " \
|
||||
"COALESCE(tuple_mover_mergeouts, 0) tuple_mover_mergeouts " \
|
||||
@@ -27,6 +27,13 @@ PROJECTION_METRICS_QUERY = "SELECT projection_name, wos_used_bytes, ros_count, "
|
||||
"ON projection_storage.projection_id = tm.projection_id " \
|
||||
"WHERE node_name = '{0}';"
|
||||
|
||||
RESOURCE_METRICS_QUERY = "SELECT COALESCE(request_queue_depth, 0) request_queue_depth, " \
|
||||
"wos_used_bytes, " \
|
||||
"COALESCE(resource_request_reject_count, 0) resource_rejections, " \
|
||||
"COALESCE(disk_space_request_reject_count, 0) disk_space_rejections " \
|
||||
"FROM resource_usage " \
|
||||
"WHERE node_name = '{0}';"
|
||||
|
||||
RESOURCE_POOL_METRICS_QUERY = "SELECT pool_name, memory_size_actual_kb, memory_inuse_kb, running_query_count, " \
|
||||
"COALESCE(rejection_count, 0) rejection_count " \
|
||||
"FROM resource_pool_status " \
|
||||
@@ -72,13 +79,20 @@ class Vertica(checks.AgentCheck):
|
||||
self.gauge('vertica.connection_status', 0, dimensions=dimensions)
|
||||
self._last_connection_status = 0
|
||||
results = results.split('\n')
|
||||
self._report_node_status(results[0], dimensions)
|
||||
|
||||
self._report_resource_metrics(results[1], dimensions)
|
||||
# Database metrics
|
||||
self._report_license_status(results[0], dimensions)
|
||||
|
||||
self._report_projection_metrics(results[2], dimensions)
|
||||
# Node metrics
|
||||
dimensions['node_name'] = node_name
|
||||
|
||||
self._report_resource_pool_metrics(results[3], dimensions)
|
||||
self._report_node_status(results[1], dimensions)
|
||||
|
||||
self._report_resource_metrics(results[2], dimensions)
|
||||
|
||||
self._report_projection_metrics(results[3], dimensions)
|
||||
|
||||
self._report_resource_pool_metrics(results[4], dimensions)
|
||||
|
||||
def _query_database(self, user, password, timeout, query):
|
||||
stdout, stderr, return_code = timeout_command(["/opt/vertica/bin/vsql", "-U", user, "-w", password, "-A", "-R",
|
||||
@@ -93,6 +107,7 @@ class Vertica(checks.AgentCheck):
|
||||
|
||||
def _build_query(self, node_name):
|
||||
query = ''
|
||||
query += LICENSE_STATUS_QUERY
|
||||
query += NODE_METRICS_QUERY.format(node_name)
|
||||
query += RESOURCE_METRICS_QUERY.format(node_name)
|
||||
query += PROJECTION_METRICS_QUERY.format(node_name)
|
||||
@@ -154,3 +169,9 @@ class Vertica(checks.AgentCheck):
|
||||
dimensions=resource_pool_dimensions)
|
||||
self.rate(resource_pool_metric_name + 'rejection_count', int(result['rejection_count']),
|
||||
dimensions=resource_pool_dimensions)
|
||||
|
||||
def _report_license_status(self, results, dimensions):
|
||||
results = self._results_to_dict(results)
|
||||
license_status = results[0]
|
||||
self.gauge('vertica.license_usage_percent', float(license_status['license_usage_percent']),
|
||||
dimensions=dimensions)
|
||||
|
||||
Reference in New Issue
Block a user