From nscott@aconex.com Tue Dec 5 15:46:56 2006 Received: with ECARTIS (v1.0.0; list pcp); Tue, 05 Dec 2006 15:47:04 -0800 (PST) Received: from page.mel.office.aconex.com (eth2333.vic.adsl.internode.on.net [150.101.159.28]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id kB5NkqaG023288 for ; Tue, 5 Dec 2006 15:46:54 -0800 Received: from localhost (page.mel.aconex.com [127.0.0.1]) by page.mel.office.aconex.com (Postfix) with ESMTP id 5C513534208; Wed, 6 Dec 2006 10:45:51 +1100 (EST) Received: from page.mel.office.aconex.com ([127.0.0.1]) by localhost (mail.aconex.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 02709-01-37; Wed, 6 Dec 2006 10:45:41 +1100 (EST) Received: from edge (unknown [192.168.0.246]) by page.mel.office.aconex.com (Postfix) with ESMTP id A150A5341D0; Wed, 6 Dec 2006 10:45:41 +1100 (EST) Subject: Re: [PATCH] pmie support for stomp messages From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: Mark Goodwin , pcp@oss.sgi.com In-Reply-To: <1164848816.4992.65.camel@edge> References: <1164848816.4992.65.camel@edge> Content-Type: multipart/mixed; boundary="=-BxW09RCYLjeSfBfPFr1b" Organization: Aconex Date: Wed, 06 Dec 2006 10:45:30 +1100 Message-Id: <1165362330.1281.54.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-archive-position: 601 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 30276 Lines: 926 --=-BxW09RCYLjeSfBfPFr1b Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, 2006-11-30 at 12:06 +1100, Nathan Scott wrote: > Hi all, > > The following patch adds pmie support for the "Streaming Text Orientated > Messaging Protocol" - see (http://stomp.codehaus.org/) - which allows us > to generate performance events from pmie, pass them to a JMS server that > talks STOMP, and then share those events with (many) interested parties. > ... I noticed there were a couple of missing chunks from this earlier patch, due to a quilt botch at my end - here's an updated version. cheers. -- Nathan --=-BxW09RCYLjeSfBfPFr1b Content-Disposition: attachment; filename=stomp-pmie-final Content-Type: text/x-patch; name=stomp-pmie-final; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: devel-pcp-2.5.99/src/pmie/src/act.sk =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/act.sk 2006-12-05 09:08:36.144981250 +1100 +++ devel-pcp-2.5.99/src/pmie/src/act.sk 2006-12-05 09:07:20.788271750 +1100 @@ -1,5 +1,6 @@ /* * Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved. + * Portions copyright (c) 2006 Aconex. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -279,6 +280,30 @@ actPrint(Expr *x) /* + * operator: actStomp + */ +void +actStomp(Expr *x) +{ + Expr *arg1 = x->arg1; + Expr *arg2 = x->arg2; + + if ((arg2 == NULL) || + (x->smpls[0].stamp == 0) || + (now >= *(RealTime *)arg2->ring + x->smpls[0].stamp)) + { + EVALARG(arg1) + x->smpls[0].stamp = now; + if (stompSend((const char *)arg1->ring) != 0) + *(Truth *)x->ring = FALSE; + else + *(Truth *)x->ring = TRUE; + perf->actions++; + } +} + + +/* * fake actions for archive mode */ void Index: devel-pcp-2.5.99/src/pmie/src/dstruct.h =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/dstruct.h 2006-12-05 09:08:36.148981500 +1100 +++ devel-pcp-2.5.99/src/pmie/src/dstruct.h 2006-12-05 09:07:20.796272250 +1100 @@ -298,6 +298,7 @@ typedef int Op; #define ACT_SYSLOG 74 #define ACT_PRINT 75 #define ACT_ARG 76 +#define ACT_STOMP 77 /* no operation (extension) */ #define NOP 80 /* dereferenced variable */ Index: devel-pcp-2.5.99/src/pmie/src/grammar.y =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/grammar.y 2006-12-05 09:08:36.152981750 +1100 +++ devel-pcp-2.5.99/src/pmie/src/grammar.y 2006-12-05 09:07:20.840275000 +1100 @@ -3,6 +3,7 @@ *********************************************************************** * * Copyright (c) 1995 Silicon Graphics, Inc. All Rights Reserved. + * Portions copyright (c) 2006 Aconex. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -30,6 +31,7 @@ #include "lexicon.h" #include "pragmatics.h" #include "syslog.h" +#include "stomp.h" #include "show.h" /* strings for error reporting */ @@ -69,6 +71,7 @@ gramerr(char *phrase, char *pos, char *o %token ALARM %token SYSLOG %token PRINT +%token STOMP %token SOME_QUANT %token ALL_QUANT %token PCNT_QUANT @@ -137,7 +140,7 @@ gramerr(char *phrase, char *pos, char *o %left '*' '/' %left UMINUS RATE %left SUM_AGGR AVG_AGGR MAX_AGGR MIN_AGGR COUNT_AGGR -%left SHELL ALARM SYSLOG PRINT +%left SHELL ALARM SYSLOG PRINT STOMP %left ':' '#' '@' %left UNIT_SLASH INTERVAL @@ -222,6 +225,16 @@ act : '(' act ')' { $$ = actExpr(ACT_PRINT, $2, NULL); } | PRINT num actarg /* holdoff format */ { $$ = actExpr(ACT_PRINT, $3, $2); } + | STOMP actarg + { + stomping = 1; + $$ = actExpr(ACT_STOMP, $2, NULL); + } + | STOMP num actarg /* holdoff format */ + { + stomping = 1; + $$ = actExpr(ACT_STOMP, $3, $2); + } /* error reporting */ | error SEQ @@ -250,6 +263,9 @@ act : '(' act ')' | PRINT error { gramerr(tstr_str, follow, opStrings(ACT_PRINT)); $$ = NULL; } + | STOMP error + { gramerr(tstr_str, follow, opStrings(ACT_STOMP)); + $$ = NULL; } ; actarg : arglist Index: devel-pcp-2.5.99/src/pmie/src/lexicon.c =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/lexicon.c 2006-12-05 09:08:36.156982000 +1100 +++ devel-pcp-2.5.99/src/pmie/src/lexicon.c 2006-12-05 09:07:20.940281250 +1100 @@ -90,6 +90,7 @@ static LexEntry1 optab[] = { {"alarm", ALARM}, {"syslog", SYSLOG}, {"print", PRINT}, + {"stomp", STOMP}, {"rising", RISE}, {"falling", FALL}, {"match_inst", MATCH}, Index: devel-pcp-2.5.99/src/pmie/src/show.c =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/show.c 2006-12-05 09:08:36.196984500 +1100 +++ devel-pcp-2.5.99/src/pmie/src/show.c 2006-12-05 09:07:20.844275250 +1100 @@ -104,6 +104,7 @@ static struct { { ACT_ALARM, "alarm" }, { ACT_SYSLOG, "syslog" }, { ACT_PRINT, "print" }, + { ACT_STOMP, "stomp" }, { ACT_ARG, "" }, { NOP, "" }, { OP_VAR, "" }, Index: devel-pcp-2.5.99/src/pmie/src/GNUmakefile =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/GNUmakefile 2006-12-05 09:08:36.200984750 +1100 +++ devel-pcp-2.5.99/src/pmie/src/GNUmakefile 2006-12-05 09:07:20.940281250 +1100 @@ -35,10 +35,10 @@ include $(TOPDIR)/src/include/builddefs TARGET = pmie$(EXECSUFFIX) CFILES = pmie.c symbol.c dstruct.c lexicon.c syntax.c pragmatics.c eval.c \ - show.c match_inst.c syslog.c + show.c match_inst.c syslog.c stomp.c HFILES = fun.h dstruct.h eval.h lexicon.h pmiestats.h pragmatics.h \ - show.h symbol.h syntax.h syslog.h + show.h symbol.h syntax.h syslog.h stomp.h SKELETAL = hdr.sk fetch.sk misc.sk aggregate.sk unary.sk binary.sk \ merge.sk act.sk Index: devel-pcp-2.5.99/src/pmie/src/fun.h =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/fun.h 2006-12-05 09:08:36.200984750 +1100 +++ devel-pcp-2.5.99/src/pmie/src/fun.h 2006-12-05 09:07:20.848275500 +1100 @@ -128,6 +128,7 @@ void actShell(Expr *); void actAlarm(Expr *); void actSyslog(Expr *); void actPrint(Expr *); +void actStomp(Expr *); void actArg(Expr *); void actFake(Expr *); Index: devel-pcp-2.5.99/src/pmie/src/stomp.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ devel-pcp-2.5.99/src/pmie/src/stomp.h 2006-12-05 09:07:20.944281500 +1100 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2006 Aconex. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * Streaming Text Orientated Messaging Protocol implementation + * http://stomp.codehaus.org/ + */ +extern int stomping; /* true if stomp actions present */ +extern char *stompfile; /* stomp config file */ +extern int stompInit(void); /* connect to stomp server */ +extern int stompSend(const char *); /* send to JMS server, via stomp */ Index: devel-pcp-2.5.99/src/pmie/src/pmie.c =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/pmie.c 2006-12-05 09:08:36.244987500 +1100 +++ devel-pcp-2.5.99/src/pmie/src/pmie.c 2006-12-05 09:07:20.892278250 +1100 @@ -44,6 +44,7 @@ #include #include #include "dstruct.h" +#include "stomp.h" #include "syntax.h" #include "pragmatics.h" #include "eval.h" @@ -73,8 +74,20 @@ static char *intro = "Performance Co-Pi static char logfile[MAXPATHLEN+1]; static char perffile[PMIE_PATHSIZE]; /* /var/tmp/ file name */ +static char menu[] = +"pmie debugger commands\n\n" +" f [file-name] - load expressions from given file or stdin\n" +" l [expr-name] - list named expression or all expressions\n" +" r [interval] - run for given or default interval\n" +" S time-spec - set start time for run\n" +" T time-spec - set default interval for run command\n" +" v [expr-name] - print subexpression used for %h, %i and\n" +" %v bindings\n" +" h or ? - print this menu of commands\n" +" q - quit\n\n"; + static char usage[] = - "Usage: pmie [options] [filename ...]\n\n" + "Usage: %s [options] [filename ...]\n\n" "Options:\n" " -A align align sample times on natural boundaries\n" " -a archive metrics source is a PCP log archive\n" @@ -85,6 +98,7 @@ static char usage[] = " -e force timestamps to be reported when used with -V, -v or -W\n" " -f run in foreground\n" " -h host metrics source is PMCD on host\n" + " -j stompfile stomp protocol (JMS) file [default %s/config/pmie/stomp]\n" " -l logfile send status and error messages to logfile\n" " -n pmnsfile use an alternative PMNS\n" " -O offset initial offset into the time window\n" @@ -98,17 +112,16 @@ static char usage[] = " -Z timezone set reporting timezone\n" " -z set reporting timezone to local time of metrics source\n"; -static char menu[] = -"pmie debugger commands\n\n" -" f [file-name] - load expressions from given file or stdin\n" -" l [expr-name] - list named expression or all expressions\n" -" r [interval] - run for given or default interval\n" -" S time-spec - set start time for run\n" -" T time-spec - set default interval for run command\n" -" v [expr-name] - print subexpression used for %h, %i and\n" -" %v bindings\n" -" h or ? - print this menu of commands\n" -" q - quit\n\n"; +/*********************************************************************** + * usage message + ***********************************************************************/ + +static void +usageMessage(void) +{ + fprintf(stderr, usage, pmProgname, pmGetConfig("PCP_VAR_DIR")); + exit(1); +} /*********************************************************************** @@ -445,7 +458,7 @@ getargs(int argc, char *argv[]) memset(&tv2, 0, sizeof(tv2)); dstructInit(); - while ((c=getopt(argc, argv, "a:A:bc:CdD:efh:l:n:O:S:t:T:vVWXxzZ:?")) != EOF) { + while ((c=getopt(argc, argv, "a:A:bc:CdD:efh:j:l:n:O:S:t:T:vVWXxzZ:?")) != EOF) { switch (c) { case 'a': /* archives */ @@ -536,6 +549,10 @@ getargs(int argc, char *argv[]) dfltHost = optarg; break; + case 'j': /* stomp protocol (JMS) config */ + stompfile = optarg; + break; + case 'l': /* alternate log file */ if (commandlog != NULL) { fprintf(stderr, "%s: at most one -l option is allowed\n", @@ -549,7 +566,7 @@ getargs(int argc, char *argv[]) case 'n': /* alternate namespace file */ pmnsfile = optarg; - break; + break; case 'O': /* position within time window */ offsetFlag = optarg; @@ -626,10 +643,8 @@ getargs(int argc, char *argv[]) pmProgname); err++; } - if (err) { - fprintf(stderr, usage); - exit(1); - } + if (err) + usageMessage(); if (foreground) isdaemon = 0; @@ -760,6 +775,9 @@ getargs(int argc, char *argv[]) setsid(); /* not process group leader, lose controlling tty */ } + if (stomping) + stompInit(); /* connect to our message server */ + if (agent) agentInit(); /* initialize secret agent stuff */ Index: devel-pcp-2.5.99/src/pmie/src/stomp.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ devel-pcp-2.5.99/src/pmie/src/stomp.c 2006-12-05 09:07:20.988284250 +1100 @@ -0,0 +1,358 @@ +/* + * Copyright (c) 2006 Aconex. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +static int stomp_connect(const char *hostname, int port); +static void stomp_disconnect(void); + +int stomping; +char *stompfile; +extern int verbose; + +static int fd = -1; +static int port = -1; +static int timeout = 2; /* default 2 sec to timeout JMS server ACKs */ +static char *hostname; +static char *username; +static char *passcode; +static char *topic; /* JMS "topic" for pmie messages */ +static char pmietopic[] = "PMIE"; /* default JMS "topic" for pmie */ + +static char buffer[4096]; + +static int stomp_connect(const char *hostname, int port) +{ + int sts, nodelay = 1; + struct linger nolinger = { 1, 0 }; + struct sockaddr_in myaddr; + struct hostent *servinfo; + + if ((servinfo = gethostbyname(hostname)) == NULL) + return -1; + + /* socket setup */ + if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) + return -2; + if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, /* avoid 200 ms delay */ + (char *)&nodelay, (socklen_t)sizeof(nodelay)) < 0) { + stomp_disconnect(); + return -3; + } + if (setsockopt(fd, SOL_SOCKET, SO_LINGER, /* don't linger on close */ + (char *)&nolinger, (socklen_t)sizeof(nolinger)) < 0) { + stomp_disconnect(); + return -4; + } + + memset(&myaddr, 0, sizeof(myaddr)); + myaddr.sin_family = AF_INET; + memcpy(&myaddr.sin_addr, servinfo->h_addr, servinfo->h_length); + myaddr.sin_port = htons(port); + if ((sts = connect(fd, (struct sockaddr *)&myaddr, sizeof(myaddr))) < 0) { + stomp_disconnect(); + return -5; + } + + return fd; +} + +static int stomp_read_ack(void) +{ + struct timeval tv; + fd_set fds, readyfds; + int nready, sts; + + FD_ZERO(&fds); + FD_SET(fd, &fds); + tv.tv_sec = timeout; + tv.tv_usec = 0; + memcpy(&readyfds, &fds, sizeof(readyfds)); + nready = select(fd + 1, &readyfds, NULL, NULL, &tv); + if (nready <= 0) { + if (nready == 0) + __pmNotifyErr(LOG_ERR, "Timed out waiting for server %s:%d - %s", + hostname, port, strerror(errno)); + else + __pmNotifyErr(LOG_ERR, "Error waiting for server %s:%d - %s", + hostname, port, strerror(errno)); + stomp_disconnect(); + return -1; + } + + do { + sts = read(fd, buffer, sizeof(buffer)); + if (sts < 0) { + __pmNotifyErr(LOG_ERR, "Error reading from server %s:%d - %s", + hostname, port, strerror(errno)); + stomp_disconnect(); + return -1; + } + /* check for anything else we need to read to clear this ACK */ + memset(&tv, 0, sizeof(tv)); + memcpy(&readyfds, &fds, sizeof(readyfds)); + } while (select(fd + 1, &readyfds, NULL, NULL, &tv) > 0); + + return 0; +} + +static int stomp_write(const char *buffer, int length) +{ + int sts; + + do { + sts = write(fd, buffer, length); + if (sts < 0) { + __pmNotifyErr(LOG_ERR, "Write error to JMS server %s:%d - %s", + hostname, port, strerror(errno)); + stomp_disconnect(); + return -1; + } + else if (sts == 0) + break; + length -= sts; + } while (length > 0); + + return 0; +} + +static int stomp_authenticate(void) +{ + int len; + + if (fd < 0) + return -1; + len = snprintf(buffer, sizeof(buffer), + "CONNECT\nlogin:%s\npasscode:%s\n\n", username, passcode); + if (stomp_write(buffer, len) < 0) + return -1; + if (stomp_write("\0\n", 2) < 0) + return -1; + return 0; +} + +static int stomp_destination(void) +{ + int len; + + if (fd < 0) + return -1; + len = snprintf(buffer, sizeof(buffer), + "SUB\ndestination:/topic/%s\n\n", topic); + if (stomp_write(buffer, len) < 0) + return -1; + if (stomp_write("\0\n", 2) < 0) + return -1; + return 0; +} + +static int stomp_hello(void) +{ + int len; + + if (fd < 0) + return -1; + len = snprintf(buffer, sizeof(buffer), "SEND\ndestination:/topic/%s\n\n" + "INFO: PMIE: Established initial connection", topic); + if (stomp_write(buffer, len) < 0) + return -1; + if (stomp_write("\0\n", 2) < 0) + return -1; + return 0; +} + +static void stomp_disconnect(void) +{ + if (fd >= 0) + close(fd); + fd = -1; +} + +static char *isspace_terminate(char *string) +{ + int i = 0; + + while (!isspace(string[i++])) /* do nothing */ ; + if (i) + string[i-1] = '\0'; + return string; +} + +/* + * Parse our stomp configuration file, simple format: + * host= # JMS server machine + * port= # server port number + * username= | user= + * passcode= | password= + * timeout= # optional + * topic= # optional + */ +static void stomp_parse(void) +{ + char config[MAXPATHLEN+1]; + FILE *f; + + if (stompfile) + strncat(config, stompfile, sizeof(config)); + else + snprintf(config, sizeof(config), "%s/config/pmie/stomp", + pmGetConfig("PCP_VAR_DIR")); + if ((f = fopen(config, "r")) == NULL) { + __pmNotifyErr(LOG_ERR, "Cannot open STOMP configuration file %s: %s", + config, strerror(errno)); + exit(1); + } + while (fgets(buffer, sizeof(buffer), f)) { + if (strncmp(buffer, "port=", 5) == 0) + port = atoi(isspace_terminate(&buffer[5])); + else if (strncmp(buffer, "host=", 5) == 0) + hostname = strdup(isspace_terminate(&buffer[5])); + else if (strncmp(buffer, "hostname=", 9) == 0) + hostname = strdup(isspace_terminate(&buffer[9])); + else if (strncmp(buffer, "user=", 5) == 0) + username = strdup(isspace_terminate(&buffer[5])); + else if (strncmp(buffer, "username=", 9) == 0) + username = strdup(isspace_terminate(&buffer[9])); + else if (strncmp(buffer, "password=", 9) == 0) + passcode = strdup(isspace_terminate(&buffer[9])); + else if (strncmp(buffer, "passcode=", 9) == 0) + passcode = strdup(isspace_terminate(&buffer[9])); + else if (strncmp(buffer, "timeout=", 8) == 0) /* optional */ + timeout = atoi(isspace_terminate(&buffer[8])); + else if (strncmp(buffer, "topic=", 6) == 0) /* optional */ + topic = strdup(isspace_terminate(&buffer[6])); + } + fclose(f); + + if (!hostname) + __pmNotifyErr(LOG_ERR, "No host in STOMP config file %s", config); + if (port == -1) + __pmNotifyErr(LOG_ERR, "No port in STOMP config file %s", config); + if (!username) + __pmNotifyErr(LOG_ERR, "No username in STOMP config file %s", config); + if (!passcode) + __pmNotifyErr(LOG_ERR, "No passcode in STOMP config file %s", config); + if (port == -1 || !hostname || !username || !passcode) + exit(1); +} + +/* + * Setup the connection to the stomp server, and handle initial protocol + * negotiations (sending user/passcode over to the server in particular). + * Stomp protocol is clear text... (we don't need no stinkin' security!). + * Note: this routine is used for both the initial connection and also for + * any subsequent reconnect attempts. + */ +void stompInit(void) +{ + time_t thistime; + static time_t lasttime; + static int firsttime = 1; + + if (firsttime) { /* initial connection attempt */ + stomp_parse(); + if (!topic) + topic = pmietopic; + atexit(stomp_disconnect); + } else { /* reconnect attempt, if not too soon */ + time(&thistime); + if (thistime < lasttime + 60) + goto disconnect; + } + + if (verbose) + __pmNotifyErr(LOG_INFO, "Connecting to %s, port %d", hostname, port); + if (stomp_connect(hostname, port) < 0) { + __pmNotifyErr(LOG_ERR, "Could not connect to the message server"); + goto disconnect; + } + + if (verbose) + __pmNotifyErr(LOG_INFO, "Connected; sending stomp connect message"); + if (stomp_authenticate() < 0) { + __pmNotifyErr(LOG_ERR, "Could not sent STOMP CONNECT frame to server"); + goto disconnect; + } + + if (verbose) + __pmNotifyErr(LOG_INFO, "Sent; waiting for server ACK"); + if (stomp_read_ack() < 0) { + __pmNotifyErr(LOG_ERR, "Could not read STOMP ACK frame."); + goto disconnect; + } + + if (verbose) + __pmNotifyErr(LOG_INFO, "ACK; sending initial PMIE topic and hello"); + if (stomp_destination() < 0) { + __pmNotifyErr(LOG_ERR, "Could not read TOPIC frame."); + goto disconnect; + } + if (stomp_hello() < 0) { + __pmNotifyErr(LOG_ERR, "Could not send HELLO frame."); + goto disconnect; + } + + if (verbose) + __pmNotifyErr(LOG_INFO, "Sent; waiting for server ACK"); + if (stomp_read_ack() < 0) { + __pmNotifyErr(LOG_ERR, "Could not read STOMP ACK frame"); + goto disconnect; + } + + if (!firsttime) + __pmNotifyErr(LOG_INFO, "Reconnected to STOMP protocol server"); + else if (verbose) + __pmNotifyErr(LOG_INFO, "Initial STOMP protocol setup complete"); + firsttime = 0; + goto finished; + +disconnect: + stomp_disconnect(); + if (firsttime) + exit(1); + /* otherwise, we attempt reconnect on next message firing (>1min) */ +finished: + lasttime = thistime; +} + +/* + * Send a message to the stomp server. + */ +int stompSend(const char *msg) +{ + int len; + + if (fd < 0) stompInit(); /* reconnect */ + if (fd < -1) return -1; + + len = snprintf(buffer, sizeof(buffer), + "SEND\ndestination:/topic/%s\n\n", topic); + if (stomp_write(buffer, len) < 0) + return -1; + if (stomp_write(msg, strlen(msg)) < 0) + return -1; + if (stomp_write("\0\n", 2) < 0) + return -1; + return 0; +} Index: devel-pcp-2.5.99/src/pmie/src/hdr.sk =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/hdr.sk 2006-12-05 09:08:36.248987750 +1100 +++ devel-pcp-2.5.99/src/pmie/src/hdr.sk 2006-12-05 09:07:20.896278500 +1100 @@ -41,5 +41,6 @@ #include "pragmatics.h" #include "fun.h" #include "show.h" +#include "stomp.h" Index: devel-pcp-2.5.99/man/man1/pmie.1 =================================================================== --- devel-pcp-2.5.99.orig/man/man1/pmie.1 2006-12-05 09:08:36.260988500 +1100 +++ devel-pcp-2.5.99/man/man1/pmie.1 2006-12-05 09:07:12.295741000 +1100 @@ -2,6 +2,7 @@ '\"macro stdmacro .\" .\" Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. +.\" Portions copyright (c) 2006 Aconex. All Rights Reserved. .\" .\" This program is free software; you can redistribute it and/or modify it .\" under the terms of the GNU General Public License as published by the @@ -42,6 +43,7 @@ [\f3\-c\f1 \f2filename\f1] [\f3\-h\f1 \f2host\f1] [\f3\-l\f1 \f2logfile\f1] +[\f3\-j\f1 \f2stompfile\f1] [\f3\-n\f1 \f2pmnsfile\f1] [\f3\-O\f1 \f2offset\f1] [\f3\-S\f1 \f2starttime\f1] @@ -166,6 +168,15 @@ being evaluated. Standard error is sent to .IR logfile . .TP +.B \-j +An alternative STOMP protocol configuration is loaded from +.IR stompfile . +If this option is not used, and the +.I stomp +action is used in any rule, the default location +.I $PCP_VAR_DIR/pmie/config/stomp +will be used. +.TP .B \-n An alternative Performance Metrics Name Space (PMNS) is loaded from the file .IR pmnsfile . @@ -732,10 +743,11 @@ c | c lf(CB) | l. Operators Explanation _ +alarm Raise a visible alarm with \fBxconfirm\f1(1) print Display on standard output shell Execute with \fBsh\fR(1) -alarm Raise a visible alarm with \fBxconfirm\f1(1) -syslog Append to \fI/var/adm/SYSLOG\fR +stomp Send a STOMP message to a JMS server +syslog Append a message to system log file .TE .P Multiple actions may be separated by the \f(CW&\fR and \f(CW|\fR @@ -895,6 +907,83 @@ or shutdown, or when they have been dete Refer to .BR pmie_check (1) for details on automating this process. +.SH EVENT MONITORING +It is common for production systems to be monitored in a central +location. +Traditionally on UNIX systems this has been performed by the system +log facilities \- see +.BR logger (1), +and +.BR syslogd (1). +.P +.B pmie +fits into this model when rules use the +.I syslog +action. +Note that if the action string begins with \-p (priority) and/or -t (tag) +then these are extracted from the string and treated in the same way as in +.BR logger (1). +.P +However, it is common to have other event monitoring frameworks also, +into which you may wish to incorporate performance events from +.BR pmie . +You can often use the +.I shell +action to send events to these frameworks, as they usually provide +their a program for injecting events into the framework from external +sources. +.P +A final option is use of the +.I stomp +(Streaming Text Oriented Messaging Protocol) action, which allows +.B pmie +to connect to a central JMS (Java Messaging System) server and send +events to the PMIE topic. +Tools can be written to extract these text messages and present them +to operations people (via desktop popup windows, etc). +Use of the +.I stomp +action requires a stomp configuration file to be setup, which specifies +the location of the JMS server host, port number, and username/password. +.P +The format of this file is as follows: +.P +.ft CW +.nf +.in +0.5i +host=messages.sgi.com # this is the JMS server (required) +port=61616 # and its listening here (required) +timeout=2 # seconds to wait for server (optional) +username=joe # (required) +password=j03ST0MP # (required) +topic=PMIE # JMS topic for pmie messages (optional) +.in +.fi +.ft 1 +.P +The timeout value specifies the time (in seconds) that +.B pmie +should wait for acknowledgements from the JMS server after +sending a message (as required by the STOMP protocol). +Note that on startup, +.B pmie +will wait indefinately for a connection, and will not +begin rule evaluation until that initial connection has +been established. +Should the connection to the JMS server be lost at any +time while +.B pmie +is running, +.B pmie +will attempt to reconnect on each subsequent truthful +evaluation of a rule with a +.I stomp +action, but not more than once per minute. +This is to avoid contributing to network congestion. +In this situation, where the STOMP connection to the JMS server +has been severed, the +.I stomp +action will return a non-zero error value. .SH FILES .PD 0 .TP 10 @@ -906,7 +995,7 @@ default PMNS specification files .TP .BI $PCP_TMP_DIR/pmie .B pmie -maintains files in this directory to identify the running +maintains files in this directory to identify the running .B pmie instances and to export runtime information about each instance \- this data forms the basis of the pmcd.pmie performance metrics Index: devel-pcp-2.5.99/src/pmie/GNUmakefile =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/GNUmakefile 2006-12-05 09:08:36.252988000 +1100 +++ devel-pcp-2.5.99/src/pmie/GNUmakefile 2006-12-05 09:07:22.656388500 +1100 @@ -46,6 +46,7 @@ install:: default $(INSTALL) -m 644 crontab $(CFG_DIR)/crontab $(INSTALL) -m 644 config.default.install $(CFG_DIR)/config.default $(INSTALL) -m 644 control.install $(CFG_DIR)/control + $(INSTALL) -m 644 stomp.install $(CFG_DIR)/stomp $(INSTALL) -m 755 etc_init.d_pmie $(PCP_RC_DIR)/pmie $(INSTALL) -m 755 pmie_check.sh $(PCP_BINADM_DIR)/pmie_check $(INSTALL) -m 755 pmie2col $(PCP_BIN_DIR)/pmie2col Index: devel-pcp-2.5.99/src/pmie/stomp.install =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ devel-pcp-2.5.99/src/pmie/stomp.install 2006-12-05 09:07:22.660388750 +1100 @@ -0,0 +1,11 @@ +# +# Sample STOMP configuration file, parameters affecting connection +# between pmie and a JMS server for the "stomp" rule action. +# + +host=foo.bar.com # this is the JMS server (required) +port=61616 # and its listening here (required) +timeout=2 # seconds to wait for server (optional) +topic=PMIE # JMS topic for pmie messages (optional) +username=joe # required +password=j03ST0MP # required Index: devel-pcp-2.5.99/src/pmie/src/dstruct.c =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/dstruct.c 2006-12-05 09:41:13.879332000 +1100 +++ devel-pcp-2.5.99/src/pmie/src/dstruct.c 2006-12-05 09:41:49.333547750 +1100 @@ -917,6 +917,7 @@ static struct { { actOr, "actOr" }, { actPrint, "actPrint" }, { actShell, "actShell" }, + { actStomp, "actStomp" }, { actSyslog, "actSyslog" }, { cndAdd_1_1, "cndAdd_1_1" }, { cndAdd_1_n, "cndAdd_1_n" }, Index: devel-pcp-2.5.99/src/pmie/src/eval.c =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/src/eval.c 2006-12-05 09:42:57.709821000 +1100 +++ devel-pcp-2.5.99/src/pmie/src/eval.c 2006-12-05 09:43:13.910833500 +1100 @@ -469,6 +469,10 @@ findEval(Expr *x) x->eval = actAlarm; break; + case ACT_STOMP: + x->eval = actStomp; + break; + case ACT_SYSLOG: x->eval = actSyslog; break; --=-BxW09RCYLjeSfBfPFr1b-- From nscott@aconex.com Tue Dec 5 21:04:03 2006 Received: with ECARTIS (v1.0.0; list pcp); Tue, 05 Dec 2006 21:04:10 -0800 (PST) Received: from page.mel.office.aconex.com (eth2333.vic.adsl.internode.on.net [150.101.159.28]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id kB6542aG008797 for ; Tue, 5 Dec 2006 21:04:03 -0800 Received: from localhost (page.mel.aconex.com [127.0.0.1]) by page.mel.office.aconex.com (Postfix) with ESMTP id 5FC0E5341BD; Wed, 6 Dec 2006 16:03:00 +1100 (EST) Received: from page.mel.office.aconex.com ([127.0.0.1]) by localhost (mail.aconex.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13698-01-72; Wed, 6 Dec 2006 16:02:58 +1100 (EST) Received: from edge (unknown [192.168.0.246]) by page.mel.office.aconex.com (Postfix) with ESMTP id 7867853426B; Wed, 6 Dec 2006 16:02:49 +1100 (EST) Subject: Re: [PATCH 01/12] Fix Windows PMDA build From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: Mark Goodwin , pcp@oss.sgi.com In-Reply-To: References: <1163999314.4695.231.camel@edge> <1164321131.4695.368.camel@edge> Content-Type: text/plain Organization: Aconex Date: Wed, 06 Dec 2006 16:02:39 +1100 Message-Id: <1165381359.1281.113.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 Content-Transfer-Encoding: 7bit X-archive-position: 602 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 820 Lines: 26 Hi Michael, On Wed, 2006-12-06 at 15:52 +1100, Michael Newton wrote: > On Fri, 24 Nov 2006, Nathan Scott wrote: > > On Mon, 2006-11-20 at 16:08 +1100, Nathan Scott wrote: > > > Currently the Makefile for the Windows agent is in a half-broken state, > > > it assumes in some places that uuencoding has been done on certain files > > > where it has not (uuencode/uudecode doesn't seem to be part of a default > > > Cygwin install either). > > > > > > This reverts the Windows PMDA Makefile to its earlier, working state. > > > > Don't worry about this patch for now, I'll send in a patch early next > > week to fix this up properly. > > is this still to come or did i miss it? cheers, m. > Its kept not making it to the top of my list, sorry. I'll send an updated version soon (today/tomorrow). cheers. -- Nathan From nscott@aconex.com Tue Dec 5 21:37:19 2006 Received: with ECARTIS (v1.0.0; list pcp); Tue, 05 Dec 2006 21:37:27 -0800 (PST) Received: from page.mel.office.aconex.com (eth2333.vic.adsl.internode.on.net [150.101.159.28]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id kB65bHaG013157 for ; Tue, 5 Dec 2006 21:37:18 -0800 Received: from localhost (page.mel.aconex.com [127.0.0.1]) by page.mel.office.aconex.com (Postfix) with ESMTP id E49AA534117; Wed, 6 Dec 2006 16:36:11 +1100 (EST) Received: from page.mel.office.aconex.com ([127.0.0.1]) by localhost (mail.aconex.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23422-01-40; Wed, 6 Dec 2006 16:36:05 +1100 (EST) Received: from edge (unknown [192.168.0.246]) by page.mel.office.aconex.com (Postfix) with ESMTP id 019455341BD; Wed, 6 Dec 2006 16:35:55 +1100 (EST) Subject: Re: [PATCH 01/12] Fix Windows PMDA build From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: Mark Goodwin , pcp@oss.sgi.com In-Reply-To: <1165381359.1281.113.camel@edge> References: <1163999314.4695.231.camel@edge> <1164321131.4695.368.camel@edge> <1165381359.1281.113.camel@edge> Content-Type: multipart/mixed; boundary="=-D0HmUMG4XVV4IFf6U3Pn" Organization: Aconex Date: Wed, 06 Dec 2006 16:35:46 +1100 Message-Id: <1165383346.1281.123.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-archive-position: 603 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 2494 Lines: 64 --=-D0HmUMG4XVV4IFf6U3Pn Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi Michael, On Wed, 2006-12-06 at 16:02 +1100, Nathan Scott wrote: > On Wed, 2006-12-06 at 15:52 +1100, Michael Newton wrote: > > On Fri, 24 Nov 2006, Nathan Scott wrote: > > > On Mon, 2006-11-20 at 16:08 +1100, Nathan Scott wrote: > > > > Currently the Makefile for the Windows agent is in a half-broken state, > > > > it assumes in some places that uuencoding has been done on certain files > > > > where it has not (uuencode/uudecode doesn't seem to be part of a default > > > > Cygwin install either). > > > > > > > > This reverts the Windows PMDA Makefile to its earlier, working state. > > > > > > Don't worry about this patch for now, I'll send in a patch early next > > > week to fix this up properly. > > > > is this still to come or did i miss it? cheers, m. OK, I discussed this with Ken, and we agreed that the patch I sent over earlier is what we should go with. The main issue here is to do with getting new versions of src/pmdas/windows/*.save into the distributed PCP tarballs, and we decided to put it back how it was originally, and send those files to you separately (on the rare occassions that they need to be re-generated). I did notice one unrelated issue when doing a test build just now, however - you'll need this (incremental) patch to get a source tar ball which can build itself, otherwise theres a missing config file and the build goes belly up in the build-src-tarball phase (only in the case of a build from the source generated from the source, if you see what I mean - not the normal case of building in a patched workarea - a quirk of the Makefile's LSRCFILES macro use). cheers. -- Nathan --=-D0HmUMG4XVV4IFf6U3Pn Content-Disposition: attachment; filename=fix-stomp-lsrcfiles Content-Type: text/x-patch; name=fix-stomp-lsrcfiles; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: devel-pcp-2.5.99/src/pmie/GNUmakefile =================================================================== --- devel-pcp-2.5.99.orig/src/pmie/GNUmakefile 2006-12-06 16:18:23.131062750 +1100 +++ devel-pcp-2.5.99/src/pmie/GNUmakefile 2006-12-06 16:19:05.257695500 +1100 @@ -28,7 +28,7 @@ include $(TOPDIR)/src/include/builddefs SUBDIRS = src examples LSRCFILES = control etc_init.d_pmie pmie_check.sh crontab config.default \ - pmie2col + pmie2col stomp.install LDIRT = control.install config.default.install CFG_DIR = $(PCP_VAR_DIR)/config/pmie --=-D0HmUMG4XVV4IFf6U3Pn-- From nscott@aconex.com Wed Dec 6 21:20:57 2006 Received: with ECARTIS (v1.0.0; list pcp); Wed, 06 Dec 2006 21:21:04 -0800 (PST) Received: from postoffice.aconex.com (mail.app.aconex.com [203.89.192.138]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id kB75KuaG025065 for ; Wed, 6 Dec 2006 21:20:56 -0800 Received: from edge (unknown [192.168.200.2]) by postoffice.aconex.com (Postfix) with ESMTP id 4D9D9AAC1A0; Thu, 7 Dec 2006 16:15:32 +1100 (EST) Subject: Re: [PATCH 01/12] Fix Windows PMDA build From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: Mark Goodwin , pcp@oss.sgi.com In-Reply-To: References: <1163999314.4695.231.camel@edge> <1164321131.4695.368.camel@edge> <1165381359.1281.113.camel@edge> <1165383346.1281.123.camel@edge> Content-Type: text/plain Organization: Aconex Date: Thu, 07 Dec 2006 16:19:53 +1100 Message-Id: <1165468793.30459.9.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 Content-Transfer-Encoding: 7bit X-archive-position: 604 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 1411 Lines: 41 On Thu, 2006-12-07 at 15:58 +1100, Michael Newton wrote: > On Wed, 6 Dec 2006, Nathan Scott wrote: > > OK, I discussed this with Ken, and we agreed that the patch I sent > > over earlier is what we should go with. The main issue here is to > > do with getting new versions of src/pmdas/windows/*.save into the > > distributed PCP tarballs, and we decided to put it back how it was > > originally, and send those files to you separately (on the rare > > occassions that they need to be re-generated). > > are u sure u really mean the same patch u sent? or do u just mean, leave > it as was in the 1st place? I did mean my patch. > the patch was to delete ".uu" from > pmda/windows/GNUmakefile right? Right. > When i do that, from a clean build i get > > gmake[5]: *** No rule to make target `show-all-ctrs.save', needed by > `src-pcp'. Oh. Does the ptools tree not have any *.save files checked in at all? I thought Max had checked those in... guess not? If not, we can just have a default .save Makefile rule which touches the file. Lemme know, I'll send a followup patch if you've not got any .save files in ptools. > > I did notice one unrelated issue when doing a test build just now, > this is an increment to the other stomp patch, right? just want to sure as > i think i'll put this stuff ona separate PV, as its a larger homogenous > change Yep, and that sounds fine. thanks! -- Nathan From kimbrr@melbourne.sgi.com Wed Dec 6 21:35:07 2006 Received: with ECARTIS (v1.0.0; list pcp); Wed, 06 Dec 2006 21:35:15 -0800 (PST) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id kB75Z4aG026466 for ; Wed, 6 Dec 2006 21:35:06 -0800 Received: from snort.melbourne.sgi.com (snort.melbourne.sgi.com [134.14.54.149]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id QAA01743; Thu, 7 Dec 2006 16:34:07 +1100 Received: from snort.melbourne.sgi.com (localhost [127.0.0.1]) by snort.melbourne.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id kB75Y57Y55748602; Thu, 7 Dec 2006 16:34:06 +1100 (AEDT) Received: from localhost (kimbrr@localhost) by snort.melbourne.sgi.com (SGI-8.12.5/8.12.5/Submit) with ESMTP id kB75Y43h55731689; Thu, 7 Dec 2006 16:34:04 +1100 (AEDT) X-Authentication-Warning: snort.melbourne.sgi.com: kimbrr owned process doing -bs Date: Thu, 7 Dec 2006 16:34:04 +1100 From: Michael Newton To: Nathan Scott cc: Mark Goodwin , pcp@oss.sgi.com Subject: Re: [PATCH 01/12] Fix Windows PMDA build In-Reply-To: <1165468793.30459.9.camel@edge> Message-ID: References: <1163999314.4695.231.camel@edge> <1164321131.4695.368.camel@edge> <1165381359.1281.113.camel@edge> <1165383346.1281.123.camel@edge> <1165468793.30459.9.camel@edge> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 605 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: kimbrr@melbourne.sgi.com Precedence: bulk X-list: pcp Content-Length: 3251 Lines: 104 On Thu, 7 Dec 2006, Nathan Scott wrote: > On Thu, 2006-12-07 at 15:58 +1100, Michael Newton wrote: > > On Wed, 6 Dec 2006, Nathan Scott wrote: > > the patch was to delete ".uu" from > > pmda/windows/GNUmakefile right? > > Right. > > > When i do that, from a clean build i get > > > > gmake[5]: *** No rule to make target `show-all-ctrs.save', needed by > > `src-pcp'. > > Oh. Does the ptools tree not have any *.save files checked in at all? > I thought Max had checked those in... guess not? If not, we can just > have a default .save Makefile rule which touches the file. Lemme know, > I'll send a followup patch if you've not got any .save files in ptools. i dont see anything.. kimbrr@chook:/build/kimbrr/pcp> grep 'windows.*save' census src/pmdas/windows/shim.save%kimbrr%1.1|2004.07.12.02.43.23{t} src/pmdas/windows/shim.save.uu%kimbrr%1.1|2006.06.30.06.57.22{t} src/pmdas/windows/show-all-ctrs.save.uu%kimbrr%1.1|2006.06.30.06.48.59{t} kimbrr@chook:/build/kimbrr/pcp> : kimbrr@chook:/build/kimbrr/mangrove/mgmt/pcp> p_rlog src/pmdas/windows/shim.save* RCS log for mgmt/pcp/src/pmdas/windows/shim.save RCS file: /plroot/eoe/pcp-1.0-melb/.RCS/PL/src/pmdas/windows/RCS/shim.save,v Working file: shim.save head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------- revision 1.1 date: 2004/07/12 02:43:23; author: kenmcd; state: Exp; modid: pcp-1.0:eoe:17970a pv:916303 restructure to support pmda + shim arcitecture, needed for SFU ============================================================================= RCS log for mgmt/pcp/src/pmdas/windows/shim.save.uu RCS file: /plroot/eoe/pcp-1.0-melb/.RCS/PL/src/pmdas/windows/RCS/shim.save.uu,v Working file: shim.save.uu head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------- revision 1.1 date: 2006/06/30 06:57:22; author: makc; state: Exp; modid: pcp-1.0:eoe:26392a pv:954343 - changes from Ken McDonell(kenj@internode.on.net) ============================================================================= kimbrr@chook:/build/kimbrr/mangrove/mgmt/pcp> p_rlog src/pmdas/windows/show-all-ctrs.save.uu RCS log for mgmt/pcp/src/pmdas/windows/show-all-ctrs.save.uu RCS file: /plroot/eoe/pcp-1.0-melb/.RCS/PL/src/pmdas/windows/RCS/show-all-ctrs.save.uu,v Working file: show-all-ctrs.save.uu head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: ---------------------------- revision 1.1 date: 2006/06/30 06:48:59; author: makc; state: Exp; modid: pcp-1.0:eoe:26391a pv:954343 - add changes made by Ken McDonell (kenj@internode.on.net) ============================================================================= kimbrr@chook:/build/kimbrr/mangrove/mgmt/pcp> > > > I did notice one unrelated issue when doing a test build just now, > > this is an increment to the other stomp patch, right? just want to sure as > > i think i'll put this stuff ona separate PV, as its a larger homogenous > > change > > Yep, and that sounds fine. > > thanks! > > -- > Nathan > > From nscott@aconex.com Wed Dec 6 22:17:04 2006 Received: with ECARTIS (v1.0.0; list pcp); Wed, 06 Dec 2006 22:17:11 -0800 (PST) Received: from postoffice.aconex.com (mail.app.aconex.com [203.89.192.138]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id kB76GxaG029544 for ; Wed, 6 Dec 2006 22:17:02 -0800 Received: from edge (unknown [192.168.200.2]) by postoffice.aconex.com (Postfix) with ESMTP id 2ACA3AAC1A0; Thu, 7 Dec 2006 17:11:35 +1100 (EST) Subject: Re: [PATCH 01/12] Fix Windows PMDA build From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: Mark Goodwin , pcp@oss.sgi.com In-Reply-To: References: <1163999314.4695.231.camel@edge> <1164321131.4695.368.camel@edge> <1165381359.1281.113.camel@edge> <1165383346.1281.123.camel@edge> <1165468793.30459.9.camel@edge> Content-Type: text/plain Organization: Aconex Date: Thu, 07 Dec 2006 17:15:56 +1100 Message-Id: <1165472156.30459.17.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 Content-Transfer-Encoding: 7bit X-archive-position: 606 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 1212 Lines: 35 On Thu, 2006-12-07 at 16:34 +1100, Michael Newton wrote: > On Thu, 7 Dec 2006, Nathan Scott wrote: > > On Thu, 2006-12-07 at 15:58 +1100, Michael Newton wrote: > > > On Wed, 6 Dec 2006, Nathan Scott wrote: > > > the patch was to delete ".uu" from > > > pmda/windows/GNUmakefile right? > > > > Right. > > > > > When i do that, from a clean build i get > > > > > > gmake[5]: *** No rule to make target `show-all-ctrs.save', needed by > > > `src-pcp'. > > > > Oh. Does the ptools tree not have any *.save files checked in at all? > > I thought Max had checked those in... guess not? If not, we can just > > have a default .save Makefile rule which touches the file. Lemme know, > > I'll send a followup patch if you've not got any .save files in ptools. > > i dont see anything.. > > kimbrr@chook:/build/kimbrr/pcp> grep 'windows.*save' census > src/pmdas/windows/shim.save%kimbrr%1.1|2004.07.12.02.43.23{t} > src/pmdas/windows/shim.save.uu%kimbrr%1.1|2006.06.30.06.57.22{t} > src/pmdas/windows/show-all-ctrs.save.uu%kimbrr%1.1|2006.06.30.06.48.59{t} > kimbrr@chook:/build/kimbrr/pcp> Oh, thats not what I expected. I'll huddle with Ken and get back to you with a sane patch tomorrow. cheers. -- Nathan From nscott@aconex.com Thu Dec 7 21:23:09 2006 Received: with ECARTIS (v1.0.0; list pcp); Thu, 07 Dec 2006 21:23:17 -0800 (PST) Received: from postoffice.aconex.com (mail.app.aconex.com [203.89.192.138]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id kB85N7qw030334 for ; Thu, 7 Dec 2006 21:23:08 -0800 Received: from edge (unknown [192.168.200.2]) by postoffice.aconex.com (Postfix) with ESMTP id CA044AAC1BC; Fri, 8 Dec 2006 16:17:32 +1100 (EST) Subject: [PATCH] fix some incorrectly tagged instantaneous metrics From: Nathan Scott Reply-To: nscott@aconex.com To: Michael Newton Cc: pcp@oss.sgi.com Content-Type: multipart/mixed; boundary="=-s4x1CIKRDtQJCEvc4Qwh" Organization: Aconex Date: Fri, 08 Dec 2006 16:22:11 +1100 Message-Id: <1165555331.30459.92.camel@edge> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-archive-position: 607 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: nscott@aconex.com Precedence: bulk X-list: pcp Content-Length: 2558 Lines: 76 --=-s4x1CIKRDtQJCEvc4Qwh Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, There's several metrics in the Linux PMDA which are marked as discrete when they really have instantaneous values (likely to change between samples)... this patch fixes up the worst offenders. Several are in a bit of a grey area (many of the proc metrics for example), so I've left those ones alone. cheers. -- Nathan --=-s4x1CIKRDtQJCEvc4Qwh Content-Disposition: attachment; filename=fix-discrete-in-linux-pmda Content-Type: text/x-patch; name=fix-discrete-in-linux-pmda; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: devel-pcp-2.5.99/src/pmdas/linux/pmda.c =================================================================== --- devel-pcp-2.5.99.orig/src/pmdas/linux/pmda.c 2006-12-08 09:54:55.624508500 +1100 +++ devel-pcp-2.5.99/src/pmdas/linux/pmda.c 2006-12-08 15:59:33.567794500 +1100 @@ -662,7 +662,7 @@ static pmdaMetric metrictab[] = { /* kernel.all.lastpid -- added by Mike Mason */ { NULL, - { PMDA_PMID(CLUSTER_LOADAVG, 1), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_DISCRETE, + { PMDA_PMID(CLUSTER_LOADAVG, 1), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT, PMDA_PMUNITS(0,0,0,0,0,0) } }, /* @@ -840,7 +840,7 @@ static pmdaMetric metrictab[] = { /* filesys.full */ { NULL, - { PMDA_PMID(CLUSTER_FILESYS,8), PM_TYPE_DOUBLE, FILESYS_INDOM, PM_SEM_DISCRETE, + { PMDA_PMID(CLUSTER_FILESYS,8), PM_TYPE_DOUBLE, FILESYS_INDOM, PM_SEM_INSTANT, PMDA_PMUNITS(0,0,0,0,0,0) } }, /* @@ -1110,7 +1110,7 @@ static pmdaMetric metrictab[] = { /* proc.nprocs */ { NULL, - { PMDA_PMID(CLUSTER_PID_STAT,99), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_DISCRETE, + { PMDA_PMID(CLUSTER_PID_STAT,99), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT, PMDA_PMUNITS(0,0,0,0,0,0) } }, /* proc.psinfo.pid */ @@ -1315,7 +1315,7 @@ static pmdaMetric metrictab[] = { /* proc.psinfo.processor -- added by Mike Mason */ { NULL, - { PMDA_PMID(CLUSTER_PID_STAT,38), PM_TYPE_U32, PROC_INDOM, PM_SEM_DISCRETE, + { PMDA_PMID(CLUSTER_PID_STAT,38), PM_TYPE_U32, PROC_INDOM, PM_SEM_INSTANT, PMDA_PMUNITS(0,0,0,0,0,0)}}, /* proc.psinfo.ttyname */ @@ -2624,7 +2624,7 @@ static pmdaMetric metrictab[] = { /* kernel.all.nusers */ { NULL, - { PMDA_PMID(CLUSTER_NUSERS, 0), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_DISCRETE, + { PMDA_PMID(CLUSTER_NUSERS, 0), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT, PMDA_PMUNITS(0,0,0,0,0,0)}}, /* --=-s4x1CIKRDtQJCEvc4Qwh-- From kimbrr@melbourne.sgi.com Fri Dec 8 17:34:11 2006 Received: with ECARTIS (v1.0.0; list pcp); Fri, 08 Dec 2006 17:34:20 -0800 (PST) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id kB91Y6qw032271 for ; Fri, 8 Dec 2006 17:34:08 -0800 Received: from snort.melbourne.sgi.com (snort.melbourne.sgi.com [134.14.54.149]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id PAA00758; Thu, 7 Dec 2006 15:58:36 +1100 Received: from snort.melbourne.sgi.com (localhost [127.0.0.1]) by snort.melbourne.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id kB74wY7Y55723493; Thu, 7 Dec 2006 15:58:34 +1100 (AEDT) Received: from localhost (kimbrr@localhost) by snort.melbourne.sgi.com (SGI-8.12.5/8.12.5/Submit) with ESMTP id kB74wVng55713329; Thu, 7 Dec 2006 15:58:33 +1100 (AEDT) X-Authentication-Warning: snort.melbourne.sgi.com: kimbrr owned process doing -bs Date: Thu, 7 Dec 2006 15:58:31 +1100 From: Michael Newton To: Nathan Scott cc: Mark Goodwin , pcp@oss.sgi.com Subject: Re: [PATCH 01/12] Fix Windows PMDA build In-Reply-To: <1165383346.1281.123.camel@edge> Message-ID: References: <1163999314.4695.231.camel@edge> <1164321131.4695.368.camel@edge> <1165381359.1281.113.camel@edge> <1165383346.1281.123.camel@edge> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 608 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: kimbrr@melbourne.sgi.com Precedence: bulk X-list: pcp Content-Length: 1594 Lines: 34 On Wed, 6 Dec 2006, Nathan Scott wrote: > OK, I discussed this with Ken, and we agreed that the patch I sent > over earlier is what we should go with. The main issue here is to > do with getting new versions of src/pmdas/windows/*.save into the > distributed PCP tarballs, and we decided to put it back how it was > originally, and send those files to you separately (on the rare > occassions that they need to be re-generated). are u sure u really mean the same patch u sent? or do u just mean, leave it as was in the 1st place? the patch was to delete ".uu" from pmda/windows/GNUmakefile right? When i do that, from a clean build i get gmake[5]: *** No rule to make target `show-all-ctrs.save', needed by `src-pcp'. Stop. gmake[4]: *** [src-pcp] Error 2 gmake[3]: *** [src-pcp] Error 2 gmake[2]: *** [src-pcp] Error 2 make[1]: *** [pcp.src] Error 2 make[1]: Leaving directory `/home/kimbrr/isms/mangrove/mgmt/pcp/build' make: *** [pcp-open-2.7.0] Error 2 > I did notice one unrelated issue when doing a test build just now, > however - you'll need this (incremental) patch to get a source tar > ball which can build itself, otherwise theres a missing config file > and the build goes belly up in the build-src-tarball phase (only in > the case of a build from the source generated from the source, if > you see what I mean - not the normal case of building in a patched > workarea - a quirk of the Makefile's LSRCFILES macro use). this is an increment to the other stomp patch, right? just want to sure as i think i'll put this stuff ona separate PV, as its a larger homogenous change From kimbrr@melbourne.sgi.com Thu Dec 21 13:49:30 2006 Received: with ECARTIS (v1.0.0; list pcp); Thu, 21 Dec 2006 13:49:40 -0800 (PST) X-Spam-oss-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00 autolearn=unavailable version=3.2.0-r469477 Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id kBLLnRqw013552 for ; Thu, 21 Dec 2006 13:49:29 -0800 Received: from snort.melbourne.sgi.com (snort.melbourne.sgi.com [134.14.54.149]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id PAA16940; Wed, 6 Dec 2006 15:52:41 +1100 Received: from snort.melbourne.sgi.com (localhost [127.0.0.1]) by snort.melbourne.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id kB64qd7Y54769075; Wed, 6 Dec 2006 15:52:40 +1100 (AEDT) Received: from localhost (kimbrr@localhost) by snort.melbourne.sgi.com (SGI-8.12.5/8.12.5/Submit) with ESMTP id kB64qZfs54632011; Wed, 6 Dec 2006 15:52:38 +1100 (AEDT) X-Authentication-Warning: snort.melbourne.sgi.com: kimbrr owned process doing -bs Date: Wed, 6 Dec 2006 15:52:35 +1100 From: Michael Newton To: Nathan Scott cc: Michael Newton , Mark Goodwin , pcp@oss.sgi.com Subject: Re: [PATCH 01/12] Fix Windows PMDA build In-Reply-To: <1164321131.4695.368.camel@edge> Message-ID: References: <1163999314.4695.231.camel@edge> <1164321131.4695.368.camel@edge> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-archive-position: 620 X-ecartis-version: Ecartis v1.0.0 Sender: pcp-bounce@oss.sgi.com Errors-to: pcp-bounce@oss.sgi.com X-original-sender: kimbrr@melbourne.sgi.com Precedence: bulk X-list: pcp Content-Length: 593 Lines: 14 On Fri, 24 Nov 2006, Nathan Scott wrote: > On Mon, 2006-11-20 at 16:08 +1100, Nathan Scott wrote: > > Currently the Makefile for the Windows agent is in a half-broken state, > > it assumes in some places that uuencoding has been done on certain files > > where it has not (uuencode/uudecode doesn't seem to be part of a default > > Cygwin install either). > > > > This reverts the Windows PMDA Makefile to its earlier, working state. > > Don't worry about this patch for now, I'll send in a patch early next > week to fix this up properly. is this still to come or did i miss it? cheers, m.