Skip to content
This repository
Browse code

*** empty log message ***

  • Loading branch information...
commit 55e39e451663ad154cba21360a4f71a1831fefa6 1 parent 8099eca
massie authored
14 monitor-core/gmond/conf.h
@@ -19,6 +19,9 @@ udp_recv_channel { \n\
19 19 port = 8649 \n\
20 20 bind = 239.2.11.71 \n\
21 21 } \n\
  22 +tcp_accept_channel { \n\
  23 + port = 8666 \n\
  24 +} \n\
22 25 collection_group { \n\
23 26 name = \"cpu_stat\" \n\
24 27 metric { \n\
@@ -51,11 +54,10 @@ static cfg_opt_t location_opts[] = {
51 54 CFG_END()
52 55 };
53 56
54   -static cfg_opt_t id_opts[] = {
55   - CFG_STR("cluster", NULL, CFGF_NONE ),
  57 +static cfg_opt_t cluster_opts[] = {
  58 + CFG_STR("name", NULL, CFGF_NONE ),
56 59 CFG_STR("owner", NULL, CFGF_NONE ),
57   - CFG_STR("latitude", NULL, CFGF_NONE ),
58   - CFG_STR("longitude", NULL, CFGF_NONE ),
  60 + CFG_STR("latlong", NULL, CFGF_NONE ),
59 61 CFG_STR("url", NULL, CFGF_NONE ),
60 62 CFG_END()
61 63 };
@@ -97,6 +99,8 @@ static cfg_opt_t tcp_accept_channel_opts[] = {
97 99 CFG_INT("port", -1, CFGF_NONE ),
98 100 CFG_STR("interface", NULL, CFGF_NONE),
99 101 CFG_STR("protocol", "xml", CFGF_NONE),
  102 + CFG_STR("allow_ip", NULL, CFGF_NONE),
  103 + CFG_STR("allow_mask", NULL, CFGF_NONE),
100 104 CFG_END()
101 105 };
102 106
@@ -148,7 +152,7 @@ static cfg_opt_t collection_group_opts[] = {
148 152
149 153 static cfg_opt_t gmond_opts[] = {
150 154 CFG_SEC("location", location_opts, CFGF_NONE),
151   - CFG_SEC("identification", id_opts, CFGF_NONE),
  155 + CFG_SEC("cluster", cluster_opts, CFGF_NONE),
152 156 CFG_SEC("behavior", behavior_opts, CFGF_NONE),
153 157 CFG_SEC("udp_send_channel", udp_send_channel_opts, CFGF_MULTI),
154 158 CFG_SEC("udp_recv_channel", udp_recv_channel_opts, CFGF_MULTI),
410 monitor-core/gmond/gmond.c
@@ -10,7 +10,7 @@
10 10 #include <apr_poll.h>
11 11 #include <apr_network_io.h>
12 12 #include <apr_signal.h>
13   -#include <apr_thread_proc.h> /* for apr_proc_detach(). no threads. */
  13 +#include <apr_thread_proc.h> /* for apr_proc_detach(). no threads used. */
14 14 #include <apr_tables.h>
15 15
16 16 #include "cmdline.h" /* generated by cmdline.sh which runs gengetopt */
@@ -21,6 +21,7 @@
21 21 #include "apr_net.h" /* our private network functions based on apr */
22 22 #include "debug_msg.h"
23 23 #include "protocol.h" /* generated header from ./lib/protocol.x xdr definition file */
  24 +#include "dtd.h" /* the DTD definition for our XML */
24 25
25 26 /* When this gmond was started */
26 27 apr_time_t started;
@@ -48,12 +49,20 @@ apr_array_header_t *udp_recv_acl_array = NULL;
48 49 /* The array for outgoing UDP message channels */
49 50 apr_array_header_t *udp_send_array = NULL;
50 51
  52 +/* The pollset for incoming TCP requests */
  53 +apr_pollset_t *tcp_accept_pollset = NULL;
  54 +/* The access control list for each of the TCP accept channels */
  55 +apr_array_header_t *tcp_accept_acl_array = NULL;
  56 +
51 57 /* The hash to hold the hosts (key = host IP) */
52 58 apr_hash_t *hosts;
  59 +
53 60 /* The "hosts" hash contains values of type "hostdata" */
54 61 struct Ganglia_host_data {
55 62 /* Name of the host */
56 63 char *hostname;
  64 + /* The IP of this host */
  65 + char *ip;
57 66 /* Timestamp of when the remote host gmond started */
58 67 unsigned int gmond_started;
59 68 /* The pool used to malloc memory for this host */
@@ -294,22 +303,45 @@ setup_udp_recv_pollset( void )
294 303
295 304 /* TODO: This function needs to be updated later to handle proxy information */
296 305 static Ganglia_host_data *
297   -find_host_data( char *remoteip, apr_sockaddr_t *sa)
  306 +Ganglia_host_data_get( char *remoteip, apr_sockaddr_t *sa, Ganglia_message *fullmsg)
298 307 {
299 308 apr_status_t status;
300 309 apr_pool_t *pool;
301 310 Ganglia_host_data *hostdata;
302 311 char *hostname = NULL;
303   - char *remoteipdup = NULL;
  312 + char *ip = remoteip;
  313 + Ganglia_format_26 *msg = NULL;
  314 +
  315 + if(fullmsg && fullmsg->format == GANGLIA_FORMAT_26 && fullmsg->Ganglia_message_u.format_26)
  316 + {
  317 + /* This message is in ganglia (2.6.x) format */
  318 + msg = fullmsg->Ganglia_message_u.format_26;
  319 + if(msg->hdr && msg->hdr->host)
  320 + {
  321 + if(msg->hdr->host->hostname)
  322 + {
  323 + hostname = msg->hdr->host->hostname;
  324 + }
  325 + if(msg->hdr->host->ip)
  326 + {
  327 + ip = msg->hdr->host->ip;
  328 + }
  329 + }
  330 + }
304 331
305   - hostdata = (Ganglia_host_data *)apr_hash_get( hosts, remoteip, APR_HASH_KEY_STRING );
  332 + hostdata = (Ganglia_host_data *)apr_hash_get( hosts, ip, APR_HASH_KEY_STRING );
306 333 if(!hostdata)
307 334 {
308   - /* Lookup the hostname (TODO: check for proxy info) */
309   - status = apr_getnameinfo(&hostname, sa, 0);
310   - if(status != APR_SUCCESS)
  335 + /* Lookup the hostname or use the proxy information if available */
  336 + if( !hostname )
311 337 {
312   - hostname = remoteip;
  338 + /* We'll use the resolver to find the hostname */
  339 + status = apr_getnameinfo(&hostname, sa, 0);
  340 + if(status != APR_SUCCESS)
  341 + {
  342 + /* If hostname lookup fails.. set it to the ip */
  343 + hostname = ip;
  344 + }
313 345 }
314 346
315 347 /* This is the first time we've heard from this host.. create a new pool */
@@ -334,7 +366,7 @@ find_host_data( char *remoteip, apr_sockaddr_t *sa)
334 366 hostdata->hostname = apr_pstrdup( pool, hostname );
335 367
336 368 /* Dup the remoteip (it will be freed later) */
337   - remoteipdup = apr_pstrdup( pool, remoteip);
  369 + hostdata->ip = apr_pstrdup( pool, ip);
338 370
339 371 /* Set the timestamps */
340 372 hostdata->first_heard_from = hostdata->last_heard_from = apr_time_now();
@@ -348,17 +380,44 @@ find_host_data( char *remoteip, apr_sockaddr_t *sa)
348 380 }
349 381
350 382 /* Save this host data to the "hosts" hash */
351   - apr_hash_set( hosts, remoteipdup, APR_HASH_KEY_STRING, hostdata);
  383 + apr_hash_set( hosts, hostdata->ip, APR_HASH_KEY_STRING, hostdata);
352 384 }
353 385 else
354 386 {
355   - /* We already have this host in our "hosts" hash undate timestamp */
  387 + /* We already have this host in our "hosts" hash update timestamp */
356 388 hostdata->last_heard_from = apr_time_now();
357 389 }
358 390
359 391 return hostdata;
360 392 }
361 393
  394 +/* This function takes an old 2.5.x message and converts it to
  395 + * a 2.6.0 format.
  396 + */
  397 +static Ganglia_format_26 *
  398 +convert_old_metric_to_format_26( Ganglia_old_metric *old_metric )
  399 +{
  400 + Ganglia_format_26 *format_26 = NULL;
  401 + Ganglia_message_body_26 *bdy = NULL;
  402 +
  403 + if(!old_metric)
  404 + return NULL;
  405 +
  406 + format_26 = malloc( sizeof(Ganglia_format_26));
  407 + if(!format_26)
  408 + return NULL;
  409 +
  410 + format_26->hdr = NULL; /* no proxy etc info */
  411 + format_26->bdy = bdy = malloc(sizeof(Ganglia_message_body_26));
  412 + if(!bdy)
  413 + {
  414 + free(format_26);
  415 + return NULL;
  416 + }
  417 +
  418 + return format_26;
  419 +}
  420 +
362 421 static void
363 422 poll_udp_recv_channels(apr_interval_time_t timeout)
364 423 {
@@ -421,11 +480,12 @@ poll_udp_recv_channels(apr_interval_time_t timeout)
421 480 Ganglia_message msg;
422 481 Ganglia_host_data *hostdata = NULL;
423 482 Ganglia_old_metric *old_metric;
  483 + Ganglia_format_26 *format_26 = NULL;
424 484
425 485 /* Create the XDR receive stream */
426 486 xdrmem_create(&x, buf, max_udp_message_len, XDR_DECODE);
427 487
428   - /* Flush the data */
  488 + /* Flush the data... */
429 489 memset( &msg, 0, sizeof(Ganglia_message));
430 490
431 491 /* Read the gangliaMessage from the stream */
@@ -434,13 +494,53 @@ poll_udp_recv_channels(apr_interval_time_t timeout)
434 494 continue;
435 495 }
436 496
  497 + /* Process the host information and get the Ganglia_host_data.
  498 + * We call this _after_ we process the content of the message
  499 + * because the newer message format allows for proxy information
  500 + * to be sent. NOTE: The ACL test above looks at the IP header
  501 + * and not the proxy information provided. */
  502 + hostdata = Ganglia_host_data_get( remoteip, remotesa, &msg);
  503 + if(!hostdata)
  504 + {
  505 + /* Most likely a memory error. Free the memory for this
  506 + * message and move along... */
  507 + xdr_free((xdrproc_t)xdr_Ganglia_message, (char *)&msg);
  508 + continue;
  509 + }
  510 +
437 511 /* Check if this is an old metric format */
438 512 old_metric = Ganglia_old_metric_get( msg.format );
439 513 if(old_metric)
440 514 {
441 515 /* Move this data into a newer format (later) */
442   - fprintf(stderr,"%s\t=>\t%s\n", remoteip, old_metric->name);
  516 + debug_msg("%s\t=>\t%s", remoteip, old_metric->name);
  517 + format_26 = convert_old_metric_to_format_26( old_metric );
  518 + if(!format_26)
  519 + {
  520 + continue;
  521 + }
  522 + }
  523 + else if( msg.format == GANGLIA_FORMAT_26 )
  524 + {
  525 + /* This data is in 2.6.x format */
  526 + format_26 = msg.Ganglia_message_u.format_26;
  527 + if(!format_26)
  528 + {
  529 + continue;
  530 + }
  531 + }
  532 + else
  533 + {
  534 + /* This data isn't in a format that I understand.
  535 + * Free the message and move on... */
  536 + xdr_free((xdrproc_t)xdr_Ganglia_message, (char *)&msg);
  537 + continue;
443 538 }
  539 +
  540 + /* At this point we are ready to save format_26 data to
  541 + * the host's metric hash */
  542 +
  543 +
444 544
445 545 /* If I want to find out how much data I decoded
446 546 decoded = xdr_getpos(&x); */
@@ -515,6 +615,277 @@ setup_udp_send_array( void )
515 615 }
516 616 }
517 617
  618 +static void
  619 +setup_tcp_accept_pollset( void )
  620 +{
  621 + apr_status_t status;
  622 + int i, num_tcp_accept_channels = cfg_size( config_file, "tcp_accept_channel");
  623 +
  624 + /* Create my TCP accept pollset */
  625 + apr_pollset_create(&tcp_accept_pollset, num_tcp_accept_channels, global_context, 0);
  626 +
  627 + /* Create my TCP accept ACL array */
  628 + tcp_accept_acl_array = apr_array_make( global_context, num_tcp_accept_channels,
  629 + sizeof(apr_ipsubnet_t *));
  630 +
  631 + for(i=0; i< num_tcp_accept_channels; i++)
  632 + {
  633 + cfg_t *tcp_accept_channel = cfg_getnsec( config_file, "tcp_accept_channel", i);
  634 + char *bindaddr, *protocol, *allow_ip, *allow_mask, *interface;
  635 + int port;
  636 + apr_socket_t *socket = NULL;
  637 + apr_ipsubnet_t *ipsub = NULL;
  638 + apr_pollfd_t socket_pollfd;
  639 + apr_pool_t *pool = NULL;
  640 +
  641 + port = cfg_getint( tcp_accept_channel, "port");
  642 + bindaddr = cfg_getstr( tcp_accept_channel, "bind");
  643 + protocol = cfg_getstr( tcp_accept_channel, "protocol");
  644 + allow_ip = cfg_getstr( tcp_accept_channel, "allow_ip");
  645 + allow_mask = cfg_getstr( tcp_accept_channel, "allow_mask");
  646 + interface = cfg_getstr( tcp_accept_channel, "interface");
  647 +
  648 + debug_msg("tcp_accept_channel bind=%s port=%d protocol=%s\n",
  649 + bindaddr? bindaddr: "NULL", port,
  650 + protocol? protocol:"NULL");
  651 +
  652 + /* Create a subpool context */
  653 + apr_pool_create(&pool, global_context);
  654 +
  655 + /* Create the socket for the channel */
  656 + socket = create_tcp_server(pool, port, bindaddr, interface);
  657 + if(!socket)
  658 + {
  659 + fprintf(stderr,"Unable to create tcp_accept_channel. Exiting.\n");
  660 + exit(1);
  661 + }
  662 +
  663 + /* Build the socket poll file descriptor structure */
  664 + socket_pollfd.desc_type = APR_POLL_SOCKET;
  665 + socket_pollfd.reqevents = APR_POLLIN;
  666 + socket_pollfd.desc.s = socket;
  667 + socket_pollfd.client_data = protocol;
  668 +
  669 + /* Add the socket to the pollset */
  670 + status = apr_pollset_add(tcp_accept_pollset, &socket_pollfd);
  671 + if(status != APR_SUCCESS)
  672 + {
  673 + fprintf(stderr,"Failed to add socket to pollset. Exiting.\n");
  674 + exit(1);
  675 + }
  676 +
  677 + /* Save the ACL information */
  678 + if(allow_ip)
  679 + {
  680 + status = apr_ipsubnet_create(&ipsub, allow_ip, allow_mask, pool);
  681 + if(status != APR_SUCCESS)
  682 + {
  683 + fprintf(stderr,"Unable to build ACL for ip=%s mask=%s. Exiting.\n",
  684 + allow_ip, allow_mask);
  685 + exit(1);
  686 + }
  687 + }
  688 +
  689 + /* ipsub of NULL means no acl in effect */
  690 + *(apr_ipsubnet_t **)apr_array_push(tcp_accept_acl_array) = ipsub;
  691 + }
  692 +}
  693 +
  694 +static apr_status_t
  695 +print_xml_header( apr_socket_t *client )
  696 +{
  697 + apr_status_t status;
  698 + apr_size_t len = strlen(DTD);
  699 + char gangliaxml[128];
  700 + char clusterxml[1024];
  701 + static int clusterinit = 0;
  702 + static char *name = NULL;
  703 + static char *owner = NULL;
  704 + static char *latlong = NULL;
  705 + static char *url = NULL;
  706 + apr_time_t now = apr_time_now();
  707 +
  708 + status = apr_send( client, DTD, &len );
  709 + if(status != APR_SUCCESS)
  710 + return status;
  711 +
  712 + len = apr_snprintf( gangliaxml, 128, "<GANGLIA_XML VERSION=\"%s\" SOURCE=\"gmond\">\n",
  713 + VERSION);
  714 + status = apr_send( client, gangliaxml, &len);
  715 + if(status != APR_SUCCESS)
  716 + return status;
  717 +
  718 + if(!clusterinit)
  719 + {
  720 + cfg_t *cluster = cfg_getsec(config_file, "cluster");
  721 + name = cfg_getstr( cluster, "name" );
  722 + owner = cfg_getstr( cluster, "owner" );
  723 + latlong = cfg_getstr( cluster, "latlong" );
  724 + url = cfg_getstr( cluster, "url" );
  725 + clusterinit = 1;
  726 + }
  727 +
  728 + len = apr_snprintf( clusterxml, 1024,
  729 + "<CLUSTER NAME=\"%s\" LOCALTIME=\"%d\" OWNER=\"%s\" LATLONG=\"%s\" URL=\"%s\">\n",
  730 + name?name:"unspecified",
  731 + (int)(now / APR_USEC_PER_SEC),
  732 + owner?owner:"unspecified",
  733 + latlong?latlong:"unspecified",
  734 + url?url:"unspecified");
  735 +
  736 + return apr_send( client, clusterxml, &len);
  737 +}
  738 +
  739 +static apr_status_t
  740 +print_xml_footer( apr_socket_t *client )
  741 +{
  742 + apr_size_t len = 26;
  743 + return apr_send( client, "</CLUSTER>\n</GANGLIA_XML>\n", &len);
  744 +}
  745 +
  746 +static apr_status_t
  747 +print_host_start( apr_socket_t *client, Ganglia_host_data *hostinfo)
  748 +{
  749 + apr_size_t len;
  750 + char hostxml[1024]; /* for <HOST></HOST> */
  751 + apr_time_t now = apr_time_now();
  752 + int tn = (now - hostinfo->last_heard_from) / APR_USEC_PER_SEC;
  753 +
  754 + len = apr_snprintf(hostxml, 1024,
  755 + "<HOST NAME=\"%s\" IP=\"%s\" TN=\"%d\" TMAX=\"%d\" DMAX=\"%d\" LOCATION=\"%s\" GMOND_STARTED=\"%d\">\n",
  756 + hostinfo->hostname,
  757 + hostinfo->ip,
  758 + tn,
  759 + 0 /*tmax*/,
  760 + 0 /*dmax*/,
  761 + "unspecified", /*location*/
  762 + 0 /*gmond_started*/);
  763 +
  764 + return apr_send(client, hostxml, &len);
  765 +}
  766 +
  767 +static apr_status_t
  768 +print_host_end( apr_socket_t *client)
  769 +{
  770 + apr_size_t len = 8;
  771 + return apr_send(client, "</HOST>\n", &len);
  772 +}
  773 +
  774 +static void
  775 +poll_tcp_accept_channels(apr_interval_time_t timeout)
  776 +{
  777 + apr_status_t status;
  778 + const apr_pollfd_t *descs = NULL;
  779 + apr_int32_t num = 0;
  780 +
  781 + /* Poll for data with given timeout */
  782 + status = apr_pollset_poll(tcp_accept_pollset, timeout, &num, &descs);
  783 + if(status != APR_SUCCESS)
  784 + return;
  785 +
  786 + if(num>0)
  787 + {
  788 + int i;
  789 +
  790 + /* We have data to read */
  791 + for(i=0; i< num; i++)
  792 + {
  793 + apr_socket_t *client, *server;
  794 + apr_sockaddr_t *remotesa = NULL;
  795 + char *protocol, remoteip[256];
  796 + apr_ipsubnet_t *ipsub;
  797 + char buf[max_udp_message_len];
  798 + apr_size_t len = max_udp_message_len;
  799 + apr_pool_t *client_context = NULL;
  800 +
  801 + server = descs[i].desc.s;
  802 + /* We could also use the apr_socket_data_get/set() functions
  803 + * to have per socket user data .. see APR docs */
  804 + protocol = descs[i].client_data;
  805 +
  806 + /* Create a context for the client connection */
  807 + apr_pool_create(&client_context, global_context);
  808 +
  809 + /* Accept the connection */
  810 + status = apr_accept(&client, server, client_context);
  811 + if(status != APR_SUCCESS)
  812 + {
  813 + goto close_accept_socket;
  814 + }
  815 +
  816 + apr_socket_addr_get(&remotesa, APR_REMOTE, client);
  817 + /* This function is in ./lib/apr_net.c and not APR. The
  818 + * APR counterpart is apr_sockaddr_ip_get() but we don't
  819 + * want to malloc memory evertime we call this */
  820 + apr_sockaddr_ip_buffer_get(remoteip, 256, remotesa);
  821 +
  822 + /* Check the ACL (we can make this better later) */
  823 + ipsub = ((apr_ipsubnet_t **)(tcp_accept_acl_array->elts))[i];
  824 + if(ipsub)
  825 + {
  826 + if(!apr_ipsubnet_test( ipsub, remotesa))
  827 + {
  828 + debug_msg("Ignoring connection from %s\n", remoteip);
  829 + goto close_accept_socket;
  830 + }
  831 + }
  832 +
  833 + /* At this point send data over the socket */
  834 + if(!strcasecmp(protocol, "xml"))
  835 + {
  836 + apr_status_t status;
  837 + apr_hash_index_t *hi, *metric_hi;
  838 + void *val;
  839 +
  840 + /* Print the DTD, GANGLIA_XML and CLUSTER tags */
  841 + status = print_xml_header(client);
  842 + if(status != APR_SUCCESS)
  843 + goto close_accept_socket;
  844 +
  845 + /* Walk the host hash */
  846 + for(hi = apr_hash_first(client_context, hosts);
  847 + hi;
  848 + hi = apr_hash_next(hi))
  849 + {
  850 + apr_hash_this(hi, NULL, NULL, &val);
  851 + status = print_host_start(client, (Ganglia_host_data *)val);
  852 + if(status != APR_SUCCESS)
  853 + {
  854 + goto close_accept_socket;
  855 + }
  856 +
  857 + /* Send the metric info for this particular host */
  858 + for(metric_hi = apr_hash_first(client_context, ((Ganglia_host_data *)val)->metrics);
  859 + metric_hi;
  860 + metric_hi = apr_hash_next(metric_hi))
  861 + {
  862 + void *metric;
  863 + apr_hash_this(metric_hi, NULL, NULL, &metric);
  864 +
  865 +
  866 + }
  867 +
  868 + /* Close the host tag */
  869 + status = print_host_end(client);
  870 + if(status != APR_SUCCESS)
  871 + {
  872 + goto close_accept_socket;
  873 + }
  874 + }
  875 +
  876 + /* Close the CLUSTER and GANGLIA_XML tags */
  877 + print_xml_footer(client);
  878 + }
  879 +
  880 + /* Close down the accepted socket */
  881 + close_accept_socket:
  882 + apr_shutdown(client, APR_SHUTDOWN_READ);
  883 + apr_socket_close(client);
  884 + apr_pool_destroy(client_context);
  885 + }
  886 + }
  887 +}
  888 +
518 889 /* This function will send a datagram to every udp_send_channel specified */
519 890 static int
520 891 udp_send_message( char *buf, int len )
@@ -540,6 +911,12 @@ udp_send_message( char *buf, int len )
540 911 }
541 912 return num_errors;
542 913 }
  914 +
  915 +static int
  916 +tcp_send_message( char *buf, int len )
  917 +{
  918 + return 0;
  919 +}
543 920
544 921 int
545 922 process_collection_groups( void )
@@ -608,6 +985,7 @@ main ( int argc, char *argv[] )
608 985 if(!deaf)
609 986 {
610 987 setup_udp_recv_pollset();
  988 + setup_tcp_accept_pollset();
611 989 }
612 990
613 991 if(!mute)
@@ -618,20 +996,18 @@ main ( int argc, char *argv[] )
618 996 /* Create the host hash table */
619 997 hosts = apr_hash_make( global_context );
620 998
621   - udp_send_message("This is a test remove me later", 15);
622   -
623 999 next_collection = 0;
624 1000 for(;;)
625 1001 {
626 1002 now = apr_time_now();
627 1003 stop = now + (next_collection* APR_USEC_PER_SEC);
628 1004 /* Read data until we need to collect/write data */
629   - for(; now < stop ; )
  1005 + for(; now < stop ;)
630 1006 {
631 1007 if(!deaf)
632 1008 {
  1009 + poll_tcp_accept_channels(0);
633 1010 poll_udp_recv_channels(stop - now);
634   - /* accept_tcp_connections... */
635 1011 }
636 1012 now = apr_time_now();
637 1013 }
1  monitor-core/gmond/gmond.conf
@@ -3,6 +3,7 @@ behavior {
3 3 user = nobody
4 4 }
5 5 udp_send_channel {
  6 + ip = 239.2.11.71
6 7 port = 8649
7 8 }
8 9 udp_recv_channel {
2  monitor-core/lib/apr_net.c
@@ -151,7 +151,7 @@ create_udp_server(apr_pool_t *context, apr_port_t port, char *bind)
151 151 }
152 152
153 153 apr_socket_t *
154   -create_tcp_server(apr_pool_t *context, apr_port_t port, char *bind)
  154 +create_tcp_server(apr_pool_t *context, apr_port_t port, char *bind, char *interface)
155 155 {
156 156 apr_socket_t *sock = create_net_server(context, SOCK_STREAM, port, bind);
157 157 if(!sock)
3  monitor-core/lib/apr_net.h
@@ -16,5 +16,8 @@ apr_sockaddr_ip_buffer_get(char *addr, int len, apr_sockaddr_t *sockaddr);
16 16 apr_socket_t *
17 17 create_mcast_server(apr_pool_t *context, char *mcast_ip, apr_port_t port, char *bind, char *interface);
18 18
  19 +apr_socket_t *
  20 +create_tcp_server(apr_pool_t *context, apr_port_t port, char *bind, char *interface);
  21 +
19 22
20 23 #endif
28 monitor-core/lib/protocol.x
@@ -2,7 +2,7 @@ enum Ganglia_value_types {
2 2 GANGLIA_VALUE_UNKNOWN,
3 3 GANGLIA_VALUE_STRING,
4 4 GANGLIA_VALUE_UNSIGNED_SHORT,
5   - GANGLIA_VALUE_SIGNED_SHORT,
  5 + GANGLIA_VALUE_SHORT,
6 6 GANGLIA_VALUE_UNSIGNED_INT,
7 7 GANGLIA_VALUE_INT,
8 8 GANGLIA_VALUE_FLOAT,
@@ -12,10 +12,18 @@ enum Ganglia_value_types {
12 12 typedef string varstring<>;
13 13
14 14 union Ganglia_value switch(Ganglia_value_types type) {
  15 + case GANGLIA_VALUE_UNKNOWN:
  16 + void;
15 17 case GANGLIA_VALUE_STRING:
16 18 string str<>;
  19 + case GANGLIA_VALUE_UNSIGNED_SHORT:
  20 + unsigned short u_short;
  21 + case GANGLIA_VALUE_SHORT:
  22 + short s_short;
  23 + case GANGLIA_VALUE_UNSIGNED_INT:
  24 + unsigned int u_int;
17 25 case GANGLIA_VALUE_INT:
18   - int i;
  26 + int s_int;
19 27 case GANGLIA_VALUE_FLOAT:
20 28 float f;
21 29 case GANGLIA_VALUE_DOUBLE:
@@ -50,12 +58,12 @@ enum Ganglia_data_state {
50 58 GANGLIA_METRIC_UNKNOWN_OLD_FORMAT
51 59 };
52 60
53   -struct Ganglia_message_header {
  61 +struct Ganglia_message_header_26 {
54 62 Ganglia_hostinfo *host;
55 63 Ganglia_msginfo *msg;
56 64 };
57 65
58   -struct Ganglia_message_body {
  66 +struct Ganglia_message_body_26 {
59 67 unsigned int source_instance;
60 68 Ganglia_data_state state;
61 69 unsigned int age;
@@ -64,9 +72,9 @@ struct Ganglia_message_body {
64 72 Ganglia_metric metrics<>;
65 73 };
66 74
67   -struct Ganglia_format_1 {
68   - Ganglia_message_header *hdr;
69   - Ganglia_message_body *bdy;
  75 +struct Ganglia_format_26 {
  76 + Ganglia_message_header_26 *hdr;
  77 + Ganglia_message_body_26 *bdy;
70 78 };
71 79
72 80 /* 2.5.x compatibility..... */
@@ -119,7 +127,7 @@ enum Ganglia_message_formats {
119 127 metric_part_max_used,
120 128 GANGLIA_NUM_OLD_METRICS, /* this should always directly follow the last metric_* */
121 129
122   - GANGLIA_FORMAT_1 = 2874789, /* give a little space for old metrics in case they are modified */
  130 + GANGLIA_FORMAT_26 = 2874789, /* give a little space for old metrics in case they are modified */
123 131
124 132 /* insert new formats here. */
125 133
@@ -127,8 +135,8 @@ enum Ganglia_message_formats {
127 135 };
128 136
129 137 union Ganglia_message switch (Ganglia_message_formats format) {
130   - case GANGLIA_FORMAT_1:
131   - Ganglia_format_1 *format_1;
  138 + case GANGLIA_FORMAT_26:
  139 + Ganglia_format_26 *format_26;
132 140
133 141 /* 2.5.x sources... */
134 142 case metric_user_defined:
3  monitor-core/srclib/libmetrics/libmetrics.h
@@ -133,6 +133,8 @@ typedef union {
133 133 #ifdef OSF
134 134 #endif
135 135
  136 +#if 0
  137 +/* THIS IS NOT NECESSARY ANYMORE */
136 138 enum {
137 139 user_defined,
138 140 /*
@@ -215,5 +217,6 @@ enum {
215 217 #endif
216 218 num_key_metrics
217 219 } key_metrics;
  220 +#endif
218 221
219 222 #endif /* LIBMETRICS_H */

0 comments on commit 55e39e4

Please sign in to comment.
Something went wrong with that request. Please try again.