which API we can get "Max speed" data?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
austin117
Posts: 10
Joined: Tue Jun 30, 2020 2:58 am

which API we can get "Max speed" data?

Post by austin117 »

Hi,

When we onboard router/switch by using wizard. There is "Max speed" data(pls refer to attachment).
May I know which API we can get "Max speed" data?
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: which API we can get "Max speed" data?

Post by gsmith »

Hi,

When you use the Network Switch/Router wizard the Nagios xi server
is interrogating the network device using snmpwalk. I ran the wizard
against a network appliance we have here to see what MIBs it's using
and it came back with:

DISMAN-EVENT-MIB
EtherLike-MIB
IF-MIB
IP-FORWARD-MIB
IP-MIB
IP-MIB
RMON-MIB
SNMPv2-MIB
SNMPv2-SMI
TCP-MIB
UDP-MIB

The mibs available on a server are stored in /usr/share/snmp/mibs. The mibs map the OID number
to a text name. I am thinking that when you say "API" you mean OID - does that sound right?

If so, you can find a free downloadable MIB browser online, or find an online MIB browser, and feed it the MIBs listed above to
see which OID reports the max speed of a port.

If you need more of an explanation of mibs and OIDs please let me know and I'll track down
some websites that can explain it in detail.

If you have trouble identifying the OID you are looking for let me know and I can dig
around.

Thanks
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: which API we can get "Max speed" data?

Post by vtrac »

Hi,
I believe the "Max Speed" came from "IF-MIB::ifSpeed" or "IF-MIB::ifHighSpeed".

You can try the below command:
NOTE: "x.x.x.x" is the IP address of your Switch/Router

Code: Select all

snmpwalk -v 2c -c 'yourCommunityString' x.x.x.x IF-MIB::ifSpeed
snmpwalk -v 2c -c 'yourCommunityString' x.x.x.x IF-MIB::ifHighSpeed
Best Regards,
Vinh
austin117
Posts: 10
Joined: Tue Jun 30, 2020 2:58 am

Re: which API we can get "Max speed" data?

Post by austin117 »

Thanks for the reply.

The API I am referring to is "Help > Objects Reference". Do you know which API here can get that "Max Speed" data?
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: which API we can get "Max speed" data?

Post by gsmith »

Hi,
Once you have the service configured , you can use http://<your hostname>/nagios/jsonquery.html to create
a query. Here I am showing a query to get the total number of processes on my localhost:
Screenshot 2021-04-29 150035.jpg
Let me know if you have any more questions.

Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: which API we can get "Max speed" data?

Post by vtrac »

Hi,
Sorry, those "Max Speed" came from the snmpwalk when running the wizard only.

I used API to look at "servicestatus" and do not see any field which contain speed.

Example:

Code: Select all

        {
            "host_name": "Switch Router",
            "service_description": "Port 9 Bandwidth",
            "display_name": "Port 9 Bandwidth",
            "host_object_id": "369",
            "host_address": "192.168.5.90",
            "host_alias": "Switch Router",
            "icon_image": "",
            "icon_image_alt": "",
            "notes": "",
            "notes_url": "",
            "action_url": "",
            "servicestatus_id": "315",
            "instance_id": "1",
            "service_object_id": "475",
            "status_update_time": "2021-04-29 15:03:02",
            "output": "OK - Current BW in: 0Mbps Out: 0Mbps",
            "long_output": "",
            "perfdata": "in=0Mb\/s;5.00;8.00 out=0Mb\/s;5.00;8.00",
            "current_state": "0",
            "has_been_checked": "1",
            "should_be_scheduled": "1",
            "current_check_attempt": "1",
            "max_check_attempts": "5",
            "last_check": "2021-04-29 14:58:41",
            "next_check": "2021-04-29 15:03:40",
            "check_type": "0",
            "check_options": "0",
            "last_state_change": "2021-04-27 10:15:09",
            "last_hard_state_change": "2021-04-27 10:15:09",
            "last_hard_state": "0",
            "last_time_ok": "2021-04-29 14:58:41",
            "last_time_warning": "1969-12-31 18:00:00",
            "last_time_unknown": "2021-04-27 10:15:09",
            "last_time_critical": "1969-12-31 18:00:00",
            "state_type": "1",
            "last_notification": "1969-12-31 18:00:00",
            "next_notification": "1969-12-31 18:00:00",
            "no_more_notifications": "0",
            "notifications_enabled": "1",
            "problem_has_been_acknowledged": "0",
            "acknowledgement_type": "0",
            "current_notification_number": "0",
            "passive_checks_enabled": "1",
            "active_checks_enabled": "1",
            "event_handler_enabled": "1",
            "flap_detection_enabled": "1",
            "is_flapping": "0",
            "percent_state_change": "0",
            "latency": "0.0002629999944474548",
            "execution_time": "0.067842",
            "scheduled_downtime_depth": "0",
            "failure_prediction_enabled": "0",
            "process_performance_data": "1",
            "obsess_over_service": "1",
            "modified_service_attributes": "0",
            "event_handler": "",
            "check_command": "check_xi_service_mrtgtraf!192.168.5.90_9.rrd!5.00,5.00!8.00,8.00!M",
            "normal_check_interval": "5",
            "retry_check_interval": "1",
            "check_timeperiod_object_id": "141"
        },


Best Regards,
Vinh
austin117
Posts: 10
Joined: Tue Jun 30, 2020 2:58 am

Re: which API we can get "Max speed" data?

Post by austin117 »

Is there any other way that we can get report of "Max Speed" for all interfaces of 1 router?
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: which API we can get "Max speed" data?

Post by gsmith »

Hi,

I am not sure I understand what you are asking.

Here is what I know we can do:

1. You can use the snmp wizard to create a service to report on the Max Speed. This information would be available through a web browser
connected to the Nagios xi server.
2. If you choose to access that information via an API call you can use http://<your hostname>/nagios/jsonquery.html to create
a query that can return the value of MaxSpeed, along with other information, in a JSON format. To do this you will need to create
a service using the snmp wizard first, in order to make that information available to the API.

If those choices are not what you are looking for please describe the scenario you are trying to accomplish.

Thanks
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: which API we can get "Max speed" data?

Post by ssax »

The MaxSpeed data is not stored in nagios in a queryable form. It is only used during the initial configuration from the Network Switch / Router wizard and stored in the MRTG configs in /etc/mrtg/conf.d/X.X.X.X.cfg.

Are you trying to monitor the port speed of a router/switch port or what specifically are you trying to do?
austin117
Posts: 10
Joined: Tue Jun 30, 2020 2:58 am

Re: which API we can get "Max speed" data?

Post by austin117 »

Hi Sean,

We don't want to monitor port speed.

We just want to get the MaxSpeed static data to put in the custom report by using API object/service because there is no that data in API object/service.
Locked