Page 1 of 1
Nagios XI Virtual Machine API call
Posted: Thu Dec 16, 2021 5:16 pm
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!
Re: Nagios XI Virtual Machine API call
Posted: Thu Dec 16, 2021 5:39 pm
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
work?
My first impression is that this might be a default route problem.
--Jeffrey
Re: Nagios XI Virtual Machine API call
Posted: Thu Dec 16, 2021 5:43 pm
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
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.
Re: Nagios XI Virtual Machine API call
Posted: Thu Dec 16, 2021 5:45 pm
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.
Re: Nagios XI Virtual Machine API call
Posted: Fri Dec 17, 2021 2:46 pm
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
Re: Nagios XI Virtual Machine API call
Posted: Mon Dec 20, 2021 10:39 am
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!
Re: Nagios XI Virtual Machine API call
Posted: Mon Dec 20, 2021 1:01 pm
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
Re: Nagios XI Virtual Machine API call
Posted: Mon Dec 20, 2021 1:29 pm
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
Re: Nagios XI Virtual Machine API call
Posted: Mon Dec 20, 2021 4:37 pm
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