Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add system load avg info to stats #216

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/master_utils.c
Expand Up @@ -828,6 +828,16 @@ struct uwsgi_stats *uwsgi_master_generate_stats() {

if (uwsgi_stats_keylong_comma(us, "load", (unsigned long long) uwsgi.shared->load))
goto end;

double load[3];
char loadavg[128] = "N/A";
if (getloadavg(load, 3) != -1) {
if (sprintf(loadavg, "%.2f, %.2f, %.2f", load[0], load[1], load[2]) < 0)
uwsgi_error("getloadavg()\n");
}
if (uwsgi_stats_keyval_comma(us, "system_loadavg", loadavg))
goto end;

if (uwsgi_stats_keylong_comma(us, "pid", (unsigned long long) getpid()))
goto end;
if (uwsgi_stats_keylong_comma(us, "uid", (unsigned long long) getuid()))
Expand Down