Is it possible to distinguish between the sql exporter process status and the target database? #384
-
We are currently planning to use sql exporter as a remote exporter. Currently, the "up" state changes to 0 even when the target database engine is down, and the up state changes to 0 even when the exporter is down. Therefore, it is difficult to determine whether the actual database is down using only the up variable. Is there a way to distinguish between database down and exporter down, like "mssql_up"? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
When you say |
Beta Was this translation helpful? Give feedback.
-
I think that prometheus produce it. As explained below, up=0 is recorded both when the database is inaccessible and when the exporter is down. Is there a separate way for me to distinguish between the two situations?
|
Beta Was this translation helpful? Give feedback.
-
Hey @karenlava, I think you might want to name your target in the configuration like here: # The target to monitor and the list of collectors to execute on it.
target:
name: "target_name"
data_source_name: 'dsn://example'
collectors: [collectors_example] Once configured, there should appear another So, If you query the up metric with respective labels (e.g. In addition, you can also scrape Also, in the upcoming release we also expose Please, give it a try. I'll also convert this issue into a discussion. |
Beta Was this translation helpful? Give feedback.
Hey @karenlava,
I think you might want to name your target in the configuration like here:
Once configured, there should appear another
up
metric (it's exposed bysql_exporter
) with the target name label (and any other static labels you might include as well), that corresponds to the database connection state. The name should be put explicitly for a single target mode. In case of usingjobs
(multi-target mode), the labels are populated automatically.So, If you query the up metric with respective labels (e.g.
target
label…