Another Cisco Class Map Statistics - no script server (ugly)

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

Moderators: Developers, Moderators

User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Another Cisco Class Map Statistics - no script server (ugly)

Post by JorisFRST »

This is my way to address the issue that the Class Map Statistics are not properly indexed on Cisco gear.
It involves some manual work when setting up the graphs, but this method does not use the script-server and thus does not slow your polling down, which is important in bigger environments.

Also it's very easy to add other metrics to the graphs.
graph_class.png
graph_class.png (40.51 KiB) Viewed 7756 times
The metrics I setup already :
cbQosCMPrePolicyBitRate : The bit rate of the traffic prior to executing any QoS policies.
cbQosCMPostPolicyBitRate : The bit rate of the traffic after executing QoS policies.
cbQosCMDropBitRate : The bit rate of the drops per class as the result of all features that can produce drops (e.g., police, random detect, etc.).
ManageEngine MibBrowser Free Tool_2017-01-19_14-31-20.png
ManageEngine MibBrowser Free Tool_2017-01-19_14-31-20.png (20.05 KiB) Viewed 7756 times
These are quite easy to get from the cbQosClassMapStats table. Problem is there is zero info about the actual policy name and direction in this table.
For this we have to call another two tables, which are differently indexed. This will cause us some manual work later. The cbQosServicePolicyTable has the information about the interface the policy is applied and the direction it is applied, and the cbQosCMCfgTalbe has the names of the policies defined in the router.
Now to match those tables indexes to the indexes used in the ClassMapStats table we have to look at the cbQosObjectsTable. And since two of those tables are differently indexed we'll have to use three data queries.

Great fun all this. Now how does this look in cacti ?
Well, it could be alot worse.
Console - Create New Graphs - Google Chrome_2017-01-19_15-14-37.png
Console - Create New Graphs - Google Chrome_2017-01-19_15-14-37.png (34.81 KiB) Viewed 7756 times
Basicly the top "Cisco - Class Based QoS Class Map Statistics is the ones you'll select to create your graphs. Know, how do you find out in which graph's you're interested ?

First, the interfaces, the bottom query will map the "qos interface" to the snmp interface index and show you the direction.
Next you can map the Class Map Name to the ConfigIndex, and then find in the top data query the graph you want to create.
I suggest renaming the graphs after you create them to something usefull as I've done in the example at the start of this post.

This might be a bit of manual work, but it beats using the script-server if you have to get a lot of those graphs.

Download :
cbQosCM.zip
(5.98 KiB) Downloaded 648 times
Import host template (it will install the graph and 3 data queries)
copy the 3 xml files from snmp_queries folder to your cacti install snmp_queries folder

Same can be found on my blog : http://www.routerjanitor.com/2017/01/ca ... s-map.html
Joris.
http://www.routerjanitor.com
choefing
Posts: 29
Joined: Tue May 04, 2010 4:47 am

