Cisco IOS-XR RSP and LC CPU monitoring: script and templates
Moderators: Developers, Moderators
Cisco IOS-XR RSP and LC CPU monitoring: script and templates
Script is written in python and tested on python 2.7.3.
Created for Cisco IOS-XR CRS-3 and ASR9010.
Tested on cacti 0.8.7i.
For snmp queries you need snmpwalk and snmpget installed.
By default snmp v2c is used.
- unzip cisco_iosxr_cpu_stats.zip
- copy script_query_get_iosxr_cpu_stats.xml into CACTI_HOME/resource/script_queries/
- copy script_get_iosxr_cpu_stats.py into CACTI_HOME/scripts/
- through cacti web interface import templates: graph_data_template_cisco_iosxr_cpu_stats.xml and data_query_template_cisco_iosxr_cpu_stats.xml
Created for Cisco IOS-XR CRS-3 and ASR9010.
Tested on cacti 0.8.7i.
For snmp queries you need snmpwalk and snmpget installed.
By default snmp v2c is used.
- unzip cisco_iosxr_cpu_stats.zip
- copy script_query_get_iosxr_cpu_stats.xml into CACTI_HOME/resource/script_queries/
- copy script_get_iosxr_cpu_stats.py into CACTI_HOME/scripts/
- through cacti web interface import templates: graph_data_template_cisco_iosxr_cpu_stats.xml and data_query_template_cisco_iosxr_cpu_stats.xml
- Attachments
-
- cisco_iosxr_cpu_stats.zip
- (6.61 KiB) Downloaded 336 times
Re: Cisco IOS-XR RSP and LC CPU monitoring: script and templ
Thanks for posting this, seems like its what we currently need
However Im getting this when I try to create the graph:
Our debug info
What could be the problem here?
However Im getting this when I try to create the graph:
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.
Our debug info
+ Running data query [20].
+ Found type = '4' [Script Query].
+ Found data query XML file at '/usr/share/cacti/resource/script_queries/script_query_get_cisco_iosxr_cpu_stats.xml'
+ XML file parsed ok.
+ Executing script for num of indexes '/usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community num_indexes'
+ Executing script for list of indexes '/usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community index' Index Count: 0
+ Executing script query '/usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community query index'
+ Executing script query '/usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community query query'
What could be the problem here?
Last edited by havok1977 on Thu Aug 14, 2014 10:08 am, edited 1 time in total.
Re: Cisco IOS-XR RSP and LC CPU monitoring: script and templ
Please check if the script is working correctly from the cli. Just run it from cli using correct IP address and community:
Run that command using your router IP and community:
The output should be something like that, depends on how many cpus you have:/usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community num_indexes
/usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community index
If you will have problems with the output from the script, you need to check that snmpwalk and snmpget utilities are correctly installed and the script can find them using system path./usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py 192.168.111.111 public num_indexes
6
/usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py 192.168.111.111 public index
66
82
2050
16777282
16777298
16779266
Run that command using your router IP and community:
If it is not in the system path the simple solution is to copy snmpget and snmpwalk to the directory where the script is located.snmpwalk -v2c -c public 192.168.111.111 .1.3.6.1.4.1.9.9.109.1.1.1.1.2
iso.3.6.1.4.1.9.9.109.1.1.1.1.2.66 = INTEGER: 38557239
iso.3.6.1.4.1.9.9.109.1.1.1.1.2.82 = INTEGER: 56744940
iso.3.6.1.4.1.9.9.109.1.1.1.1.2.2050 = INTEGER: 16203662
iso.3.6.1.4.1.9.9.109.1.1.1.1.2.16777282 = INTEGER: 168504586
iso.3.6.1.4.1.9.9.109.1.1.1.1.2.16777298 = INTEGER: 159516845
iso.3.6.1.4.1.9.9.109.1.1.1.1.2.16779266 = INTEGER: 176960415
Re: Cisco IOS-XR RSP and LC CPU monitoring: script and templ
Thanks for your reply
I get these errors when invoking the script via CLI
I get these errors when invoking the script via CLI
Our server runs CentOS 6, which includes python ver 2.6.6 - would the lower version be the issue here?[root@NMU-SRV-MRTG ~]# /usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community num_indexes
Traceback (most recent call last):
File "/usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py", line 73, in <module>
print get_cpu_index()
File "/usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py", line 21, in get_cpu_index
out = subprocess.check_output(IDX_OID, shell=True)
AttributeError: 'module' object has no attribute 'check_output'
[root@NMU-SRV-MRTG ~]# /usr/bin/env python /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community index
Traceback (most recent call last):
File "/usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py", line 75, in <module>
get_cpu_index()
File "/usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py", line 21, in get_cpu_index
out = subprocess.check_output(IDX_OID, shell=True)
AttributeError: 'module' object has no attribute 'check_output'
Re: Cisco IOS-XR RSP and LC CPU monitoring: script and templ
Yes, the problem is with the python version.
Please replace your script_get_cisco_iosxr_cpu_stats.py with the new one. I've changed it to support python < 2.7.
I hope this time it will work.
Please replace your script_get_cisco_iosxr_cpu_stats.py with the new one. I've changed it to support python < 2.7.
I hope this time it will work.
- Attachments
-
- script_get_cisco_iosxr_cpu_stats.py.zip
- changed to support python < 2.7
- (1.19 KiB) Downloaded 162 times
Re: Cisco IOS-XR RSP and LC CPU monitoring: script and templ
Yeah, the Python version was the issue; in case anyone has the same OS this is how you install the newer version in parallel to avoid clashes:
http://toomuchdata.com/2014/02/16/how-t ... on-centos/
http://toomuchdata.com/2014/02/16/how-t ... on-centos/
[root@NMU-SRV-MRTG script_queries]# /usr/local/bin/python2.7 /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community num_indexes
4
[root@NMU-SRV-MRTG script_queries]# /usr/local/bin/python2.7 /usr/share/cacti/scripts/script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community index
2
18
2082
2098
Re: Cisco IOS-XR RSP and LC CPU monitoring: script and templ
acivciss wrote:Yes, the problem is with the python version.
Please replace your script_get_cisco_iosxr_cpu_stats.py with the new one. I've changed it to support python < 2.7.
I hope this time it will work.
Heh, we worked on it at the same time I'll test this version and let you know how it goes
Re: Cisco IOS-XR RSP and LC CPU monitoring: script and templ
acivciss wrote:Yes, the problem is with the python version.
Please replace your script_get_cisco_iosxr_cpu_stats.py with the new one. I've changed it to support python < 2.7.
I hope this time it will work.
Works perfectly, thanks again!
[root@NMU-SRV-MRTG tmp]$ /usr/bin/env python ./script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community num_indexes
2
[root@NMU-SRV-MRTG tmp]$ /usr/bin/env python ./script_get_cisco_iosxr_cpu_stats.py XXX.XXX.XXX.XXX community index
2
2082
Re: Cisco IOS-XR RSP and LC CPU monitoring: script and templ
You're welcome!
Hope graphs are OK too.
Hope graphs are OK too.
Who is online
Users browsing this forum: No registered users and 3 guests