[master] b922ac9 Add MGT.child_{start|exit|stop|died|dump|panic} counters
Martin Blix Grydeland
martin at varnish-cache.org
Wed May 15 14:46:13 CEST 2013
commit b922ac98ba05a56a89ff29ea3065c437c0a05940
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Mon Jan 7 16:06:39 2013 +0100
Add MGT.child_{start|exit|stop|died|dump|panic} counters
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 2c971fb..1ae4599 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -401,6 +401,7 @@ mgt_launch_child(struct cli *cli)
}
assert(pid > 1);
REPORT(LOG_NOTICE, "child (%jd) Started", (intmax_t)pid);
+ VSC_C_mgt->child_start = ++static_VSC_C_mgt.child_start;
/* Close stuff the child got */
closex(&heritage.std_fd);
@@ -511,15 +512,21 @@ mgt_reap_child(void)
if (WIFEXITED(status) && WEXITSTATUS(status)) {
VSB_printf(vsb, " status=%d", WEXITSTATUS(status));
exit_status |= 0x20;
+ if (WEXITSTATUS(status) == 1)
+ VSC_C_mgt->child_exit = ++static_VSC_C_mgt.child_exit;
+ else
+ VSC_C_mgt->child_stop = ++static_VSC_C_mgt.child_stop;
}
if (WIFSIGNALED(status)) {
VSB_printf(vsb, " signal=%d", WTERMSIG(status));
exit_status |= 0x40;
+ VSC_C_mgt->child_died = ++static_VSC_C_mgt.child_died;
}
#ifdef WCOREDUMP
if (WCOREDUMP(status)) {
VSB_printf(vsb, " (core dumped)");
exit_status |= 0x80;
+ VSC_C_mgt->child_dump = ++static_VSC_C_mgt.child_dump;
}
#endif
AZ(VSB_finish(vsb));
@@ -530,6 +537,7 @@ mgt_reap_child(void)
if (heritage.panic_str[0] != '\0') {
mgt_panic_record(r);
mgt_SHM_Destroy(1);
+ VSC_C_mgt->child_panic = ++static_VSC_C_mgt.child_panic;
} else {
mgt_SHM_Destroy(0);
}
diff --git a/include/tbl/vsc_fields.h b/include/tbl/vsc_fields.h
index e763225..017398f 100644
--- a/include/tbl/vsc_fields.h
+++ b/include/tbl/vsc_fields.h
@@ -65,6 +65,31 @@ VSC_F(uptime, uint64_t, 0, 'c',
"Management process uptime",
"Uptime in seconds of the management process"
)
+VSC_F(child_start, uint64_t, 0, 'c',
+ "Child process started",
+ "Number of times the child process has been started"
+)
+VSC_F(child_exit, uint64_t, 0, 'c',
+ "Child process normal exit",
+ "Number of times the child process has been cleanly stopped"
+)
+VSC_F(child_stop, uint64_t, 0, 'c',
+ "Child process unexpected exit",
+ "Number of times the child process has exited with an unexpected"
+ " return code"
+)
+VSC_F(child_died, uint64_t, 0, 'c',
+ "Child process died (signal)",
+ "Number of times the child process has died due to signals"
+)
+VSC_F(child_dump, uint64_t, 0, 'c',
+ "Child process core dumped",
+ "Number of times the child process has produced core dumps"
+)
+VSC_F(child_panic, uint64_t, 0, 'c',
+ "Child process panic",
+ "Number of times the management process has caught a child panic"
+)
#endif
More information about the varnish-commit
mailing list