- char *help_stats[] =
- {
- "4 Help for STATS\n",
- "Usage: STATS\n",
- "\n",
- "Returns some performance counters, see the rrdcached(1) manpage for\n",
- "a description of the values.\n"
- };
- size_t help_stats_len = sizeof (help_stats) / sizeof (help_stats[0]);
-
- status = buffer_get_field (&buffer, &buffer_size, &command);
- if (status != 0)
- {
- help_text = help_help;
- help_text_len = help_help_len;
- }
- else
- {
- if (strcasecmp (command, "update") == 0)
- {
- help_text = help_update;
- help_text_len = help_update_len;
- }
- else if (strcasecmp (command, "flush") == 0)
- {
- help_text = help_flush;
- help_text_len = help_flush_len;
- }
- else if (strcasecmp (command, "flushall") == 0)
- {
- help_text = help_flushall;
- help_text_len = help_flushall_len;
- }
- else if (strcasecmp (command, "stats") == 0)
- {
- help_text = help_stats;
- help_text_len = help_stats_len;
- }
- else
- {
- help_text = help_help;
- help_text_len = help_help_len;
- }
- }
-
- for (i = 0; i < help_text_len; i++)
- {
- status = swrite (fd, help_text[i], strlen (help_text[i]));
- if (status < 0)
- {
- status = errno;
- RRDD_LOG (LOG_ERR, "handle_request_help: swrite returned an error.");
- return (status);
- }
- }
-
- return (0);
-} /* }}} int handle_request_help */
-
-static int handle_request_stats (int fd, /* {{{ */
- char *buffer __attribute__((unused)),
- size_t buffer_size __attribute__((unused)))
-{
- int status;
- char outbuf[CMD_MAX];
-
- uint64_t copy_queue_length;
- uint64_t copy_updates_received;
- uint64_t copy_flush_received;
- uint64_t copy_updates_written;
- uint64_t copy_data_sets_written;
- uint64_t copy_journal_bytes;
- uint64_t copy_journal_rotate;
-
- uint64_t tree_nodes_number;
- uint64_t tree_depth;