mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Exporter: Listen at port 9972 for Prometheus exporter. (#3195)
This commit is contained in:
parent
4ad4dd0975
commit
9525511032
7 changed files with 105 additions and 4 deletions
|
@ -2305,7 +2305,16 @@ srs_error_t SrsConfig::check_normal_config()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (true) {
|
||||
SrsConfDirective* conf = root->get("exporter");
|
||||
for (int i = 0; conf && i < (int)conf->directives.size(); i++) {
|
||||
string n = conf->at(i)->name;
|
||||
if (n != "enabled" && n != "listen" && n != "label" && n != "tag") {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal exporter.%s", n.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// check listen for rtmp.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -3583,6 +3592,25 @@ bool SrsConfig::get_exporter_enabled()
|
|||
return SRS_CONF_PERFER_FALSE(conf->arg0());
|
||||
}
|
||||
|
||||
string SrsConfig::get_exporter_listen()
|
||||
{
|
||||
SRS_OVERWRITE_BY_ENV_STRING("SRS_EXPORTER_LISTEN");
|
||||
|
||||
static string DEFAULT = "9972";
|
||||
|
||||
SrsConfDirective* conf = root->get("exporter");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
conf = conf->get("listen");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
return conf->arg0();
|
||||
}
|
||||
|
||||
string SrsConfig::get_exporter_label()
|
||||
{
|
||||
SRS_OVERWRITE_BY_ENV_STRING("SRS_EXPORTER_LABEL");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue