Nagios xi Virtual Machine API call

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
lucas.shearer
Posts: 17
Joined: Fri Nov 19, 2021 12:00 pm

Nagios xi Virtual Machine API call

Post by lucas.shearer »

Ive setup Nagios xi on a VM. I can call the API's from within the machine, but can't outside of the machine. Or connect to the web UI outside of the machine. The VM itself is ubuntu, without any firewalls enabled or SELinux enabled. Why can't I get successful API calls from another machine when port 80 doesnt seem to be blocked? Since its a VM, does the machine the VM is running on impact it in some way? Im running the VM on a windows machine. Would really appreciate any help here. Thanks!
User avatar
jdunitz
Posts: 235
Joined: Wed Feb 05, 2020 2:50 pm

Re: Nagios xi Virtual Machine API call

Post by jdunitz »

Can your xi VM get to other machines?

From your xi machine, does:

Code: Select all

  ping some-other-machine-on-your-network
or

Code: Select all

  ping 8.8.8.8
work?


My first impression is that this might be a default route problem.

--Jeffrey
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
lucas.shearer
Posts: 17
Joined: Fri Nov 19, 2021 12:00 pm

Re: Nagios xi Virtual Machine API call

Post by lucas.shearer »

jdunitz wrote:Can your xi VM get to other machines?

From your xi machine, does:

Code: Select all

  ping some-other-machine-on-your-network
or

Code: Select all

  ping 8.8.8.8
work?


My first impression is that this might be a default route problem.

--Jeffrey
yes, ping 8.8.8.8 works... stopped at 9 packets transmitted, 9 received, 0% packet loss.. when testing.
lucas.shearer
Posts: 17
Joined: Fri Nov 19, 2021 12:00 pm

Re: Nagios xi Virtual Machine API call

Post by lucas.shearer »

I also just installed Nagiosxi, without changing any settings. So not sure if there is something I needed to change in order to access these API's outside of my network.

Or is it possible I need to install more than just the standard Nagios xi full install? As you can tell Im very new to this and also no networking expert, so I appreciate the help and patients immensely.
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Nagios xi Virtual Machine API call

Post by pbroste »

Hello @lucas.shearer

Want to find out what API data you are trying to gather to help dial things in a bit more. A lot of variables are introduced when Connecting to fetch data outside of your Lan network. It appears that you can get outside by pinging a google DNS server from your Nagios xi server.

It is one thing to get out of your local area network but depending on where you are trying to connect; it might be blocking you from getting in or accessing *(including particular ports). There are specific command-line tools that you can use to determine if you can connect to your destination. For example;
  • traceroute (traceroute <yourdestinationhostaddresshere> -p <portgoingthroughhere>
  • telnet $destinationIP $PORT
  • nc -vz $HOSTNAME $PORT
  • nmap -p $PORT $IP

Again, let us know additional specific details on what data you are trying to collect via api so we can dial things in.

Thanks,
Perry
lucas.shearer
Posts: 17
Joined: Fri Nov 19, 2021 12:00 pm

Re: Nagios xi Virtual Machine API call

Post by lucas.shearer »

pbroste wrote:Hello @lucas.shearer

Want to find out what API data you are trying to gather to help dial things in a bit more. A lot of variables are introduced when Connecting to fetch data outside of your Lan network. It appears that you can get outside by pinging a google DNS server from your Nagios xi server.

It is one thing to get out of your local area network but depending on where you are trying to connect; it might be blocking you from getting in or accessing *(including particular ports). There are specific command-line tools that you can use to determine if you can connect to your destination. For example;
  • traceroute (traceroute <yourdestinationhostaddresshere> -p <portgoingthroughhere>
  • telnet $destinationIP $PORT
  • nc -vz $HOSTNAME $PORT
  • nmap -p $PORT $IP

Again, let us know additional specific details on what data you are trying to collect via api so we can dial things in.

Thanks,
Perry
Trying to gather usage data, such as CPU load, free Memory, processes, and disk space from the machine which Nagiosxi is installed. So for example running this API:
http://<Nagios_IP_Address>/nagiosxi/api/v1/objects/rrdexport?apikey=<API_Key>&pretty=1&host_name=localhost&service_description=Current+Load

So trying to call this API outside of the Nagios VM Machine and get the response for that machines data. Would I run these commands from the external machine which I am attempting to make the API call from?
  • traceroute (traceroute <yourdestinationhostaddresshere> -p <portgoingthroughhere>
  • telnet $destinationIP $PORT
  • nc -vz $HOSTNAME $PORT
  • nmap -p $PORT $IP
Or from the Nagios VM Machine?

Thanks!
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Nagios xi Virtual Machine API call

Post by pbroste »

Hello @lucas.shearer

Thanks for following up; we would like to suggest that you reach out to your network team on criteria so they can make changes to the routing, security, and firewall to allow network traffic.

Please let us know if there are specifics on this that we can help dial in.

Thanks,
Perry
lucas.shearer
Posts: 17
Joined: Fri Nov 19, 2021 12:00 pm

Re: Nagios xi Virtual Machine API call

Post by lucas.shearer »

pbroste wrote:Hello @lucas.shearer

Thanks for following up; we would like to suggest that you reach out to your network team on criteria so they can make changes to the routing, security, and firewall to allow network traffic.

Please let us know if there are specifics on this that we can help dial in.

Thanks,
Perry
I am just not sure what to ask them what to do at this point yet.
Is there a way to run these commands from windows? I am trying to access the API calls from an external windows machine.
traceroute (traceroute <yourdestinationhostaddresshere> -p <portgoingthroughhere> (Would yourdestinationhostaddresshere be my Nagios IP Address? or the whole api call?)
telnet $destinationIP $PORT (Would the port here be the nagios port, so port 80 for http?)
nc -vz $HOSTNAME $PORT (Would hostname be the hostname in the nagios API I am trying to reach? so localhost?
nmap -p $PORT $IP
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Nagios xi Virtual Machine API call

Post by pbroste »

Hello @lucas.shearer

Thanks for following up, Windows does offer a PowerShell command so you can see if you are able to hit and connect to the destination device on the port specified.

Code: Select all

Test-NetConnection -ComputerName <yourhostaddresshere> -Port PORT_NUMBER
Thanks,
Perry