1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #2899: Exporter: Add metrics cpu, memory and uname. (#3224)

* Exporter: metrics support cpu gauge.
* Exporter: metrics support memory and uname..
* Exporter: Ignore error when uname fail.

Co-authored-by: winlin <winlin@vip.126.com>
This commit is contained in:
chundonglinlin 2022-10-31 08:53:58 +08:00 committed by GitHub
parent 9673bfb92c
commit 9f4338bd9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 78 additions and 3 deletions

View file

@ -930,3 +930,21 @@ srs_error_t srs_ioutil_read_all(ISrsReader* in, std::string& content)
return err;
}
#if defined(__linux__) || defined(SRS_OSX)
utsname* srs_get_system_uname_info()
{
static utsname* system_info = NULL;
if (system_info != NULL) {
return system_info;
}
system_info = new utsname();
memset(system_info, 0, sizeof(utsname));
if (uname(system_info) < 0) {
srs_warn("uname failed");
}
return system_info;
}
#endif