Re: Another Cisco Class Map Statistics - no script server (u

Post by choefing »

Thanks, the templates are working properly for us using most actual Cacti 1.1.24.

Due to the "mess" with indexes I guess what you meant with "manual work" is e.g. adding proper the proper Class Map Name to the graph title ? Seems there is no easy way to automate this somehow ?

Rgds
Chris
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Another Cisco Class Map Statistics - no script server (u

Post by JorisFRST »

Yeah, that's exactly it, making sure the graph titles mean something.

The indexes are a mess.
I didn't find a way to do it automaticly.

Since it's all in a db in theory it must be possible to write a program outside cacti to do this for you.
But I never looked at it that far.

I'm happy it runs fast and doesn't tax my server that much as the scripted way to do it.
Joris.
http://www.routerjanitor.com
choefing
Posts: 29
Joined: Tue May 04, 2010 4:47 am

Re: Another Cisco Class Map Statistics - no script server (u

Post by choefing »

For now we just need it for 2 devices, but more might be added, so an automatic way would be appreciated.
I guess the |query_something| does not work ? I thought where is a way to grep the "cbqQOSwhatever" from the xml in a way but that most probably was more a wish then a well thought solution.
Anyway, thanks for contributing this, saved me headaches :)
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Another Cisco Class Map Statistics - no script server (u

Post by JorisFRST »

I don't think you can query between datasources, I haven't found a way to do it.
Joris.
http://www.routerjanitor.com
trang
Posts: 13
Joined: Fri May 26, 2017 9:34 am

Re: Another Cisco Class Map Statistics - no script server (u

Post by trang »

Hi,

I am using cacti version 1.1.19 and using cacti almost for 3 months, so it is new to me.
Could you share how to use the script on cacti new version 1.1.x ?
i already did follow your step for importing the xml file, but my data source template ended like this when creating new graph:
3.PNG
3.PNG (37.93 KiB) Viewed 7089 times
this is my data source look like:
5.png
5.png (40.25 KiB) Viewed 7089 times
And i found error on cacti graph
4.PNG
4.PNG (47.71 KiB) Viewed 7089 times
did i miss something?

Thank You . :D
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Another Cisco Class Map Statistics - no script server (u

Post by JorisFRST »

Did you create a new graph from the device ?

Check your data source template, does it look like this ? (ignore datasource profile)
2018-01-08 12_16_59-Console -_ Data Templates -_ (Edit).png
2018-01-08 12_16_59-Console -_ Data Templates -_ (Edit).png (42.81 KiB) Viewed 7088 times
Joris.
http://www.routerjanitor.com
trang
Posts: 13
Joined: Fri May 26, 2017 9:34 am

Re: Another Cisco Class Map Statistics - no script server (u

Post by trang »

Hi Joris,
Thank for your prompt response, :D

yes, my data source is looks like yours.
After import host and copy the files to snmp_source, I did create new graph from the device but from "management" tab, because when using "New Graphs" on the create tab it doesn't have Cbqos template option, just basic in/out bits graph type.

After adding new graph and the data source is automatically created, but the "Index Value" was empty and also graph showing an error on debug
Create new Graph
6.PNG
6.PNG (20.74 KiB) Viewed 7079 times
New Data source automaticly created
8.PNG
8.PNG (66.15 KiB) Viewed 7079 times
Graph debug
7.PNG
7.PNG (142.37 KiB) Viewed 7079 times
I just assume that the data source Index value should not be empty, because cacti doesn't know what interface to grep.

Thank you :D
I really appreciate your help.
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Another Cisco Class Map Statistics - no script server (u

Post by JorisFRST »

Hi,

that doesn't work,

you have to add the Assosicated data Queries to your devices :
2018-01-08 12_09_39-Console -_ Devices -_ (Edit).png
2018-01-08 12_09_39-Console -_ Devices -_ (Edit).png (13.06 KiB) Viewed 7078 times
This will launch the xml files and lookup the indexes needed to create the graphs.
Joris.
http://www.routerjanitor.com
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: Another Cisco Class Map Statistics - no script server (u

Post by netniV »

Best way to add associated data queries is to have them against a device template and then use that template against your devices. That way, as soon as you mark it as being the same device type, it will pull in the same queries.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
trang
Posts: 13
Joined: Fri May 26, 2017 9:34 am

Re: Another Cisco Class Map Statistics - no script server (u

Post by trang »

Hi Joris,

It works now like a magic!
I realized that I am not added the template to the device.

Thank joris :D , it's really helpful for me and nice work for the template. you rock 8)
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Another Cisco Class Map Statistics - no script server (u

Post by JorisFRST »

netniV wrote:Best way to add associated data queries is to have them against a device template and then use that template against your devices. That way, as soon as you mark it as being the same device type, it will pull in the same queries.
Hi,

this is the best advice really.

I have included an example called "Cisco - Class Based QoS" in the download.

https://www.cacti.net/downloads/docs/ht ... lates.html

(in the newer versions it's called device templates and not host templates)
Joris.
http://www.routerjanitor.com
taanvox
Posts: 5
Joined: Fri Aug 02, 2019 10:34 am

Re: Another Cisco Class Map Statistics - no script server (u

Post by taanvox »

Hi JorisFRST,

Can you help me, please ?
I added your template but my device not query data.
Device : cisco switch 4506
Attachments
cacti cisco qos error.png
cacti cisco qos error.png (25.03 KiB) Viewed 5917 times
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Another Cisco Class Map Statistics - no script server (u

Post by JorisFRST »

Hi,

can you do a verbose query ?

I'll be back in the office on Tuesday and can have a look at the output then.
Joris.
http://www.routerjanitor.com
taanvox
Posts: 5
Joined: Fri Aug 02, 2019 10:34 am

Re: Another Cisco Class Map Statistics - no script server (u

Post by taanvox »

JorisFRST wrote:Hi,

can you do a verbose query ?

I'll be back in the office on Tuesday and can have a look at the output then.

Hi Joris,

I did verbose query but no data query
I upload image when i add your template class-map.
Attachments
cacti cisco error.png
cacti cisco error.png (13.57 KiB) Viewed 5912 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests