Skip to content

Adding a custom metric (db_size) / query format #514

Closed Answered by burningalchemist
TomClqncy asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah, this part specifically (this is from sql_exporter):

    metrics:
    - metric_name: mssql_db_count
      type: counter 
      help: 'Number of dbs on Host.' 
      key_labels: 
      - DB_NAME
      value_label: dbs 
      values: 
      - Number of Databases 
      query: |
        SELECT count(name) as NumOfDBs, state_desc FROM master.sys.databases where database_id > 4 group by state_desc

Values list should be a set of column names. So if in the query you put ... as NumOfDBs, then in values list we should also have specifically NumOfDBs for the example.

Same goes for key_labels (it should also be a column in the result set).

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@burningalchemist
Comment options

@TomClqncy
Comment options

@burningalchemist
Comment options

Answer selected by burningalchemist
Comment options

You must be logged in to vote
5 replies
@burningalchemist
Comment options

@TomClqncy
Comment options

@burningalchemist
Comment options

@TomClqncy
Comment options

@burningalchemist
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants