Problems with HEX Values from SAN Switch

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

deepsys
Posts: 13
Joined: Thu Apr 29, 2010 5:27 am
Location: Germany

Problems with HEX Values from SAN Switch

Post by deepsys »

Hello,

i try to monitor our Qlogic Fibre Channel Blade Switch with cacti.
At the moment i get values from up to 600 PBits/second or 0 bits/second, but this can't be real.

Then i tried to query the Total Errors, from the Debug log everthings looks ok:
07/27/2011 12:45:30 PM - CMDPHP: Poller[0] Host[65] DS[1131] SNMP: v1: fcBC01, dsname: TotalErrors, oid: .1.3.6.1.3.94.4.5.1.3.16.0.0.192.221.13.154.63.0.0.0.0.0.0.0.0.18, output: 00:00:00:00:00:00:00:94
(Hex 94 = Dec 148)
But cacti & rrd means only 0 Total Errors.

Before i edited lib/functions.php Line 903 (added : ):
return preg_match('/^[a-fA-F0-9: \t]*$/', $hexstr);
i get everytime an WARNING: Poller Output Table not Empty.

With this patch i get no Warning, but the values are not correct.
At the moment i have no ideas more :-(

Thanks for your help!
Attachments
FC_TotalErrors.JPG
FC_TotalErrors.JPG (29.42 KiB) Viewed 3929 times
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Problems with HEX Values from SAN Switch

Post by noname »

deepsys wrote: Before i edited lib/functions.php Line 903 (added : ):
return preg_match('/^[a-fA-F0-9: \t]*$/', $hexstr);
i get everytime an WARNING: Poller Output Table not Empty.
is_hexadecimal() function (= you modified) is used in 'lib/poller.php'.

Code: Select all

function process_poller_output(&$rrdtool_pipe, $remainder = FALSE) {
        ...

        /* single one value output */
        if ((is_numeric($value)) || ($value == "U")) {
                $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = $value;
        /* special case of one value output: hexadecimal to decimal conversion */
        }elseif (is_hexadecimal($value)) {
                /* attempt to accomodate 32bit and 64bit systems */
                $value = str_replace(' ', '', $value);
                if (strlen($value) <= 8 || ((2147483647+1) == intval(2147483647+1))) {
                        $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = hexdec($value);
                }elseif (function_exists("bcpow")) {
                        $dec = 0;
                        $vallen = strlen($value);
                        for ($i = 1; $i <= $vallen; $i++) {
                                $dec = bcadd($dec, bcmul(strval(hexdec($value[$i - 1])), bcpow('16', strval($vallen - $i))));
                        }
                        $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = $dec;
                }else{
                        $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = "U";
                }
        /* multiple value output */
        }else{
                ...
NOTE: 2147483647 = "7FFFFFFF" (signed 32-bit maximum value)

Some BC Math functions (bcpow, bcadd, bcmul) are using, but..
http://www.php.net/manual/en/bc.install ... uote]These functions are only available if PHP was configured with --enable-bcmath .[/quote]

BTW,
they say that hexdec() can handle large number since PHP 4.1.0.
% php -r 'echo hexdec("FF:FF:FF:FF:FF:FF:FF:FF");'
1.844674407371E+19
Try to modify the above part as follows:

Code: Select all

        /* special case of one value output: hexadecimal to decimal conversion */
        }elseif (is_hexadecimal($value)) {
                $value = str_replace(' ', '', $value);
                $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = hexdec($value);
        /* multiple value output */
        }else{
                ...
But I'm not sure the side effect of this change. Please at your own risks.
deepsys
Posts: 13
Joined: Thu Apr 29, 2010 5:27 am
Location: Germany

Re: Problems with HEX Values from SAN Switch

Post by deepsys »

Hello noname,

thanks!!

Your solution works for the Total Errors (and i have changed the Data Source Type to GAUGE).
Now i have the correct values

But the other interfaces have still PB or nothing, see attached.

Some words to my system:
- Debian Lenny 32bit (or do i need a 64bit System?)
- PHP 5.2.6-1+lenny13 with Suhosin-Patch 0.9.6.2 (cli) - included bcmath

Any other idea?

Thanks!
Attachments
FC_Interface.JPG
FC_Interface.JPG (39.92 KiB) Viewed 3921 times
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Problems with HEX Values from SAN Switch

Post by noname »

I'm not sure about that device, but according to QLogic SNMP Reference Guide...
[Fibre Alliance MIB Objects] - [Port Statistics Table]

connUnitPortStatCountError (1.3.6.1.3.94.4.5.1.3)
A count of the errors that have occurred on this port.

Syntax: OCTET STRING (SIZE (8))
Access: read-only
Status: mandatory
Return Value: A hexidecimal value indicating the total number of errors for a port.
It is said "total number", so its "Data Source Type" should be COUNTER (not GAUGE) ?
And, what about other interfaces?


BTW, other user also created template for similar device:
http://forums.cacti.net/viewtopic.php?f=21&t=31681
deepsys
Posts: 13
Joined: Thu Apr 29, 2010 5:27 am
Location: Germany

Re: Problems with HEX Values from SAN Switch

Post by deepsys »

Hallo noname,

thanks for your help.

I tried the other 10 ports and form 4 ports i get correct values (using GAUGE), and from 6 ports wrong (using GAUGE too), ?!?!??!

Then i looked to the poller output and can't understand it:
07/29/2011 08:30:33 AM - CMDPHP: Poller[0] Host[65] DS[1135] SNMP: v1: fcBC01, dsname: TotalErrors, oid: .1.3.6.1.3.94.4.5.1.3.16.0.0.192.221.13.154.63.0.0.0.0.0.0.0.0.18, output: 00:00:00:00:00:00:00:94
07/29/2011 08:30:33 AM - CMDPHP: Poller[0] Host[65] DS[1137] SNMP: v1: fcBC01, dsname: TotalErrors, oid: .1.3.6.1.3.94.4.5.1.3.16.0.0.192.221.13.154.63.0.0.0.0.0.0.0.0.19, output: 00:00:00:00:00:00:00:8

4 times i get correct hex-values and 6 times i get wrong = missing one digit (?)

Then i make a snmpwalk:
SNMPv2-SMI::experimental.94.4.5.1.3.16.0.0.192.221.13.154.63.0.0.0.0.0.0.0.0.18 = Hex-STRING: 00 00 00 00 00 00 00 94
SNMPv2-SMI::experimental.94.4.5.1.3.16.0.0.192.221.13.154.63.0.0.0.0.0.0.0.0.19 = Hex-STRING: 00 00 00 00 00 00 00 8C
This is correct!!

How could this happens??

And i have found another post with the same PB Problem:
http://forums.cacti.net/viewtopic.php?f ... 5&start=75

Thanks !
deepsys
Posts: 13
Joined: Thu Apr 29, 2010 5:27 am
Location: Germany

Re: Problems with HEX Values from SAN Switch

Post by deepsys »

Hello,

i have found something:
If that last hex-value is a character (a-f) then poller cuts it !!!

One Moment, could it be that my modification at the functions.php make this issue ....
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Problems with HEX Values from SAN Switch

Post by noname »

deepsys wrote:i have found something:
If that last hex-value is a character (a-f) then poller cuts it !!!
Probably it's this bug:
- http://bugs.cacti.net/view.php?id=1876

You can modify 'lib/functions.php' in current (0.8.7g) Cacti.

Code: Select all

function strip_quotes($result) {
        /* first strip all single and double quotes from the string */
        $result = trim(trim($result), "'\"");

        /* clean off ugly non-numeric data */
        if ((!is_numeric($result)) && ($result != "U")) {
                $len = strlen($result);
                for($a=$len-1; $a>=0; $a--){
                        $p = ord($result[$a]);
                        if (($p > 47) && ($p < 58)) {
                                $result = substr($result,0,$a+1);
                                break;
                        }
                }
        }

        return($result);
}
to
if ((!is_numeric($result)) && (!is_hexadecimal($result)) && ($result != "U")) {
and
if ((($p > 47) && ($p < 58)) || ($p==85)) {
deepsys
Posts: 13
Joined: Thu Apr 29, 2010 5:27 am
Location: Germany

Re: Problems with HEX Values from SAN Switch

Post by deepsys »

No, still the same problem and Poller Output Table not Empty :-)

07/29/2011 09:00:32 AM - CMDPHP: Poller[0] Host[65] DS[1135] SNMP: v1: fcBC01, dsname: TotalErrors, oid: .1.3.6.1.3.94.4.5.1.3.16.0.0.192.221.13.154.63.0.0.0.0.0.0.0.0.18, output: 00:00:00:00:00:00:00:94
07/29/2011 09:00:32 AM - CMDPHP: Poller[0] Host[65] DS[1137] SNMP: v1: fcBC01, dsname: TotalErrors, oid: .1.3.6.1.3.94.4.5.1.3.16.0.0.192.221.13.154.63.0.0.0.0.0.0.0.0.19, output: 00:00:00:00:00:00:00:8
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Problems with HEX Values from SAN Switch

Post by noname »

Try 'Console -> System Utilities -> Rebuild Poller Cache'.
deepsys
Posts: 13
Joined: Thu Apr 29, 2010 5:27 am
Location: Germany

Re: Problems with HEX Values from SAN Switch

Post by deepsys »

Yeah !! It works (Total Errors) !!! :D

Thanks a lot !!!

Lets wait some poller intervals to see what happens with my PB Traffic ....
Attachments
FC_TotalErrors-01.JPG
FC_TotalErrors-01.JPG (28.92 KiB) Viewed 3915 times
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Problems with HEX Values from SAN Switch

Post by noname »

deepsys wrote:Lets wait some poller intervals to see what happens with my PB Traffic ....
One suggestion for abnormal spike: Set limitation in the RRD (and Data Template)
- http://forums.cacti.net/viewtopic.php?p=202661#p202661
deepsys
Posts: 13
Joined: Thu Apr 29, 2010 5:27 am
Location: Germany

Re: Problems with HEX Values from SAN Switch

Post by deepsys »

Good Morning !!!

Yes, i have correct values for traffic !!
Thanks a lot noname!!

Here is my solution:
- I use the fca_san.xml from toe_cutter ( http://forums.cacti.net/viewtopic.php?f=12&t=31594 )
- Add ":" at lib/functions.php; my first post at this threat and http://forums.cacti.net/viewtopic.php?f ... 5&start=75 ; Thanks to Bernd!!
- delete lines from lib/poller.php ; nonames first post at this threat ; Thanks to noname!!
- change lib/functions.php; see above solution from noname and http://bugs.cacti.net/view.php?id=1876 ; Thanks to noname!!
- Use Data Source Type Counter for traffic and Gauge for Errors
- Be Happy !
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Problems with HEX Values from SAN Switch

Post by noname »

Good afternoon from Japan.

I'm glad to hear that.
Cheers :)
deepsys
Posts: 13
Joined: Thu Apr 29, 2010 5:27 am
Location: Germany

Re: Problems with HEX Values from SAN Switch

Post by deepsys »

Good morning from germany!

Some more infos from diff:

/lib/functions-php:

Code: Select all

diff functions_org.php functions.php
884c884
<       if ((!is_numeric($result)) && ($result != "U")) {
---
>       if ((!is_numeric($result))&&(!is_hexadecimal($result)) && ($result != "U")) {
888c888
<                       if (($p > 47) && ($p < 58)) {
---
>                       if ((($p > 47) && ($p < 58))||($p==85)) {
903c903
<       return preg_match('/^[a-fA-F0-9 \t]*$/', $hexstr);
---
>       return preg_match('/^[a-fA-F0-9: \t]*$/', $hexstr);
/lib/poller.php:

Code: Select all

diff poller_org.php poller.php
286,297c286
<                               if (strlen($value) <= 8 || ((2147483647+1) == intval(2147483647+1))) {
<                                       $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = hexdec($value);
<                               }elseif (function_exists("bcpow")) {
<                                       $dec = 0;
<                                       $vallen = strlen($value);
<                                       for ($i = 1; $i <= $vallen; $i++) {
<                                               $dec = bcadd($dec, bcmul(strval(hexdec($value[$i - 1])), bcpow('16', strval($vallen - $i))));
<                                       }
<                                       $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = $dec;
<                               }else{
<                                       $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = "U";
<                               }
---
>                               $rrd_update_array{$item["rrd_path"]}["times"][$unix_time]{$item["rrd_name"]} = hexdec($value);

kbartoletta
Cacti User
Posts: 146
Joined: Tue Oct 04, 2005 4:20 pm
Location: suwanee, ga
Contact:

Re: Problems with HEX Values from SAN Switch

Post by kbartoletta »

Hey Folks,

I typically hate to post on such at old posting...but I dont seem to understand this problem.
My issues is that i have two different cacti servers.. polling the same Qlogic FC switches...

ServerA is running Version 0.8.7g along with spine....and returns the FC traffic information with no problem....

Code: Select all

12/20/2012 03:35:04 PM - SPINE: Poller[0] Host[127] Description[LXTR4500-FC1] TH[1] DS[3668] Graphs['LXTR4500-FC1 FCSW Traffic: Port1'] SNMP: v2: x.x.x.x, dsname: BytesOutput, oid: .1.3.6.1.3.94.4.5.1.6.16.0.0.192.221.25.129.133.0.0.0.0.0.0.0.0.2, value: 4571084  
12/20/2012 03:35:04 PM - SPINE: Poller[0] Host[127] Description[LXTR4500-FC1] TH[1] DS[3660] Graphs['LXTR4500-FC1 FCSW Traffic: Port4'] SNMP: v2: x.x.x.x, dsname: BytesInput, oid: .1.3.6.1.3.94.4.5.1.7.16.0.0.192.221.25.129.133.0.0.0.0.0.0.0.0.5, value: 0   

ServerB is running Version 0.8.7i and was initially using the native poller....because I had read previous posts that seemed to indicates that changes had been made to spine to convert the hex output from the FC switch into decimal... I figured that was likely my problem and I installed spine on this server....

Code: Select all

12/20/2012 03:40:01 PM - SPINE: Poller[0] Host[31] Description[| CCUR | LXTR4500-FC2 |] TH[1] DS[275] Graphs['| CCUR | LXTR4500-FC2 | FCSW Traffic: Port3'] SNMP: v2: x.x.x.x, dsname: BytesInput, oid: .1.3.6.1.3.94.4.5.1.7.16.0.0.192.221.25.129.121.0.0.0.0.0.0.0.0.4, value: 00 00 00 00 02 76 CE 64  
12/20/2012 03:40:01 PM - SPINE: Poller[0] Host[31] Description[| CCUR | LXTR4500-FC2 |] TH[1] DS[276] Graphs['| CCUR | LXTR4500-FC2 | FCSW Traffic: Port14'] SNMP: v2: x.x.x.x, dsname: BytesInput, oid: .1.3.6.1.3.94.4.5.1.7.16.0.0.192.221.25.129.121.0.0.0.0.0.0.0.0.15, value: 00 00 00 00 00 00 00 00  
I am trying to figure out why this output seems to be handled by ServerA and not by ServerB... especially considering that serverA is on an older version....

Reading this post, I see that some modifications were manually made to functions.php... is that still necessary 2 years later?
Any help would be greatly appreciated

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests