Welcome to docs.opsview.com

REST API: Queryhost

URL: /rest/queryhost. This requires authentication. Requires CONFIGURESAVE access.

  • GET - Not implemented
  • POST - Returns a list of interfaces on the device it queries
  • PUT - Not implemented
  • DELETE - Not implemented

Access control

CONFIGURESAVE allows to query any SNMP object in Opsview.

Listing interfaces

Output of a list response:

{
    interfaces => [
        {
            discards_critical   => 15,
            discards_warning    => "",
            errors_critical     => 10,
            errors_warning      => "",
            extra_info          => "alias:'' speed:'' link:'' status:''",
            id                  => 0,
            ifAlias             => undef,
            ifDescr             => "",
            ifLink              => undef,
            ifSpeed             => undef,
            ifStatus            => undef,
            interfacename       => "",
            throughput_critical => "0:50%",
            throughput_warning  => "",
        },
        {
            discards_critical => "",
            discards_warning  => "",
            errors_critical   => "",
            errors_warning    => "",
            extra_info =>
              "alias:'192.168.13.0 network' speed:'10Mbit/s' link:'up' status:'up'",
            id                  => 1,
            ifAlias             => "192.168.13.0 network",
            ifDescr             => "Ethernet0/0",
            ifLink              => "up",
            ifSpeed             => "10Mbit/s",
            ifStatus            => "up",
            interfacename       => "Ethernet0/0",
            throughput_critical => "",
            throughput_warning  => "",
        },
        {
            discards_critical => "",
            discards_warning  => "",
            errors_critical   => "",
            errors_warning    => "",
            extra_info =>
              "alias:'192.168.21.0 network' speed:'10Mbit/s' link:'down' status:'down'",
            id                  => 3,
            ifAlias             => "192.168.21.0 network",
            ifDescr             => "Ethernet0/1",
            ifLink              => "down",
            ifSpeed             => "10Mbit/s",
            ifStatus            => "down",
            interfacename       => "Ethernet0/1",
            throughput_critical => "",
            throughput_warning  => "",
        },
        {
            discards_critical => "",
            discards_warning  => "",
            errors_critical   => "",
            errors_warning    => "",
            extra_info    => "alias:'' speed:'8Gbit/s' link:'up' status:'up'",
            id            => 5,
            ifAlias       => "",
            ifDescr       => "Loopback0",
            ifLink        => "up",
            ifSpeed       => "8Gbit/s",
            ifStatus      => "up",
            interfacename => "Loopback0",
            throughput_critical => "",
            throughput_warning  => "",
        },
        {
            discards_critical => "",
            discards_warning  => "",
            errors_critical   => "",
            errors_warning    => "",
            extra_info    => "alias:'' speed:'10Gbit/s' link:'up' status:'up'",
            id            => 4,
            ifAlias       => "",
            ifDescr       => "Null0",
            ifLink        => "up",
            ifSpeed       => "10Gbit/s",
            ifStatus      => "up",
            interfacename => "Null0",
            throughput_critical => "",
            throughput_warning  => "",
        },
        {
            discards_critical => "",
            discards_warning  => "",
            errors_critical   => "",
            errors_warning    => "",
            extra_info =>
              "alias:'192.168.250.0 network' speed:'2Mbit/s' link:'up' status:'down'",
            id                  => 2,
            ifAlias             => "192.168.250.0 network",
            ifDescr             => "Serial0/0",
            ifLink              => "up",
            ifSpeed             => "2Mbit/s",
            ifStatus            => "down",
            interfacename       => "Serial0/0",
            throughput_critical => "",
            throughput_warning  => "",
        },
        {
            discards_critical => "",
            discards_warning  => "",
            errors_critical   => "",
            errors_warning    => "",
            extra_info    => "alias:'' speed:'100Mbit/s' link:'up' status:'up'",
            id            => 7,
            ifAlias       => "",
            ifDescr       => "Virtual-Access1",
            ifLink        => "up",
            ifSpeed       => "100Mbit/s",
            ifStatus      => "up",
            interfacename => "Virtual-Access1",
            throughput_critical => "",
            throughput_warning  => "",
        },
        {
            discards_critical => "",
            discards_warning  => "",
            errors_critical   => "",
            errors_warning    => "",
            extra_info => "alias:'' speed:'100Mbit/s' link:'up' status:'down'",
            id         => 8,
            ifAlias    => "",
            ifDescr    => "Virtual-Access2",
            ifLink     => "up",
            ifSpeed    => "100Mbit/s",
            ifStatus   => "down",
            interfacename       => "Virtual-Access2",
            throughput_critical => "",
            throughput_warning  => "",
        },
        {
            discards_critical => "",
            discards_warning  => "",
            errors_critical   => "",
            errors_warning    => "",
            extra_info => "alias:'' speed:'100Mbit/s' link:'up' status:'down'",
            id         => 6,
            ifAlias    => "",
            ifDescr    => "Virtual-Template1",
            ifLink     => "up",
            ifSpeed    => "100Mbit/s",
            ifStatus   => "down",
            interfacename       => "Virtual-Template1",
            throughput_critical => "",
            throughput_warning  => "",
        },
    ],
    system_description => "Cisco Internetwork Operating System Software",
}

Testing connection

{ system_description => "Cisco Internetwork Operating System Software" }

Queryhost parameters

Valid parameters are:

  • ip - Hostname or IP address. Required.
  • snmp_version - One of 1, 2c or 3. Required.
  • hostid - Host ID of the host from the DB. Not required if this is a new host.
  • msid - The monitoring server that the query is to be run from. Will use the first node if it is a cluster. Can be set to the master. Default is master.
  • snmp_port - Port for snmp to listen for devices. Defaults to 161.

The remaining parameters for queryhost depend on the version of SNMP requested.

Version 1 and 2c

The parameters required are:

  • snmp_community - the community string

Version 3

Extra information is required to satify the snmpv3 credentials. These must be added to the call:

  • snmpv3_username
  • snmpv3_authpassword
  • snmpv3_authprotocol
  • snmpv3_privpassword
  • snmpv3_privprotocol
Navigation
Print/export
Toolbox