예제 #1
0
#include <ctype.h>
#include <limits.h>
#include <sys/stat.h>

static struct timeval	tv;
static char		timebuf[32];	/* for pmCtime result + .xxx */
static int		numpmid;
static pmID		*pmid;
static pmID		pmid_flags;
static pmID		pmid_missed;
static int		sflag;
static int		xflag;		/* for -x (long timestamps) */
static pmLogLabel	label;

static pmLongOptions longopts[] = {
    PMAPI_OPTIONS_HEADER("Options"),
    PMOPT_DEBUG,
    { "all", 0, 'a', 0, "dump everything" },
    { "descs", 0, 'd', 0, "dump metric descriptions" },
    { "insts", 0, 'i', 0, "dump instance domain descriptions" },
    { "", 0, 'L', 0, "more verbose form of archive label dump" },
    { "label", 0, 'l', 0, "dump the archive label" },
    { "metrics", 0, 'm', 0, "dump values of the metrics (default)" },
    PMOPT_NAMESPACE,
    { "reverse", 0, 'r', 0, "process archive in reverse chronological order" },
    PMOPT_START,
    { "sizes", 0, 's', 0, "report size of data records in archive" },
    PMOPT_FINISH,
    { "", 0, 't', 0, "dump the temporal index" },
    { "", 1, 'v', "FILE", "verbose hex dump of a physical file in raw format" },
    { "", 0, 'x', 0, "include date in reported timestamps" },
예제 #2
0
파일: pmconfig.c 프로젝트: Aconex/pcp
{
    __pmNativeConfig(var, prefix, val);
    val = getenv(var);
    direct_report(var, val);
}

static void
pcp_conf_shell_extract(char *var, char *prefix, char *val)
{
    __pmNativeConfig(var, prefix, val);
    val = getenv(var);
    export_report(var, val);
}

static pmLongOptions longopts[] = {
    PMAPI_OPTIONS_HEADER("Reporting options"),
    { "all", 0, 'a', 0, "show all, unmodified format (default)" },
    { "list", 0, 'l', 0, "synonym for showing \"all\" (above)" },
    { "library", 0, 'L', 0, "show library features instead of environment" },
    { "shell", 0, 's', 0, "show all, quoted format for shell expansion" },
    PMOPT_HELP,
    PMAPI_OPTIONS_END
};

static pmOptions opts = {
    .short_options = "alLs?",
    .long_options = longopts,
    .short_usage = "[variable ...]",
};

int
예제 #3
0
파일: template.c 프로젝트: goodwinos/pcp
/*
 * Copyright (c) 1995-2001 Silicon Graphics, Inc.  All Rights Reserved.
 * Copyright (c) 2017 Ken McDonell.  All Rights Reserved.
 */

#include <pcp/pmapi.h>

static pmLongOptions longopts[] = {
    PMAPI_GENERAL_OPTIONS,	/* -[AaDghnOpSsTtVZz?] */
    PMOPT_HOSTSFILE,		/* -H */
    PMOPT_SPECLOCAL,		/* -K */
    PMOPT_LOCALPMDA,		/* -L */
    PMOPT_UNIQNAMES,		/* -N */
    PMOPT_CONTAINER,		/* --container=... */
    PMAPI_OPTIONS_HEADER("template options"),
    { "config", 1, 'c', "CONFIGFILE", "some configuration file" },
    { "flag", 0, 'f', "N", "some flag" },
    { "instance", 1, 'i', "INST", "some instance" },
    { "log", 1, 'l', "LOGFILE", "log file" },
    PMAPI_OPTIONS_END
};

static int overrides(int, pmOptions *);
static pmOptions opts = {
    .flags = PM_OPTFLAG_BOUNDARIES | PM_OPTFLAG_STDOUT_TZ,
    .short_options = PMAPI_OPTIONS "H:K:LN:c:fi:l:",
    .long_options = longopts,
    .short_usage = "[options] ...",
    .override = overrides,
};
예제 #4
0
파일: pmfind.c 프로젝트: felipebetancur/pcp
    sigaction(SIGTERM, &sa, NULL);
    sigaction(SIGXFSZ, &sa, NULL);
    sigaction(SIGXCPU, &sa, NULL);
}
#else
#define setupSignals()	do { } while (0)
#endif

static const char *services[] = {
    PM_SERVER_SERVICE_SPEC,
    PM_SERVER_PROXY_SPEC,
    PM_SERVER_WEBD_SPEC,
};

static pmLongOptions longopts[] = {
    PMAPI_OPTIONS_HEADER("Discovery options"),
    PMOPT_DEBUG,
    { "mechanism", 1, 'm', "NAME", "set the discovery method to use [avahi|probe=<subnet>|all]" },
    { "resolve", 0, 'r', 0, "resolve addresses" },
    { "service", 1, 's', "NAME", "discover services [pmcd|pmproxy|pmwebd|...|all]" },
    { "timeout", 1, 't', "N.N", "timeout in seconds" },
    PMAPI_OPTIONS_HEADER("Reporting options"),
    { "quiet", 0, 'q', 0, "quiet mode, do not write to stdout" },
    PMOPT_HELP,
    PMAPI_OPTIONS_END
};

static pmOptions opts = {
    .short_options = "D:m:rs:t:q?",
    .long_options = longopts,
    .override = override,
예제 #5
0
파일: pmproxy.c 프로젝트: aeppert/pcp
	if ((log = fopen(logfile, "r")) != NULL) {
	    int		c;
	    fprintf(tty, "Log file \"%s\" contains ...\n", logfile);
	    while ((c = fgetc(log)) != EOF)
		fputc(c, tty);
	    fclose(log);
	}
	else
	    fprintf(tty, "Log file \"%s\" has vanished!\n", logfile);
	fclose(tty);
    }
    exit(1);
}

