Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


[XML] Cisco NBAR Protocol Statistics Query 1.2a [UPDATED]
Goto page Previous  1, 2, 3, 4, 5, 6
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
MarsRover



Joined: 07 Oct 2009
Posts: 6

PostPosted: Wed Oct 07, 2009 3:32 pm    Post subject: Reply with quote

Is there a version of this script that works with Cacti 0.8.7? There are parts of the code that use SNMP v1 and 2, but newer version of Cacti require v3 commands, even if some areas are left blank. I'm currently unable to get the graph to create automatically and display data. If I create the graph manually, not data ever populates. I'm not seeing any errors in my cacti.log, even at debug levels.
Back to top
redk3y



Joined: 14 Oct 2009
Posts: 2

PostPosted: Wed Oct 14, 2009 8:49 am    Post subject: Reply with quote

I thought it was getting worked on at one point. I remember seeing a post saying "this is where someone else needs to take over". I am anxiously awaiting the ability to graph my nbar stats again....if anyone has come up with a solid solution in 0.8.7, please post!
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 300
Location: Bristol, England

PostPosted: Wed Oct 14, 2009 8:58 am    Post subject: Reply with quote

Hi

Take a look at

http://forums.cacti.net/viewtopic.php?t=23932

You will also need to update

I added the following line into ss_nbar_all.php:
Code:
include_once(dirname(__FILE__) . "/../include/global.php");

Cheers

Jay
Back to top
MarsRover



Joined: 07 Oct 2009
Posts: 6

PostPosted: Wed Oct 14, 2009 9:56 am    Post subject: Reply with quote

Jay,

That is not the only code that needs to be changed. "cactisnmpget" and "cactisnmpwalk" changed from version 0.8.6 to 0.8.7. The script and XML need to be re-written.
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 300
Location: Bristol, England

PostPosted: Wed Oct 14, 2009 10:40 am    Post subject: Reply with quote



Unfortunately I don't use Cacti 8.7 in production and I'm just a simple comms engineer, not a programmer/developer!

I have been looking at some other PHP scripts I use for Cacti and they seem to use the following as a function

