ClickHouse/clickhouse_exporter

not working for clickhouse-server ver. 18.12.5 Changed format

MykhailoSobol opened this issue · 4 comments

clickhouse-server ver. 18.12.5

clickhouse_exporter error:
clickhouse_exporter[7274]: time="2018-09-07T13:44:19Z" level=info msg="Error scraping clickhouse: Error scraping clickhouse url https://localhost:8443/?query=select+%2A+from+system.metrics: parseKeyValueResponse: unexpected 0 line: Query 1 Number of executing queries" file=exporter.go line=299

Changed format!

old_ver 1.1.54388:

root@clickhouse1 ~ # curl -k  https://localhost:8443/?query=select+%2A+from+system.metrics
Query	1
Merge	0
PartMutation	0
ReplicatedFetch	0
ReplicatedSend	0
ReplicatedChecks	0
BackgroundPoolTask	0
BackgroundSchedulePoolTask	0
DiskSpaceReservedForMerge	0
DistributedSend	0
QueryPreempted	0
TCPConnection	126
HTTPConnection	1
InterserverConnection	0
OpenFileForRead	0
OpenFileForWrite	0
Read	1
Write	0
SendExternalTables	0
QueryThread	0
ReadonlyReplica	0
LeaderReplica	116
MemoryTracking	8704
MemoryTrackingInBackgroundProcessingPool	29216
MemoryTrackingInBackgroundSchedulePool	0
MemoryTrackingForMerges	0
LeaderElection	116
EphemeralNode	232
ZooKeeperSession	1
ZooKeeperWatch	349
ZooKeeperRequest	0
DelayedInserts	0
ContextLockWait	0
StorageBufferRows	0
StorageBufferBytes	0
DictCacheRequests	0
Revision	54388
RWLockWaitingReaders	0
RWLockWaitingWriters	0
RWLockActiveReaders	1
RWLockActiveWriters	0

new_ver 18.12.5:

root@ch1 ~ # curl -k   https://localhost:8443/?query=select+%2A+from+system.metrics
Query	1	Number of executing queries
Merge	0	Number of executing background merges
PartMutation	0	Number of mutations (ALTER DELETE/UPDATE)
ReplicatedFetch	0	Number of data parts fetching from replica
ReplicatedSend	0	Number of data parts sending to replicas
ReplicatedChecks	0	Number of data parts checking for consistency
BackgroundPoolTask	0	Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches or replication queue bookkeeping)
BackgroundSchedulePoolTask	0	Number of active tasks in BackgroundSchedulePool. This pool is used for periodic tasks of ReplicatedMergeTree like cleaning old data parts, altering data parts, replica re-initialization, etc.
DiskSpaceReservedForMerge	0	Disk space reserved for currently running background merges. It is slightly more than total size of currently merging parts.
DistributedSend	0	Number of connections sending data, that was INSERTed to Distributed tables, to remote servers. Both synchronous and asynchronous mode.
QueryPreempted	0	Number of queries that are stopped and waiting due to \'priority\' setting.
TCPConnection	0	Number of connections to TCP server (clients with native interface)
HTTPConnection	1	Number of connections to HTTP server
InterserverConnection	0	Number of connections from other replicas to fetch parts
OpenFileForRead	0	Number of files open for reading
OpenFileForWrite	0	Number of files open for writing
Read	1	Number of read (read, pread, io_getevents, etc.) syscalls in fly
Write	0	Number of write (write, pwrite, io_getevents, etc.) syscalls in fly
SendExternalTables	0	Number of connections that are sending data for external tables to remote servers. External tables are used to implement GLOBAL IN and GLOBAL JOIN operators with distributed subqueries.
QueryThread	0	Number of query processing threads
ReadonlyReplica	0	Number of Replicated tables that are currently in readonly state due to re-initialization after ZooKeeper session loss or due to startup without ZooKeeper configured.
LeaderReplica	21	Number of Replicated tables that are leaders. Leader replica is responsible for assigning merges, cleaning old blocks for deduplications and a few more bookkeeping tasks. There may be no more than one leader across all replicas at one moment of time. If there is no leader it will be elected soon or it indicate an issue.
MemoryTracking	69847347	Total amount of memory (bytes) allocated in currently executing queries. Note that some memory allocations may not be accounted.
MemoryTrackingInBackgroundProcessingPool	0	Total amount of memory (bytes) allocated in background processing pool (that is dedicated for backround merges, mutations and fetches). Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa. This happens naturally due to caches for tables indexes and doesn\'t indicate memory leaks.
MemoryTrackingInBackgroundSchedulePool	0	Total amount of memory (bytes) allocated in background schedule pool (that is dedicated for bookkeeping tasks of Replicated tables).
MemoryTrackingForMerges	0	Total amount of memory (bytes) allocated for background merges. Included in MemoryTrackingInBackgroundProcessingPool. Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa. This happens naturally due to caches for tables indexes and doesn\'t indicate memory leaks.
LeaderElection	21	Number of Replicas participating in leader election. Equals to total number of replicas in usual cases.
EphemeralNode	42	Number of ephemeral nodes hold in ZooKeeper.
ZooKeeperSession	1	Number of sessions (connections) to ZooKeeper. Should be no more than one, because using more than one connection to ZooKeeper may lead to bugs due to lack of linearizability (stale reads) that ZooKeeper consistency model allows.
ZooKeeperWatch	64	Number of watches (event subscriptions) in ZooKeeper.
ZooKeeperRequest	0	Number of requests to ZooKeeper in fly.
DelayedInserts	0	Number of INSERT queries that are throttled due to high number of active data parts for partition in a MergeTree table.
ContextLockWait	0	Number of threads waiting for lock in Context. This is global lock.
StorageBufferRows	0	Number of rows in buffers of Buffer tables
StorageBufferBytes	0	Number of bytes in buffers of Buffer tables
DictCacheRequests	0	Number of requests in fly to data sources of dictionaries of cache type.
Revision	54407	Revision of the server. It is a number incremented for every release or release candidate.
RWLockWaitingReaders	0	Number of threads waiting for read on a table RWLock.
RWLockWaitingWriters	0	Number of threads waiting for write on a table RWLock.
RWLockActiveReaders	1	Number of threads holding read lock in a table RWLock.
RWLockActiveWriters	0	Number of threads holding write lock in a table RWLock
.```

I've prepared hotfix username1366@1ca6347

+1
The newest version includes more metrics

I've prepared hotfix username1366@1ca6347

    q.Set("query", "select metric, value from system.metrics")
    metricsURI.RawQuery = q.Encode()

    asyncMetricsURI := uri
    q.Set("query", "select metric, value from system.asynchronous_metrics")
    asyncMetricsURI.RawQuery = q.Encode()

    eventsURI := uri
    q.Set("query", "select event, value from system.events")

It works also.

Thanks, I merged this fix.