static pmLongOptions longopts[] = {
    PMAPI_OPTIONS_HEADER("General options"),
    PMOPT_DEBUG,
    PMOPT_HELP,
    PMAPI_OPTIONS_HEADER("Service options"),
    { "", 0, 'A', 0, "disable service advertisement" },
    { "foreground", 0, 'f', 0, "run in the foreground" },
    { "username", 1, 'U', "USER", "in daemon mode, run as named user [default pcp]" },
    PMAPI_OPTIONS_HEADER("Configuration options"),
    { "certdb", 1, 'C', "PATH", "path to NSS certificate database" },
    { "passfile", 1, 'P', "PATH", "password file for certificate database access" },
    { "", 1, 'L', "BYTES", "maximum size for PDUs from clients [default 65536]" },
    PMAPI_OPTIONS_HEADER("Connection options"),
    { "interface", 1, 'i', "ADDR", "accept connections on this IP address" },
    { "port", 1, 'p', "N", "accept connections on this port" },
    PMAPI_OPTIONS_HEADER("Diagnostic options"),
    { "log", 1, 'l', "PATH", "redirect diagnostics and trace output" },
예제 #6
0
파일: pmtop.c 프로젝트: tongfw/pcp
val_entry_t *val_tab;

/* index will use high end for globals */
/* parallels index with other MAX_PMID arrays */
pmValue global_val[MAX_PMID][2]; 

#ifndef min
#define min(x,y) (((x)<(y))?(x):(y))
#endif

static void get_indom(void);
static int overrides(int, pmOptions *);

pmLongOptions longopts[] = {
    PMAPI_OPTIONS_HEADER("General Options"),
    PMOPT_HOST,
    PMOPT_SAMPLES,
    PMOPT_INTERVAL,
    PMAPI_OPTIONS_HEADER("Reporting Options"),
    { "", 1, 'm', "N", "report the top N values only" },
    { "", 1, 'p', "SPEC", "report certain values e.g. cpu,sysc,rss" },
    { "wide", 0, 'w', 0, "wide output for command name" },
    PMOPT_TIMEZONE,
    PMOPT_HOSTZONE,
    PMOPT_HELP,
    PMAPI_OPTIONS_END
};

pmOptions opts = {
    .short_options = "D:h:m:p:s:t:wzZ:?",
예제 #7
0
파일: pmdbg.c 프로젝트: aeppert/pcp
    { DBG_TRACE_AUTH,		"AUTH",
    		"Authentication services (if enabled)" },
    { DBG_TRACE_DISCOVERY,	"DISCOVERY",
    		"Service discovery (if enabled)" },
    { DBG_TRACE_ATTR,		"ATTR",
    		"Trace connection attributes" },
    { DBG_TRACE_DESPERATE,		"DESPERATE",
    		"Desperate/verbose level" },
};

static int	nfoo = sizeof(foo) / sizeof(foo[0]);

static char	*fmt = "DBG_TRACE_%-11.11s %7d  %s\n";

static pmLongOptions longopts[] = {
    PMAPI_OPTIONS_HEADER("General options"),
    { "list", 0, 'l', 0, "displays mnemonic and decimal values of PCP debug bitfields" },
    PMOPT_HELP,
    PMAPI_OPTIONS_END
};

static pmOptions opts = {
    .short_options = "l?",
    .long_options = longopts,
    .short_usage = "[options] [code ..]",
};

int
main(int argc, char **argv)
{
    int		i;
예제 #8
0
파일: newhelp.c 프로젝트: Aconex/pcp
    iiap = (__pmInDom_int *)(&((help_idx_t *)a)->pmid);
    iibp = (__pmInDom_int *)(&((help_idx_t *)b)->pmid);

    if (iiap->flag == iibp->flag)
	/* both of the same type, use serial to order */
	return iiap->serial - iibp->serial;
    else if (iiap->flag == 0)
	/* a is the PMID, b is an InDom */
	return -1;
    else
	/* b is the PMID, a is an InDom */
	return 1;
}

static pmLongOptions longopts[] = {
    PMAPI_OPTIONS_HEADER("General options"),
    PMOPT_DEBUG,
    PMOPT_NAMESPACE,
    PMOPT_HELP,
    PMAPI_OPTIONS_HEADER("Output options"),
    { "output", 1, 'o', "FILE", "base name for output files" },
    { "verbose", 0, 'V', 0, "verbose/diagnostic output" },
    { "version", 0, 'v', 0, "deprecated (only version 2 format supported)" },
    PMAPI_OPTIONS_END
};

static pmOptions opts = {
    .short_options = "D:n:o:Vv:?",
    .long_options = longopts,
    .short_usage = "[options] [file ...]",
};
예제 #9
0
파일: pminfo.c 프로젝트: rwongone/pcp
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

#include "pmapi.h"
#include "impl.h"
#include <limits.h>

static void myeventdump(pmValueSet *, int, int);
static int  myoverrides(int, pmOptions *);

static pmLongOptions longopts[] = {
    PMAPI_OPTIONS_HEADER("General options"),
    PMOPT_ARCHIVE,
    PMOPT_DEBUG,
    PMOPT_HOST,
    PMOPT_CONTAINER,
    PMOPT_LOCALPMDA,
    PMOPT_SPECLOCAL,
    PMOPT_NAMESPACE,
    PMOPT_UNIQNAMES,
    PMOPT_ORIGIN,
    PMOPT_TIMEZONE,
    PMOPT_HOSTZONE,
    PMOPT_HELP,
    PMAPI_OPTIONS_HEADER("Protocol options"),
    { "batch",    1, 'b', "N", "fetch N metrics at a time for -f and -v [20]" },
    { "desc",     0, 'd', 0, "get and print metric description" },