aboutsummaryrefslogtreecommitdiff
path: root/src/readconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/readconfig.c')
-rw-r--r--src/readconfig.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/readconfig.c b/src/readconfig.c
index 1c22cb1..a60f19d 100644
--- a/src/readconfig.c
+++ b/src/readconfig.c
@@ -95,35 +95,41 @@ cb_monitor (enum grecs_callback_command cmd,
|| value->v.string == NULL)
{
grecs_error (locus, 0, _("tag must be a string"));
return 1;
}
mon = xzalloc (sizeof (*mon));
+ *mon = default_monitor;
mon->id = strdup (value->v.string);
- mon->scale = 1.0;
- mon->ystep = 100.;
+ mon->name = NULL;
+ mon->dir = NULL;
*pdata = mon;
break;
case grecs_callback_section_end:
mon = *pdata;
- if (mon->max_rate == 0)
+ if (strcmp (mon->id, "default") == 0)
+ default_monitor = *mon;
+ else
{
- grecs_error (locus, 0, _("maximum speed not set"));
- free (mon);
- return 0;
+ if (mon->max_rate == 0 && mon->max_adjust == 0)
+ {
+ grecs_error (locus, 0, _("maximum speed not set"));
+ free (mon);
+ return 0;
+ }
+ if (!mon->name)
+ mon->name = strdup (mon->id);
+ if (!mon->dir)
+ mon->dir = strdup (mon->id);
+ if (mon_count == 0)
+ obstack_init (&mon_stack);
+
+ obstack_grow (&mon_stack, mon, sizeof *mon);
+ mon_count++;
}
- if (!mon->name)
- mon->name = strdup (mon->id);
- if (!mon->dir)
- mon->dir = strdup (mon->id);
- if (mon_count == 0)
- obstack_init (&mon_stack);
-
- obstack_grow (&mon_stack, mon, sizeof *mon);
- mon_count++;
free (mon);
*pdata = NULL;
break;
case grecs_callback_set_value:
grecs_error (locus, 0, _("invalid use of block statement"));
@@ -171,20 +177,24 @@ static struct grecs_keyword monitor_kw[] = {
{ "host", NULL, N_("Host name or IP address"),
grecs_type_string, NULL, offsetof(struct monitor, name) },
{ "directory", N_("name"), N_("Subdirectory name"),
grecs_type_string, NULL, offsetof(struct monitor, dir) },
{ "max-speed", NULL, N_("Maximum speed"),
grecs_type_ulong, NULL, offsetof(struct monitor, max_rate) },
+ { "max-adjust", NULL, N_("Adjust maximum by this value when needed"),
+ grecs_type_ulong, NULL, offsetof(struct monitor, max_adjust) },
{ "rate-units", NULL, N_("Name of rate units"),
grecs_type_string, NULL, offsetof(struct monitor, rate_unit) },
{ "scale", N_("arg: double"), N_("Scaling factor"),
grecs_type_string, NULL, offsetof(struct monitor, scale),
cb_double },
{ "y-step", N_("arg: double"), N_("Step for Y axis"),
grecs_type_string, NULL, offsetof(struct monitor, ystep),
cb_double},
+ { "y-step-absolute", NULL, N_("y-step is an absolute value"),
+ grecs_type_bool, NULL, offsetof(struct monitor, ystep_absolute) },
{ "swap", NULL, N_("Swap in and out rates"),
grecs_type_bool, NULL, offsetof(struct monitor, swap) },
{ NULL }
};
@@ -485,14 +495,12 @@ static struct grecs_keyword tagr_kw[] = {
grecs_type_uint, &lock_retry_timeout_option },
{ "idle-timeout", N_("seconds"),
N_("Idle timeout for stream connections"),
grecs_type_uint, &stream_idle_timeout },
- { "rate-units", NULL, N_("Name of rate units"),
- grecs_type_string, &rate_unit },
{ "number-suffixes", N_("suffixes"),
N_("Not implemented") /* FIXME */,
grecs_type_string, NULL, 0, cb_number_suffixes },
{ "transparent", NULL, N_("Transparent graphs"),
grecs_type_bool, &transparent_option },

Return to:

Send suggestions and report system problems to the System administrator.