Showing posts with label snmp. Show all posts
Showing posts with label snmp. Show all posts

Thursday, December 18, 2014

Gathering and graphing snmp stats on a Palo Alto Networks Firewall

So I was task to the challenge of gathering cpu utilization and active sessions on a Palo Alto Networks Firewall.

There are two CPUs on a Firewall. There is a management plane cpu and a data plane cpu.

The OIDs are below.

Active sessions: .1.3.6.1.4.1.25461.2.1.2.3.3

MGMT Utilization: .1.3.6.1.2.1.25.3.3.1.2.1

Data Plane Utilization: .1.3.6.1.2.1.25.3.3.1.2.2



The first step is to enable snmp on the Firewall.

Under

Device/Setup/Operations/Miscellaneous/SNMP Setup

enter your community string and pick the version.



Now I'm using unsecured snmp v2 because I didn't know how to use snmpv3 on the Splunk Application that I'm going to use to generate charts.

on an ubuntu vm I tested it.

admin@ubuntu-poc-vm:~$ snmpget 10.48.64.112 -v 2c -c public .1.3.6.1.2.1.25.3.2.1.3.2
iso.3.6.1.2.1.25.3.2.1.3.2 = STRING: "Slot-1 Data Processor"
admin@ubuntu-poc-vm:~$ snmpget 10.48.64.112 -v 2c -c public .1.3.6.1.2.1.25.3.2.1.3.1
iso.3.6.1.2.1.25.3.2.1.3.1 = STRING: "Management Processor"
admin@ubuntu-poc-vm:~$ snmpget 10.48.64.112 -v 2c -c public .1.3.6.1.2.1.25.3.3.1.2.1
iso.3.6.1.2.1.25.3.3.1.2.1 = INTEGER: 23
admin@ubuntu-poc-vm:~$ snmpwalk 10.48.64.112 -v 2c -c public .1.3.6.1.2.1.25.3.3.1.2.2
iso.3.6.1.2.1.25.3.3.1.2.2 = INTEGER: 5


Next I setup Splunk on a Windows 7 VM. It was pretty easy as you go to their website and download the app for your particular flavor of OS.

Once installed you hop onto the webui and change your credentials.

Next you need to install the SNMP Modular Input app. It's free.


Then you need to go Settings > Data Inputs > SNMP > Add New

Here I created a new input for each SNMP OID that I wanted to query.


 There's a reason for this. I could have added a list of OIDs using comma delimited but I had a hard time trying parsing the data I wanted to graph. If someone has a better method let me know.

Last I used set source type to Manual and the actual source type to "snmp_ta" which is the SNMP Modular app.

Next I went to Manage App and looked for snmp_ta app and edited the permissions. I made the app visible.


A new icon appears in the dashboard and now I can double click it to examine the data being polled.


I first click on data summary and select the source tab and choose your source.


I should now see all the data that SNMP Modular Input queried from the firewall.


Now it's time to manipulate the data and create some nice graphs. First I have to manipulate the search fields.


I add a pipe and enter fields value.

This will specifically give me the value what is return from the SNMP OID.

Next I choose the Visualization tab and click on Pivot. I will only have 1 field to use which is the value field.


Next I choose the graph I want to create. I chose line chart.

 Then on the Y Axis I make sure the field says #value and I can label this as Data Plane CPU.

Then on the X Axis side I choose _time which will graph the data collected over time.

Make sure the Null Values say connected to give me a nice line graph instead of a bunch of dots.

Last I save this panel and give it a name so I can put it on my Dashboard.



Now you may say, Big deal, all this work to do that. I can just spin up Solar Winds and it's really easy. No need to create search queries and add pipes and then do all this to create one graph. Well the reason for using Splunk is that Palo Alto Networks has a nice plug-in (it's free) that works directly with Splunk. So with one tab I can check on all the traffic, threats and wildfire data collected and on the other tab I can look at the CPU Utilization and Session counts. This gives me one single pane of glass instead of having to jump onto different management tools to give me the same information.



Monday, March 31, 2014

How can I use a script to customize the snmp utility mib?

Juniper has a custom mib called the utility-mib where you can populate this with any value you want. This could be useful if say you want to create a custom counter. Your snmp server can then retrieve this information and use it.

example via cli

jnpr@Chef-RE0> request snmp utility-mib set instance test object-type string object-value ABC
Utility mib result: successfully populated utility mib database

