Example #1
0
			if err != nil {
				return nil, err
			}
			rs.Port = v
		case "password":
			rs.Password = v
		case "socket":
			rs.Socket = v
		}
	}
	return rs, nil
}

var (
	mysqlMetrics = []metrics.Descriptor{
		metrics.D("Aborted_clients", c, nil, nil),
		metrics.D("Aborted_connects", c, nil, nil),
		metrics.D("Bytes_received", c, inMB, nil),
		metrics.D("Bytes_sent", c, inMB, nil),
		metrics.D("Com_delete", c, nil, nil),
		metrics.D("Com_delete_multi", c, nil, nil),
		metrics.D("Com_insert", c, nil, nil),
		metrics.D("Com_insert_select", c, nil, nil),
		metrics.D("Com_select", c, nil, nil),
		metrics.D("Com_update", c, nil, nil),
		metrics.D("Com_update_multi", c, nil, nil),
		metrics.D("Connections", c, nil, nil),
		metrics.D("Created_tmp_disk_tables", c, nil, nil),
		metrics.D("Created_tmp_files", c, nil, nil),
		metrics.D("Created_tmp_tables", c, nil, nil),
		metrics.D("Innodb_buffer_pool_pages_data", g, nil, nil),
Example #2
0
func buildNginxSource(params map[string]string) (metrics.Source, error) {
	rs := &nginxSource{"localhost", "80", "/status", map[string]bool{}, nil, defaultClient}
	for k, v := range params {
		switch k {
		case "endpoint":
			rs.Endpoint = v
		case "hostname":
			rs.Hostname = v
		case "port":
			_, err := strconv.ParseUint(v, 10, 32)
			if err != nil {
				return nil, err
			}
			rs.Port = v
		}
	}
	return rs, nil
}

var (
	nginxMetrics = []metrics.Descriptor{
		metrics.D("Active_connections", g, nil, nil),
		metrics.D("accepts", c, nil, nil),
		metrics.D("handled", c, nil, nil),
		metrics.D("requests", c, nil, nil),
		metrics.D("Reading", g, nil, nil),
		metrics.D("Writing", g, nil, nil),
		metrics.D("Waiting", g, nil, nil),
	}
)
Example #3
0
		case "hostname":
			rs.Hostname = v
		case "port":
			_, err := strconv.ParseUint(v, 10, 32)
			if err != nil {
				return nil, err
			}
			rs.Port = v
		}
	}
	return rs, nil
}

var (
	memcachedMetrics = []metrics.Descriptor{
		metrics.D("curr_connections", g, nil, nil),
		metrics.D("total_connections", c, nil, nil),
		metrics.D("cmd_get", c, nil, nil),
		metrics.D("cmd_set", c, nil, nil),
		metrics.D("cmd_flush", c, nil, nil),
		metrics.D("cmd_touch", c, nil, nil),
		metrics.D("get_hits", c, nil, nil),
		metrics.D("get_misses", c, nil, nil),
		metrics.D("delete_hits", c, nil, nil),
		metrics.D("delete_misses", c, nil, nil),
		metrics.D("incr_hits", c, nil, nil),
		metrics.D("incr_misses", c, nil, nil),
		metrics.D("decr_hits", c, nil, nil),
		metrics.D("decr_misses", c, nil, nil),
		metrics.D("cas_hits", c, nil, nil),
		metrics.D("cas_misses", c, nil, nil),
Example #4
0
		return nil, err
	}

	var table [][]string

	for _, line := range lines {
		if line == "" {
			continue
		}
		var row []string
		cells := strings.Split(line, "|")
		for _, cell := range cells {
			row = append(row, strings.TrimSpace(cell))
		}
		table = append(table, row)
	}

	return table, nil
}

var (
	pgMetrics = []metrics.Descriptor{
		metrics.D("rollbacks", c, nil, nil),
		metrics.D("deadlocks", c, nil, nil),
		metrics.D("numbackends", g, nil, nil),
		metrics.D("blk_hit_rate", g, metrics.DisplayPercent, nil),
		metrics.D("seq_scans", c, nil, nil),
		metrics.D("total_size", g, inMB, nil),
	}
)
Example #5
0
			if err != nil {
				return nil, err
			}
			rs.Port = v
		case "password":
			rs.Password = v
		case "socket":
			rs.Socket = v
		}
	}
	return rs, nil
}

var (
	redisMetrics = []metrics.Descriptor{
		metrics.D("connected_clients", g, nil, nil),
		metrics.D("client_longest_output_list", g, nil, nil),
		metrics.D("client_biggest_input_buf", g, nil, nil),
		metrics.D("blocked_clients", g, nil, nil),
		metrics.D("used_memory", g, inMB, nil),
		metrics.D("used_memory_rss", g, inMB, nil),
		metrics.D("used_memory_peak", g, inMB, nil),
		metrics.D("used_memory_lua", g, inMB, nil),
		metrics.D("rdb_changes_since_last_save", g, nil, nil),
		metrics.D("rdb_last_bgsave_time_sec", g, nil, nil),
		metrics.D("rdb_current_bgsave_time_sec", g, nil, nil),
		metrics.D("aof_last_rewrite_time_sec", g, nil, nil),
		metrics.D("aof_current_rewrite_time_sec", g, nil, nil),
		metrics.D("total_connections_received", c, nil, nil),
		metrics.D("total_commands_processed", c, nil, nil),
		metrics.D("instantaneous_ops_per_sec", g, nil, nil),