cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1413
Views
4
Helpful
4
Replies

Is there anyway to retrieve port traffic statistics

kkoneru11
Level 1
Level 1

Hi All,

   All the API of interface are providing only some static information like IP address configured and device ID.  Is there anyway we can get complete port traffic statistics (other than flow-analysis).

Thanks

KAUSHIK K

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

There isn't a general stats model yet.  What I've been doing is using the APIC-EM inventory to get CLI/SNMP credentials and using direct device access to grab additional information.  As we see RESTCONF/NETCONF take shape, that will be an alternative to gather operational data until models are added to APIC-EM itself.

Thank you Clarke,

Can you give me an example if you have.  I want to know how you used REST API to pass CLI commands and how you retrieved output.

Sorry I wasn't clear.  I did not use APIC-EM to send CLI commands directly.  I used APIC-EM to provide my script credentials, and then I was able to login (using the Python paramiko module) to get the additional data.  If you need to use an API, and you have Prime Infrastructure, then Adam's suggestion is a good one.

If you want an example of what I did, check out https://communities.cisco.com/docs/DOC-63760 .

aradford
Cisco Employee
Cisco Employee

The other way you could do this today, is to use the Prime Infrastructure API.  For example to get tx statistics, you could use the following request.  By default it returns the samples for the past hour, but you can get historical as well.

  curl -k 'https://user:password@adam-pi/webacs/api/vService/interfaces/metrics/tx?device=10.10.14.2&ifName=GigabitEthernet1/0/1'
<?xml version="1.0" ?>
<mgmtResponse responseType="operation" requestUrl="https://adam-pi/webacs/api/v2/op/statisticsService/interfaces/metrics/tx?device=10.10.14.2&amp;amp;ifName=GigabitEthernet1/0/1" rootUrl="https://adam-pi/webacs/api/v2/op">
  <metricData>
    <currentDateTime>1463959584671</currentDateTime>
    <description>Interface performance metric for tx</description>
    <metricName>tx</metricName>
    <metricRows>
      <metricRows>
        <XValue>1463956480</XValue>
        <YValues>
          <YValues>756.0</YValues>
        </YValues>
      </metricRows>
      <metricRows>
        <XValue>1463957382</XValue>
        <YValues>
          <YValues>2021.0</YValues>
        </YValues>
      </metricRows>
      <metricRows>
        <XValue>1463958285</XValue>
        <YValues>
          <YValues>756.0</YValues>
        </YValues>
      </metricRows>
      <metricRows>
        <XValue>1463959187</XValue>
        <YValues>
          <YValues>2036.0</YValues>
        </YValues>
      </metricRows>
    </metricRows>
    <resourceName>