function ss_protocol_ip($hostname, $snmp_community, $snmp_version, $snmp_port, $snmp_timeout, $snmpv3_auth_username, $snmpv3_auth_password) {

if (($snmp_version == "1" | $snmp_version == "2")) {
$snmpv3_auth_username = "";
$snmpv3_auth_password = "";
$snmpv3_auth_protocol = "";
$snmpv3_priv_passphrase = "";
$snmpv3_priv_protocol = "";
}

$result = "";


This may help you or may not.

I'm currently looking at our AUS cacti set up as they run 8.7e. I will post my findings soon.

Jay
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 300
Location: Bristol, England

PostPosted: Wed Oct 14, 2009 10:49 am    Post subject: Reply with quote

Hi

I have checked our AUS server and the script looks the same on initial inspection. I have uploaded it so you can compare for yourself. This works on the AUS server and I can see NBAR graphs being populated. Maybe there are difference in the different 8.7 versions as well.

Cheers

Jay



nbar_php_test.xml
 Description:

Download
 Filename:  nbar_php_test.xml
 Filesize:  4.15 KB
 Downloaded:  81 Time(s)


nbar_php_test.txt
 Description:

Download
 Filename:  nbar_php_test.txt
 Filesize:  9.19 KB
 Downloaded:  118 Time(s)

Back to top
MarsRover



Joined: 07 Oct 2009
Posts: 6

PostPosted: Wed Oct 14, 2009 10:51 am    Post subject: Reply with quote

Thanks. I'm checking it out now.

Edit: Looks like a bunch of Windows Characters were included with the files you uploaded. I'm removing it right now, then I'll test.
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 300
Location: Bristol, England

PostPosted: Wed Oct 14, 2009 11:54 am    Post subject: Reply with quote

Yeah sorry about that. I couldn't copy the files across so just copied and pasted them into wordpad.
Back to top
MarsRover



Joined: 07 Oct 2009
Posts: 6

PostPosted: Thu Oct 15, 2009 9:53 am    Post subject: Reply with quote

Nope, no luck. Tried the fresh script, then tried re-writing it to match the query for SNMP v3. I'll wait to see if someone else has an idea or a working version. Thanks for the help, Jay.
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 300
Location: Bristol, England

PostPosted: Thu Oct 15, 2009 9:59 am    Post subject: Reply with quote

No worries. Sorry I couldn't help any further. I would be interested in an updated version that works with the latest Cacti versions as I will be upgrading at some point .
Back to top
ifly4pie



Joined: 20 Oct 2009
Posts: 1
Location: South Dakota, USA

PostPosted: Tue Oct 20, 2009 5:23 pm    Post subject: Escape the Community String Reply with quote

hi guys,

I've also been having the issue where it returns 0 rows. here's what I've done so far:

I'm running Cacti 0.8.7a, and I get the proper results when I run an snmp-walk on the MIB.

1. I first tried the Eatworms NBAR script, and it looked good, but I got 0 rows returned.

2. I upgraded to the ss_nbar_all file at the beginning of this thread. Same problems listed here.

3. I added the the global.php include statement as listed above, too. No difference.

4. I updated the ss_nbar_all.php file to include 4 new null arguments for the 0.8.7x and SNMPv3 issues. This is for each call to cacti_snmp_get() like this:

Code:
cacti_snmp_get($hostname, $snmp_community, $t_oid, $snmp_version, "", "", "", "", "", "", 161, 1000)


Still didn't work - no change.

5. I tried to run it on the command line, and nothing happened. Then it dawned on me that my SNMP community string needed to be escaped because it had some special characters in it like @,#, and $.

As soon as I escaped my string, it ran fine on the command line. So I went back to Cacti, updated my community string with the \ escapes. Now, my normal queries stopped working, but the NBAR query did finally work, and returned all the rows!

Finally, I tried to figure out a way to escape the string in the ss_nbar_all.php file. There's a php function that really helps with this:

Code:
escapeshellcmd ($command);


Putting the escape inside the ss_nbar_all.php file won't do any good...because it's already being sent over the command line incorrectly before it gets here. So, the Cacti code for Get Script Server needs updating to escape the community string. (yes, I realize that I don't have the latest version to test it - maybe it's fixed by now - something I will check on.)

My workaround:
I had to create another community string just to make NBAR work. This string only uses letters and numbers, and I'm disappointed that I can't use special characters for security. But I do have it restricted with a Cisco Access Control List, so that makes me a little more comfortable.

Let me know if any of you have other ideas on how to escape the community string.

Thanks,
Josh
Back to top
jay
Cacti User


Joined: 31 Aug 2005
Posts: 300
Location: Bristol, England

PostPosted: Wed Oct 21, 2009 4:49 am    Post subject: Reply with quote

Hi Josh

Thanks for the information. Hopefully this will help others having issues. It might explain why our AUS Cacti server is able to get nbar stats without modifying the script, as I know they don't use special characters in their community strings.

Wonder if this is the cause of an issue I'm having with the cbwfq script as our global WAN routers have special characters in the community...mmmmm!!

Maybe you could submit a bug report in case some hard coding is required in Cacti.

Cheers

Jay
Back to top
MarsRover



Joined: 07 Oct 2009
Posts: 6

PostPosted: Fri Oct 23, 2009 2:22 pm    Post subject: Reply with quote

I'm going to try the work around now. I'll update in a few hours with my results.
Back to top
MarsRover



Joined: 07 Oct 2009
Posts: 6

PostPosted: Fri Oct 23, 2009 3:08 pm    Post subject: Reply with quote

...and they will sing the praises of ifly4pie for ages to come. It's working on an individual protocol level without any problems and I'm very happy about that. The "NBAR - Stacked Protocols" graph isn't graphing, but I should be able to work something out. Thanks for all the help, guys.
Back to top
redk3y



Joined: 14 Oct 2009
Posts: 2

PostPosted: Fri Oct 30, 2009 2:21 pm    Post subject: Reply with quote

So close...I can see per-protocol graphs in 0.8.7d when I use the realtime plugin, this just started after adding the 4 null args into the php file.

It appears though that my 5 min graphs and for that matter all others are not graphing properly...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 



Powered by phpBB © 2001, 2005 phpBB Group