Note that there are some explanatory texts on larger screens.

plurals
  1. POPrinting net-snmp getbulk results with newlines at each index
    primarykey
    data
    text
    <p>I have the following Python code:</p> <pre><code>#!/usr/bin/python import netsnmp session = netsnmp.Session(DestHost='_destination address_', Version=2, Community='_string_') vars = netsnmp.VarList(netsnmp.Varbind('ifIndex',), netsnmp.Varbind('ifDescr',), netsnmp.Varbind('ifOperStatus',)) print(session.getbulk(0, 48, vars)) </code></pre> <p>The results of <code>session.getbulk</code> are as follows:</p> <pre><code>('1', 'Vlan1', '1', '2', 'Vlan2', '2', '10101', 'GigabitEthernet0/1', '2', '10102', 'GigabitEthernet0/2', '2', '10103', 'GigabitEthernet0/3', '2', '10104', 'GigabitEthernet0/4', '2', '10105', 'GigabitEthernet0/5', '2', '10106', 'GigabitEthernet0/6', '2', '10107', 'GigabitEthernet0/7', '2', '10108', 'GigabitEthernet0/8', '2', '10109', 'GigabitEthernet0/9', '2', '10110', 'GigabitEthernet0/10', '2', '10111', 'GigabitEthernet0/11', '2', '10112', 'GigabitEthernet0/12', '2', '10113', 'GigabitEthernet0/13', '1', '10114', 'GigabitEthernet0/14', '1', '10115', 'GigabitEthernet0/15', '2', '10116', 'GigabitEthernet0/16', '1', '10117', 'GigabitEthernet0/17', '2') </code></pre> <p>I would like to print the information returned by <code>session.getbulk</code> on a newline per each interface. If my understanding of my program is correct, I should get three values for each interface, (<code>ifIndex</code>, <code>ifDescr</code>, and <code>ifOperStatus</code>.) </p> <p>As it stands, the results are presented in a single block of information, and it may be hard for my audience to differentiate between.</p> <p>However, being totally new to programming I am having a hard time figuring out how to do this. If anybody is willing to point me toward an appropriate tutorial or documentation for this, I'd much appreciate it.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload