Hi

I have issues with sql_exporter. A very simple SQL query does not work.

DB query and output (SQL Server 2022)

SELECT [serviceRequest], [serviceResponseCode]
FROM [ccc].[bbb].[aaa]
WHERE [serviceDisplayName] = 'UploadDoc'


Output: URI and HTTP_CODE

http://example.org/OTCS/llisapi.dll     200
http://example.org/OTCS/llisapi.dll     200
http://example.org/OTCS/llisapi.dll     200
http://example.org/OTCS/llisapi.dll     200


Very simple: I wish to make a rule if not 200 and return the HTTP code and URI

Config

global:
  scrape_timeout_offset: 500ms
  min_interval: 0s
  max_connections: 3
  max_idle_connections: 3

target:
  data_source_name: 'sqlserver://x:xx:1433'
  collectors: [YYY]

collector_files:
  - "YYY.collector.yml"


and

collector_name: YYY

metrics:
  - metric_name: upload_document
    type: gauge
    help: 'Upload Document with REST API'
    key_labels:
      - serviceRequest1
      - serviceResponseCode1
    value_label: UploadDocHTTPcode
    values:
      - serviceRequest
      - serviceResponseCode
    query: |
      SELECT [serviceRequest], [serviceResponseCode]
      FROM [ccc].[bbb].[aaa]
      WHERE [serviceDisplayName] = 'UploadDoc'


Error


I0831 09:31:17.132976    6824 main.go:67] Listening on :9399
I0831 09:31:23.247900 6824 sql.go:88] Database handle successfully opened with driver sqlserver. I0831 09:31:23.280905 6824 promhttp.go:38] Error gathering metrics: [from Gatherer #1] [, collector="YYY", query="upload_document"] column(s) ["serviceRequest1" "serviceResponseCode1"] missing from query result


Thanks you

cheers
Jason

--
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/b99f7608-a27e-427b-a785-80c4b2d1a3ba%407748229.xyz.

Attachment: OpenPGP_0x0D0C34B5DF58FE9D.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to