jnpr@Chef-RE0> show snmp mib walk jnxUtil
jnxUtilStringValue.116.101.115.116 = ABC

jnpr@Chef-RE0> request snmp utility-mib clear instance test object-type string
Utility mib result: successfully de-populated utility mib database

jnpr@Chef-RE0> show snmp mib walk jnxUtil

----------
via script:


jnpr@Chef-RE0> op mib-util value "Hello World"

jnpr@Chef-RE0> show snmp mib walk jnxUtil
jnxUtilStringValue.116.101.115.116 = Hello World


---------------------------------------------------








version 1.0;

ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
ns ext = "http://xmlsoft.org/XSLT/namespace";

import "../import/junos.xsl";

var $arguments = <argument> {
    <name> "value";
    <description> "object value";
}
param $value;

match / {

        <op-script-results> {



                var $mibset-subs = <request-snmp-utility-mib-set> {

                    <object-type> "string";

                    <instance> "test";

                    <object-value> $value;

                }

                var $result=jcs:invoke($mibset-subs);

                }

Monday, October 28, 2013

Use a script to customize the snmp utility mib

Example of snmp utility mib via CLI
-----------------------

user@router> request snmp utility-mib set instance test object-type string object-value ABC
Utility mib result: successfully populated utility mib database

user@router> show snmp mib walk jnxUtil
jnxUtilStringValue.116.101.115.116 = ABC

user@router> request snmp utility-mib clear instance test object-type string
Utility mib result: successfully de-populated utility mib database


user@router> show snmp mib walk jnxUtil

------------

Now via script:
jnpr@Chef-RE0> op mib-util value "Hello World"

jnpr@Chef-RE0> show snmp mib walk jnxUtil
jnxUtilStringValue.116.101.115.116 = Hello World

Source Code:
------------







version 1.0;

ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
ns ext = "http://xmlsoft.org/XSLT/namespace";

import "../import/junos.xsl";

var $arguments = <argument> {
    <name> "value";
    <description> "object value";
}
param $value;

match / {

        <op-script-results> {



                var $mibset-subs = <request-snmp-utility-mib-set> {

                    <object-type> "string";

                    <instance> "test";

                    <object-value> $value;

                }

                var $result=jcs:invoke($mibset-subs);

                }

}

Friday, October 25, 2013

Are the snmp index values for Mpls Tunnels persistent? And how to decode the index values.

A customer was reporting that the mplsTunnelDown SNMP Trap shows a tunnel index, but that the correlating mplsTunnelUp SNMP Trap shows a different tunnel index. We wanted to know if the indexes were persistent.


It looks like this can possibly happen if mpls has to rebuild the lsps (i.e. due to a crash), but not when there is a link flap.

user@PE-router-RE0# run show snmp mib walk mplsTunnelName.29702 
mplsTunnelName.29702.1.2870018049.2870018050 = router-to-MX-1

[edit]
user@PE-router-RE0# run restart routing 
Routing protocols process signalled but still running, waiting 8 seconds more
Routing protocols process started, pid 1707

[edit]
user@PE-router-RE0# run show snmp mib walk mplsTunnelName     |  Match router
mplsTunnelName.26096.1.2870018049.2870018050 = router-to-MX-1

[edit]
user@PE-router-RE0# run show snmp mib walk mplsTunnelName.29702    

[edit]
user@PE-router-RE0# run show snmp mib walk mplsTunnelName | match router 
mplsTunnelName.26096.1.2870018049.2870018050 = router-to-MX-1

When I flapped a link on the lsp, the tunnel index stayed the same. So something has to happen where rpd has to rebuild the lsps.

The second part is how can you decipher the snmp OID index value.

user@PE-router-RE0> show mpls lsp ingress name router-to-MX-1 
Ingress LSP: 6 sessions
To              From            State Rt P     ActivePath       LSPname
171.17.0.2      171.17.0.1      Up     0 *                      router-to-MX-1
Total 1 displayed, Up 1, Down 0

user@PE-router-RE0> show snmp mib get mplsTunnelName.26096.1.2870018049.2870018050    
mplsTunnelName.26096.1.2870018049.2870018050 = router-to-MX-1


2870018049 as an integer and convert to hex to get 0xAB110001.

Split it into 4 octets:
AB = 171
11 = 17
00 = 0
01 = 1

Which is 171.17.0.1