Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri May 26, 2017 1:53 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Spine 0.8.7g (both SVN 6232 and stable): numeric/alpha issue
PostPosted: Wed Jan 19, 2011 10:12 am 
Offline

Joined: Wed Jan 19, 2011 6:23 am
Posts: 2
*** UPDATED *** : changed the way to solve the issue

Hi folks... first post here

i have a problem with some data sources when migrating from spine 0.8.7e to 0.8.7g (both stable and unstable):


with spine 0.8.7e:
Code:
01/19/2011 03:55:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5642] SNMP: v1: 192.168.0.192, dsname: bladecent_plus5V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.1.0, value: +4.84 
01/19/2011 03:55:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5641] SNMP: v1: 192.168.0.192, dsname: bladecent_plus33V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.2.0, value: +3.26 
01/19/2011 03:55:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5640] SNMP: v1: 192.168.0.192, dsname: bladecent_plus25V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.6.0, value: +2.47 
01/19/2011 03:55:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5639] SNMP: v1: 192.168.0.192, dsname: bladecent_plus12V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.3.0, value: +11.85 
01/19/2011 03:55:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5638] SNMP: v1: 192.168.0.192, dsname: bladecent_plus18V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.8.0, value: +1.76 
01/19/2011 03:55:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5637] SNMP: v1: 192.168.0.192, dsname: bladecent_therm_out, oid: .1.3.6.1.4.1.2.3.51.2.2.10.5.1.3.0, value: 2845.608000 



with spine 0.8.7g:
Code:
01/19/2011 04:00:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5642] SNMP: v1: 192.168.0.192, dsname: bladecent_plus5V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.1.0, value: +4.84 Volts 
01/19/2011 04:00:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5641] SNMP: v1: 192.168.0.192, dsname: bladecent_plus33V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.2.0, value: +3.26 Volts 
01/19/2011 04:00:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5640] SNMP: v1: 192.168.0.192, dsname: bladecent_plus25V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.6.0, value: +2.47 Volts 
01/19/2011 04:00:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5639] SNMP: v1: 192.168.0.192, dsname: bladecent_plus12V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.3.0, value: +11.85 Volts 
01/19/2011 04:00:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5638] SNMP: v1: 192.168.0.192, dsname: bladecent_plus18V, oid: .1.3.6.1.4.1.2.3.51.2.2.2.1.8.0, value: +1.76 Volts 
01/19/2011 04:00:05 PM - SPINE: Poller[0] Host[78] TH[1] DS[5637] SNMP: v1: 192.168.0.192, dsname: bladecent_therm_out, oid: .1.3.6.1.4.1.2.3.51.2.2.10.5.1.3.0, value: 2845.608000 BTU/hour 


Same problem with spine 0.8.7g svn/branch/revision 6184, 6232


I think the problem is the function is_numeric ( inside util.c ) because the strings "+4.84 Volts" "2845.608000 BTU/hour" are detected as "numeric", then inside poller.c the function strip_alpha is not called. The following is an excerpt from poller.c; see rows marked with "**** HERE ****" :

Code:
         if (num_oids >= host->max_oids) {
               snmp_get_multi(host, snmp_oids, num_oids);

               for (j = 0; j < num_oids; j++) {
                  if (host->ignore_host) {
                     SPINE_LOG(("Host[%i] TH[%i] DS[%i] WARNING: SNMP timeout detected [%i ms], ignoring host '%s'", host_id, host_thread, poller_items[snmp_oids[j].array_position].local_data_id, host->snmp_timeout, host->hostname));
                     SET_UNDEFINED(snmp_oids[j].result);
**** HERE ****            }else if (is_numeric(snmp_oids[j].result)) || (is_multipart_output(snmp_oids[j].result))) {
                     /* continue */
                  }else if (is_hexadecimal(snmp_oids[j].result, TRUE)) {
                     snprintf(snmp_oids[j].result, RESULTS_BUFFER, "%lld", hex2dec(snmp_oids[j].result));
                  }else if ((STRIMATCH(snmp_oids[j].result, "U")) ||
                     (STRIMATCH(snmp_oids[j].result, "Nan"))) {
                     /* is valid output, continue */
                  }else{
                     /* remove double or single quotes from string */
**** HERE ****               snprintf(temp_result, RESULTS_BUFFER, "%s", strip_alpha(trim(snmp_oids[j].result)));
                     snprintf(snmp_oids[j].result , RESULTS_BUFFER, "%s", temp_result);

                     /* detect erroneous non-numeric result */
                     if (!validate_result(snmp_oids[j].result)) {
                        SET_UNDEFINED(snmp_oids[j].result);
                     }
                  }


Then i rewrote is_numeric with a different parsing algorithm... it works but is slower :(

Code:
/*! \fn int is_numeric(const char *string)
*  \brief check to see if a string is long or double
*  \param string the string to check
*
*  \return TRUE if long or double, FALSE if not
*
*/
int is_numeric(const char *string) {

   if ( *string == '\0' ) {
   /* empty string is not numeric */
  return FALSE;
  } else if ( (*string == '+') || (*string == '-') ) {
     /* skip leading plus or minus */
    string++;
     /* string with only plus or minus is not numeric */
     if ( *string == '\0' ) return FALSE;   
  }

   /* parse string until end (or string found) */
   while ( isdigit((int)*string) )
      string++;

   if ( *string == '\0' ) {
   /* found digits until the end */
  return TRUE;
  } else if ( *string == '.' ) {
     /* skip 'dot' */
    string++;
     /* 'dot' without trailing numbers is not numeric */
     if ( *string == '\0' ) return FALSE;   
  }

  /* parse string until end (or string found) */
   while ( isdigit((int)*string) )
      string++;

   return *string == '\0';
}


Did anybody experience same problem ?
Regards


Last edited by JAVAlina on Tue Jan 25, 2011 6:19 am, edited 7 times in total.

Top
 Profile  
 
 Post subject: Re: Spine 0.8.7g (both SVN 6184 and stable): strip_alpha iss
PostPosted: Fri Jan 21, 2011 3:37 am 
Offline

Joined: Wed Jan 19, 2011 6:23 am
Posts: 2
And this is my environment:
Code:
Cacti Version      0.8.7e
Cacti OS          unix
SNMP Version       NET-SNMP version: 5.3.2.2 
RRDTool Version       RRDTool 1.3.x 
Hosts          177
Graphs          3047
Data Sources       SNMP: 541
            SNMP Query: 2738
            Script - Script Server (PHP): 57
            Total: 3336

Poller Information
Interval         60
Type            spine
Items          Action[0]: 10494
            Action[2]: 56
            Total: 10550
Concurrent Processes   1
Max Threads      32
PHP Servers      4
Script Timeout      45
Max OID         1
Last Run Statistics   Time:17.7056 Method:spine Processes:1
            Threads:32 Hosts:172 HostsPerProcess:172
            DataSources:10550 RRDsProcessed:3295

PHP Information
PHP Version         5.1.6
PHP OS         Linux
PHP uname         Linux COS53-cacti 2.6.18-194.8.1.el5 #1
            SMP Thu Jul 1 19:07:06 EDT 2010 i686
PHP SNMP         Installed
max_execution_time   120
memory_limit      128M


Data sources with the above mentioned problem use a simple data template:

Data input method : Get SNMP Data
Data source type : GAUGE
OIDs are for an IBM Bladecenter H (i used the OIDs provided from IBM)

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group