All,

while I have not looked at the implementation, I'm just casting
my vote that this functionality would be handy for me. So
I would like to see something like this to roll into the cvs
tree at some point.

- richard

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Adeyemi Adesanya
Sent: 04 May 2006 23:43
To: matt massie
Cc: ganglia-developers@lists.sourceforge.net
Subject: Re: [Ganglia-developers] Host spoofing for SNMP



Hi Matt.

Thanks for responding. I was hoping you would pitch in! Your changes  
sound good to me. I'll cc the developers mailing list too.

-------
Yemi

On May 4, 2006, at 2:37 PM, matt massie wrote:

> yemi-
>
> awesome job on the spoof code.  very nice.
>
> i have a few tiny changes that i'd like to see if you don't mind
> (see below).
>
> this code is going to make A LOT of ganglia users happy.  it's the
> number one feature request right now.
>
> -matt
>
>
>
>> 26a27,33
>> > /* Yemi */
>> > struct Ganglia_spoof_message {
>> >   string spoofName<>;
>> >   string spoofIP<>;
>> >   struct Ganglia_gmetric_message gmetric;
>> > };
>> >
>> 95c102,104
>> <    GANGLIA_NUM_25_METRICS /* this should always directly follow  
>> the last 25 metric_* */
>> ---
>> >    GANGLIA_NUM_25_METRICS, /* this should always directly follow
>> the last 25 metric_* */
>> > /* Yemi */
>> >    spoof_metric
>
> please put a large number after spoof metric in order to allow more
> 25-style metrics to be added, e.g.
>
> spoof_metric = 4096
>
> otherwise we may have problem with compatibility in the future
> since 25-style metrics are put in _before_ the  
> GANGLIA_NUM_25_METRICS enum.
>
>
>> 100a110,112
>> > /* Yemi */
>> >   case spoof_metric:
>> >     Ganglia_spoof_message spmetric;
>> ===== Use the following to patch lib/libgmond.c ==========
>> 702a703,750
>> > // Yemi
>> > int
>> > Ganglia_gmetric_send_spoof( Ganglia_gmetric gmetric,  
>> Ganglia_udp_send_channels send_channels, char* spoof_info)
>> > {
>> >   int len;
>> >   XDR x;
>> >   char gmetricmsg[1500];
>
>
> please change the line above to be
>
> char gmetricmsg[GANGLIA_MAX_MESSAGE_LEN];
>
> to ensure you code will work with any changes in the future.
>
>
>> >   Ganglia_message msg;
>> >   char *spoofName;
>> >   char *spoofIP;
>> >   char *buff;
>> >   int spoof_info_len;
>> >   int result;
>> >
>> >   spoof_info_len = strlen(spoof_info);
>> >   buff = malloc(spoof_info_len+1);
>> >   strcpy(buff,spoof_info);
>> >   spoofIP = buff;
>> >   if( !(spoofName = strchr(buff+1,':')) ){
>> >       fprintf(stderr,"Incorrect format for spoof argument.  
>> exiting.\n");
>> >       exit(1);
>> >   }
>> >   *spoofName = 0;
>> >   spoofName++;
>> >   if(!(*spoofName)){
>> >       fprintf(stderr,"Incorrect format for spoof argument.  
>> exiting.\n");
>> >       exit(1);
>> >   }
>> >   printf(" spoofName: %s    spoofIP: %s \n",spoofName,spoofIP);
>> >
>> >   msg.id = spoof_metric;
>> >
>> >   msg.Ganglia_message_u.spmetric.spoofName = spoofName;
>> >   msg.Ganglia_message_u.spmetric.spoofIP = spoofIP;
>> >   msg.Ganglia_message_u.spmetric.gmetric = *(gmetric->msg);
>> >
>> >   // memcpy( &(msg.Ganglia_message_u.gmetric), gmetric->msg,  
>> sizeof(Ganglia_gmetric_message));
>> >
>> >   /* Send the message */
>> >   xdrmem_create(&x, gmetricmsg, 1500, XDR_ENCODE);
>>
>
> please change the constant 1500 to GANGLIA_MAX_MESSAGE_LEN as well.
>
>
>
>> >   xdr_Ganglia_message(&x, &msg);
>> >   len = xdr_getpos(&x);
>> >   result = Ganglia_udp_send_message( send_channels, gmetricmsg,  
>> len);
>> >   free(buff);
>> >   return result;
>> >
>> > }
>> >
>> ===== Use the following to patch lib/ganglia.h ==========
>> 60a61,62
>> > // Yemi
>> > int Ganglia_gmetric_send_spoof( Ganglia_gmetric gmetric,  
>> Ganglia_udp_send_channels send_channels, char* spoof_info);
>> ===== Use the following to patch gmond/gmond.c ==========
>> 581c581
>> <
>> ---
>> > // Yemi
>> 583c583
>> < Ganglia_host_get( char *remoteip, apr_sockaddr_t *sa,  
>> Ganglia_message *fullmsg)
>> ---
>> > Ganglia_host_get( char *remIP, apr_sockaddr_t *sa,  
>> Ganglia_message *fullmsg)
>> 589c589,590
>> <
>> ---
>> >   char *remoteip = remIP;
>> >
>> 593a595,599
>> >
>> >   if(fullmsg->id == spoof_metric){
>> >       hostname = fullmsg->Ganglia_message_u.spmetric.spoofName;
>> >       remoteip = fullmsg->Ganglia_message_u.spmetric.spoofIP;
>> >   }
>> 741a748,756
>> > // Yemi
>> > static Ganglia_metric *
>> > Ganglia_message_find_spmetric( Ganglia_host *host,  
>> Ganglia_message *message)
>> > {
>> >   /* Keyed on the name element of the gmetric sent */
>> >   return (Ganglia_metric *)apr_hash_get( host->gmetrics,
>> >                                  message- 
>> >Ganglia_message_u.spmetric.gmetric.name,
>> >                                  APR_HASH_KEY_STRING);
>> > }
>> 756c771
>> <
>> ---
>> >
>> 764a780,784
>> >   // Yemi
>> >   else if(message->id == spoof_metric)
>> >     {
>> >       metric = Ganglia_message_find_spmetric( host, message);
>> >     }
>> 787a808,812
>> >       // Yemi
>> >       if(message->id == spoof_metric)
>> >       {
>> >         metric->name = apr_pstrdup( metric->pool, message- 
>> >Ganglia_message_u.spmetric.gmetric.name );
>> >       }
>> 796c821,823
>> <   memcpy(&(metric->message), message, sizeof(Ganglia_message));
>> ---
>> >   // Yemi
>> >   if(message->id == spoof_metric){
>> >     // Store data as regular gmetric in hash table!!
>> 798c825,833
>> <   if(message->id == metric_user_defined)
>> ---
>> >       metric->message.id = metric_user_defined;
>> >       metric->message.Ganglia_message_u.gmetric = message- 
>> >Ganglia_message_u.spmetric.gmetric;
>> >
>> >
>> >   }else{
>> >       memcpy(&(metric->message), message, sizeof(Ganglia_message));
>> >   }
>> >
>> >   if(message->id == metric_user_defined || message->id ==  
>> spoof_metric)
>> ===== Use the following to patch gmetric/gmetric.c ==========
>> 75c75,81
>> <   rval = Ganglia_gmetric_send(gmetric, send_channels);
>> ---
>> >   //Yemi
>> >   if(!strlen(args_info.spoof_arg))
>> >     {
>> >       rval = Ganglia_gmetric_send(gmetric, send_channels);
>> >     }else{
>> >       rval = Ganglia_gmetric_send_spoof(gmetric,  
>> send_channels,args_info.spoof_arg);
>> >     }
>> ==== end of patches =======
>>
>> -------------------------------------------------------
>> Using Tomcat but need to do more? Need to support web services,  
>> security?
>> Get stuff done quickly with pre-integrated technology to make your  
>> job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
>> Geronimo
>> http://sel.as-us.falkag.net/sel? 
>> cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Ganglia-developers mailing list
>> Ganglia-developers@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ganglia-developers
>
> --
> [EMAIL PROTECTED]
>   http://massie.us
>
>
>



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers
------------------------------------------------------------------------
For more information about Barclays Capital, please visit our web site at 
http://www.barcap.com.

Internet communications are not secure and therefore the Barclays Group does 
not accept legal responsibility for the contents of this message.  Although the 
Barclays Group operates anti-virus programmes, it does not accept 
responsibility for any damage whatsoever that is caused by viruses being 
passed.  Any views or opinions presented are solely those of the author and do 
not necessarily represent those of the Barclays Group.  Replies to this email 
may be monitored by the Barclays Group for operational or business reasons.
------------------------------------------------------------------------

Reply via email to