Improved Cisco CPU Utilization Script Query

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

commoboy
Posts: 6
Joined: Mon Mar 21, 2005 1:46 pm
Location: Seattle
Contact:

A little nagging issue

Post by commoboy »

I didn't have any problem getting this script installed or the template imported. However, i am not getting any usable data. When I run a verbose query I get the following;

Code: Select all

+ Running data query [10].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/cisco_cpu_util.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /usr/share/cacti/site/scripts/cisco_cpu_util.php 69.77.183.62 IntelliOne 2 161 500 "" "" index'
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/cisco_cpu_util.php 69.77.183.62 IntelliOne 2 161 500 "" "" query index'
+ Found item [cpuName='No_Such_Instance_currently_exists_at_this_OID'] index: No_Such_Instance_currently_exists_at_this_OID
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/cisco_cpu_util.php 69.77.183.62 IntelliOne 2 161 500 "" "" query cpuIndex'
+ Found item [cpuIndex='1'] index: No_Such_Instance_currently_exists_at_this_OID
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/cisco_cpu_util.php 69.77.183.62 IntelliOne 2 161 500 "" "" query physIndex'
+ Found item [physIndex='0'] index: No_Such_Instance_currently_exists_at_this_OID
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/cisco_cpu_util.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/cisco_cpu_util.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/cisco_cpu_util.xml'

Notice the message No_Such_Instance_currently_exists_at_this_OID. This should look like a familiar message as it is returned when you perform a query on an invalid/non-existent OID. However, in this case I can perform an snmpwalk on each of the OIDs in the script and get a successful response. I'm assuming there is an issue within the handoff of the OIDs somewhere in the process and the string is getting munged.

Has anyone else run into this?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

_CL: Big thanks for the SS_ script! I just converted my cacti server from an standard script to the SS and experianced a 600% speed improvement -- it was only 25 data sources too!

commoboy: Your device doesnt appear to support the CISCO-PROCESS-MIB.
Christian
Posts: 46
Joined: Thu Feb 14, 2008 4:24 am
Location: Oelde/Gütersloh, NRW, Germany

Post by Christian »

_CL wrote:
Gorbachov wrote:Someone any luck on using this graphs for an ASA 5510?
Here are the OIDs used by the script. Are you able to walk these values?

Code: Select all

.1.3.6.1.4.1.9.9.109.1.1.1.1.2  # cpmCPUTotalPhysicalIndex
.1.3.6.1.2.1.47.1.1.1.1.7       # entPhysicalName
.1.3.6.1.4.1.9.9.109.1.1.1.1.6  # cpmCPUTotal5secRev
.1.3.6.1.4.1.9.9.109.1.1.1.1.7  # cpmCPUTotal1minRev
.1.3.6.1.4.1.9.9.109.1.1.1.1.8  # cpmCPUTotal5minRev
They should work. I checked ftp://ftp-sj.cisco.com/pub/mibs/support ... tlist.html and both the ENTITY-MIB and CISCO-PROCESS-MIB are supported by the ASA.
Hi,

the Cisco ASAs don't support these MIBs, have a look at this page: http://www.cisco.com/en/US/docs/securit ... admin.html. Look for these lines:
The security appliance does not support the following new MIB objects in the cpmCPUTotalTable:
•cpmCPUTotal5secRev
•cpmCPUTotal1minRev
•cpmCPUTotal5minRev
Can you please also support the deprecated MIB objects
  • cpmCPUTotal5sec
    cpmCPUTotal1min
    cpmCPUTotal5min?
That'd make the ASAs work with your script. Otherwise it's already very good.
cacti: 0.8.7g
spine: 0.8.7g
plugins:
specs: 2xIntel Xeon @ 2.40GHz | 6GiB RAM | CentOS 5.5 | PHP 5.1.6 | MySQL 5.0.77 | RRDTool 1.4.4 | Apache/2.2.3
Christian
Posts: 46
Joined: Thu Feb 14, 2008 4:24 am
Location: Oelde/Gütersloh, NRW, Germany

Post by Christian »

Hi,

I got the script running using the deprecated OIDs, too. Have a look at my lousy modification. I replaced lines 173 and 174 with these lines:

Code: Select all

        if(preg_match('/^\d+/', $value, $match) == 0)
        {
                if($oids[$query_field] == ".1.3.6.1.4.1.9.9.109.1.1.1.1.6"){
                        $oids[$query_field] = ".1.3.6.1.4.1.9.9.109.1.1.1.1.3";
                        #print "cpuFiveSecOid\n";
                }

                if($oids[$query_field] == ".1.3.6.1.4.1.9.9.109.1.1.1.1.7"){
                        $oids[$query_field] = ".1.3.6.1.4.1.9.9.109.1.1.1.1.4";
                        #print "cpuOneMinOid\n";
                }

                if($oids[$query_field] == ".1.3.6.1.4.1.9.9.109.1.1.1.1.8"){
                        $oids[$query_field] = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5";
                        #print "cpuFiveMinOid\n";
                }

        $value = cacti_snmp_get(        $hostname, $snmp_community,
                                                $oids[$query_field] . "." . $oid_index,
                                $snmp_version, $snmp_user, $snmp_pw, "", "", "", "",
                                                $snmp_port, $snmp_timeout, $snmp_retries);
        preg_match('/^\d+/', $value, $match);
        #"cpuFiveSec"           => ".1.3.6.1.4.1.9.9.109.1.1.1.1.6",    # cpmCPUTotal5secRev
        #"cpuOneMin"            => ".1.3.6.1.4.1.9.9.109.1.1.1.1.7",    # cpmCPUTotal1minRev
        #"cpuFiveMin"           => ".1.3.6.1.4.1.9.9.109.1.1.1.1.8",    # cpmCPUTotal5minRev
        }


        print $match[0] . "\n";
So if the preg_match return 0 when there was no numeric result of the snmp query the OID just gets replaced by the deprecated one. The querey and the preg_match are run afterwards again.

It seems to work, but it also seems to me that this is not the best solution. Maybe you can come up with something less hacked :lol:
cacti: 0.8.7g
spine: 0.8.7g
plugins:
specs: 2xIntel Xeon @ 2.40GHz | 6GiB RAM | CentOS 5.5 | PHP 5.1.6 | MySQL 5.0.77 | RRDTool 1.4.4 | Apache/2.2.3
_CL
Posts: 39
Joined: Mon Feb 25, 2008 5:01 pm
Location: USA

Post by _CL »

Christian wrote: It seems to work, but it also seems to me that this is not the best solution. Maybe you can come up with something less hacked :lol:
Got your PM, Christian. My job has changed and I no longer work with Cacti. I'd try to help you out, but I am overloaded in my current job and don't have any time to spare. I am sorry.
CL
hayzey
Posts: 10
Joined: Tue Feb 19, 2013 7:04 pm

Re: Improved Cisco CPU Utilization Script Query

Post by hayzey »

Wow, solid script. I needed the same stats for 6500s and was fumbling my way through the PHP part. Thanks CL, wherever you are.

FYI I'm running Cacti 0.8.8a on CentOS 5.8, PHP 5.1.6.

Cheers,
Mark
Cisco CCIE #20571 R/S, Security
Kaktus
Posts: 14
Joined: Wed Oct 04, 2017 3:45 am

Re: Improved Cisco CPU Utilization Script Query

Post by Kaktus »

is this also aplicable fo Cacti 1.1.38 version?
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests