Welcome to advance GET mode, type ? for help. get> sysUpTime.0 SNMPv2-MIB::sysUpTime.0 = Timeticks: (145211238) 16 days, 19:21:52.38 get> sysUpTime SNMPv2-MIB::sysUpTime = No Such Instance currently exists at this OID get> sysUpTime.0 SNMPv2-MIB::sysUpTime = No Such Instance currently exists at this OID get> sdf SNMPv2-MIB::sysUpTime = No Such Instance currently exists at this OID get> sysContact.0 SNMPv2-MIB::sysContact = No Such Instance currently exists at this OID get> ------------------- void get_advance1(char *get_adv_val) { pdu = snmp_pdu_create(SNMP_MSG_GET); get_node(get_adv_val, id_oid, &id_len); snmp_add_null_var(pdu, id_oid, id_len); retry: status = snmp_synch_response(sess_handle, pdu, &response); if (status == STAT_SUCCESS) { if (response->errstat == SNMP_ERR_NOERROR) { for (vars = response->variables; vars; vars = vars->next_variable) print_variable(vars->name, vars->name_length, vars); } else { fprintf(stderr, "Error in packet\nReason: %s\n", snmp_errstring(response->errstat)); if (response->errindex != 0) { fprintf(stderr, "Failed object: "); for (count = 1, vars = response->variables; vars && count != response->errindex; vars = vars->next_variable, count++) /*EMPTY*/; if (vars) { fprint_objid(stderr, vars->name, vars->name_length); } fprintf(stderr, "\n"); } exitval = 2; /* * * retry if the errored variable was successfully removed */ if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_APP_DONT_FIX_PDUS)) { pdu = snmp_fix_pdu(response, SNMP_MSG_GET); snmp_free_pdu(response); response = NULL; if (pdu != NULL) { goto retry; } } } /* endif -- SNMP_ERR_NOERROR */ } else if (status == STAT_TIMEOUT) { fprintf(stderr, "Timeout: No Response from %s.\n", session.peername); exitval = 1; } else { /* status == STAT_ERROR */ snmp_sess_perror("snmpget", sess_handle); exitval = 1; } /* endif -- STAT_SUCCESS */ }