Пример #1
0
static void
save_proc_config(FILE *f)
	{
	fprintf(f, "%s enable %d %d\n", PROC_CONFIG_KEYWORD,
				proc.enabled, proc.extra_info);
	fprintf(f, "%s launch %s\n", PROC_CONFIG_KEYWORD, proc_launch.command);
	fprintf(f, "%s tooltip_comment %s\n", PROC_CONFIG_KEYWORD,
				proc_launch.tooltip_comment);
	fprintf(f, "%s sensor_mode %d\n", PROC_CONFIG_KEYWORD,
				sensor_separate_mode);
	fprintf(f, "%s text_format %s\n", PROC_CONFIG_KEYWORD, text_format);
	gkrellm_save_chartconfig(f, proc.chart_config,
				PROC_CONFIG_KEYWORD, NULL);
	if (load_alert)
		gkrellm_save_alertconfig(f, load_alert, PROC_CONFIG_KEYWORD, "load");
	if (users_alert)
		gkrellm_save_alertconfig(f, users_alert, PROC_CONFIG_KEYWORD, "users");
	if (processes_alert)
		gkrellm_save_alertconfig(f, processes_alert,
					PROC_CONFIG_KEYWORD, "processes");
	}
Пример #2
0
static void
save_plugin_config(FILE *f)
{
  Reader *reader;
  gchar *label, *unit;

  for (reader = readers; reader ; reader = reader->next) {
      label = g_strdelimit(g_strdup(reader->label), STR_DELIMITERS, '_');
      unit = g_strdelimit(g_strdup(reader->unit), STR_DELIMITERS, '_');
      if (label[0] == '\0') label = strdup("_");
      if (unit[0] == '\0') unit = strdup("_");
      fprintf(f, "%s %s snmp://%s@%s:%d/%s %s %d %d %d %d\n",
	      PLUGIN_CONFIG_KEYWORD,
	      label, reader->community,
	      reader->peer, reader->port,
	      reader->oid_str, unit,
	      reader->delay, reader->delta,
	      reader->divisor, reader->scale);
      gkrellm_save_chartconfig(f, reader->chart_config, PLUGIN_CONFIG_KEYWORD, label);
      g_free(label);
      g_free(unit);
  }
}