About Monitoring Using The REST API
About Monitoring Using The REST API
About Monitoring Using The REST API
APIC
Monitoring APIC CPU and Memory Usage Using the REST API
The easiest way to quickly verify the health of the controllers is the APIC. Controllers provide information
regarding the current status of CPU and memory utilization by creating instances of the procEntity class. The
procEntity is a container of processes in the system. This object holds detailed information about various
processes running on the APIC. The procEntity objects contain the following useful properties:
• cpuPct—CPU utilization
• maxMemAlloc—The maximum memory allocated for the system
• memFree—The maximum amount of available memory for the system
Procedure
Retrieve information about CPU and memory usage using the following REST API call:
Example:
https://apic-ip-address/api/node/class/procEntity.xml?
Procedure
Monitor the disk and file systems on the APIC, by sending a REST API post, such as the following:
Example:
https://apic-ip-address/api/node/class/eqptStorage.xml?
Monitoring Physical Interface Statistics and Link State Using the REST API
You can use the REST API interface to poll for interface statistics. Several counters are available (for example,
RX/TX, input/output / duplex, 30 second rates, 5 minute rate, unicast packets, multicast packets). Using the
parent managed object, the children can be derived from it. To do this, you must have a good understanding
of the object model and be able to navigate through the model to obtain the information desired using the
example below.
Procedure
Step 1 Use the following base API call to get physical interface statistics:
Example:
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/phys-[eth1/1].json
Step 2 To determine the total ingress bytes on Leaf 101 port Eth1/1, you can issue the following API call:
Example:
/topology/pod-1/node-101/sys/phys-[eth1/1].json
Step 3 Visore allows you to dig deeper into the hierarchical tree. From the prior command, the operator can see
children of the interface object, such as ingress and egress bytes. The child objects include the following:
Example:
/topology/pod-1/node-101/sys/phys-[eth1/1]/dbgEtherStats
Fabric
Monitoring LLDP and CDP Neighbor Status Using the REST API
The APIC enables you to determine all LLDP or CDP neighbors in a fabric, using the REST API.
Procedure
Step 1 To determine the LLDP neighbors, send a POST such as the following:
Example:
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/lldp/inst/if-[eth1/1]
Step 2 To determine the CDP neighbors, send a POST such as the following:
Example:
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/cdp/inst/if-[eth1/1]
The bond interfaces rely on underlying physical interfaces. It is important to note that the REST API provides
link information for both the physical and logical bond interfaces.
Procedure
Collect information about both the bond interfaces by sending a POST request such as the following example:
Example:
https://apic-ip-address/api/node/mo/topology/pod-1/node-1/sys.json?querytarget=
subtree&target-subtree-class=l3EncRtdIf
Procedure
To monitor the traffic for a new project for the epg-web-epg, send a POST request such as the following
example:
Example:
https://apic-ip-address/api/node/mo/uni/tn-newproject/ap-app1/epg-web-epg.xml?querytarget=
self&rsp-subtree-include=stats
Switches
Monitoring Switch CPU Utilization Using the REST API
Spine and leaf switch CPU utilization can be monitored using the following classes, based on the desired
timescale and granularity:
• proc:SysCPU5min—A class that represents the most current statistics for system CPU in a 5-minute
sampling interval. This class updates every 10 seconds.
• proc:SysCPU15min—A class that represents the most current statistics for system CPU in a 15-minute
sampling interval. This class updates every 5 minutes.
• proc:SysCPU1h—A class that represents the most current statistics for system CPU in a 1-hour sampling
interval. This class updates every 15 minutes.
• proc:SysCPU1d—A class that represents the most current statistics for system CPU in a 1-day sampling
interval. This class updates every hour.
• proc:SysCPU1w—A class that represents the most current statistics for system CPU in a 1-week sampling
interval. This class updates every day.
• proc:SysCPU1mo—A class that represents the most current statistics for system CPU in a 1-month
sampling interval. This class updates every day.
• proc:SysCPU1qtr—A class that represents the most current statistics for system CPU in a 1-quarter
sampling interval. This class updates every day.
• proc:SysCPU1year—A class that represents the most current statistics for system CPU in a 1-year
sampling interval. This class updates every day.
The following example shows how to use these classes for monitoring:
Procedure
To view the average CPU utilization of all of the fabric switches over the last day, use XML such as in the
following example:
Example:
https://apic-ip-address//api/node/class/procSysCPU1d.xml?
Procedure
To retrieve the status of the fan trays on the leaf switches, use XML such as the following example:
Example:
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/ch/ftslot-1
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/ch/ftslot-2
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/ch/ftslot-3
• proc:SysMem1qtr—A class that represents the most current statistics for system memory in a 1-quarter
sampling interval. This class updates every day.
• proc:SysMem1year—A class that represents the most current statistics for system memory in a 1-year
sampling interval. This class updates every day.
Procedure
To monitor memory over the last day, use the following REST call:
Example:
https://apic-ip-address/api/node/class/procSysMem1d.xml?
Procedure
To monitor the state of the supervisor and the module, use a REST API call such as the following:
Example:
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/ch/supslot-1/sup
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/ch/lcslot-1/lc
Procedure
To monitor the state of the power supplies on a leaf switch, use XML such as the following example:
Example:
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/ch/psuslot-1
https://apic-ip-address/api/node/mo/topology/pod-1/node-101/sys/ch/psuslot-2
Procedure
To retrieve switch hardware information, use the REST API as shown in the following example:
Example:
https://apic-ip-address/api/node/mo/topology/pod-1.json?query-target=children&target-subtree-class=fabricNode
External Monitoring
Smart Callhome
About Smart Callhome
Smart Callhome provides an email-based notification for critical system policies in a similar way as Callhome.
However, Smart Callhome collects a more specific selection of faults to deliver in email messages.
The fault triggers that are typical of the Smart Callhome feature correspond to the kind of events that threaten
to disrupt your network. Examples are:
• Temperature Faults: The temperature of a sensor exceeds a threshold.
• Fan/ Power Supply Faults: A fan or power supply unit goes offline.
• Disk Utilization Faults: The disk usage of a device exceeds a threshold.
Smart Callhome collects faults and emails them to a network support engineer, a Network Operations Center,
or to Cisco Smart Callhome services to generate a case with the Technical Assistance Center (TAC).
Procedure
{
"callhomeSmartGroup": {
"attributes": {
"name": "<destination-group-name>",
"descr": "<description>"
},
"children": [
{
"callhomeSmartDest": {
"attributes": {
"name": "<destination-name>",
"email": "<email-address>",
format="xml"
},
"children": []
}
},
{
"callhomeProf": {
"attributes": {
"from": "<email-address>",
"port": "<number>",
"replyTo": "<email-address>",
"email": "<customer-contact-email>",
"phone": "<contact-phone-number>",
"contact": "<name>",
"addr": "<streeet-address>",
"contract": "<id>",
"customer": "<id>",¬
"site": "<id>"
},
"children": [
{
"callhomeSmtpServer": {
"attributes": {
"host": "<hostname-or-ip-address>"
},
"children": [
{
"file RsARemoteHostToEpg": {
"attributes": {
"tDn": "uni/tn-mgmt/mgmtp-default/oob- default"
},
"children": []
}
}
]
}
}
]
}
}
]
}
}
Creating a TACACS External Logging Destination Group Using the REST API
Procedure
{
"tacacsGroup": {
"attributes": {
"dn": "uni/fabric/tacacsgroup-<groupname>",
"name": "<groupname>",
"rn": "tacacsgroup-<groupname>",
"status": "created"
},
"children": [{
"tacacsTacacsDest": {
"attributes": {
"dn": "uni/fabric/tacacsgroup-<groupname>/tacacsdest-<dest-name>-port-<portno>",
"host": "<dest-name>",
"rn": "tacacsdest-<dest-name>-port-<portno>",
"key": "<server secret>",
"status": "created"
},
"children": [{
"fileRsARemoteHostToEpg": {
"attributes": {
"tDn": "uni/tn-mgmt/mgmtp-default/oob-default",
"status": "created"
},
"children": []
}
}]
}
}]
}
}
Procedure
{
"tacacsSrc": {
"attributes": {
"dn": "uni/fabric/moncommon/tacacssrc-<src-name>",
"incl": "audits,faults",
"name": "aaa",
"rn": "tacacssrc-<src-name>",
"status": "created",
"incl":"audit,session"
},
"children": [{
"tacacsRsDestGroup": {
"attributes": {
"tDn": "uni/fabric/tacacsgroup-<groupname>",
"status": "created"
},
"children": []
}
}]
}
}