Using Nagios and Grafana on different servers

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Wicket
Posts: 5
Joined: Wed Jul 18, 2018 3:58 am

Using Nagios and Grafana on different servers

Post by Wicket »

Hello,

I have a Nagios Core installation on one server and a Grafana installation on another.
I want to use InfluxDB, Nagflux, Grafana and Histou but I can't seem to get it working on different servers.

I have followed this installation. At first I skipped the Grafana installation as I already had it installed on another machine.
When installing Histou I installed it on the Nagios server and copied the histou.js file to the Grafana server and changed the "var url =" to the Nagios servers IP like this:

Code: Select all

var url = 'http://10.100.1.230/histou/';
When I verify that Histou is working by running this on the Nagios server:

Code: Select all

curl -G "http://localhost/histou/?host=localhost&service=PING"
And this on the Grafana server:

Code: Select all

curl -G "http://10.100.1.230/histou/?host=localhost&service=PING"
They both come back positive and seem to work.
However when I try to verify that Histou is working in Grafana by doing this:

Code: Select all

http://10.100.1.40:3000/dashboard/script/histou.js?host=NAGIOS-MONITOR&service=PING
The IP 10.100.1.40 is the Grafana server.

I just get

Code: Select all

HTTP code: 404
Message: error
Url: http://10.100.1.230/histou/index.php?host=NAGIOS-MONITOR&service=PING&height=&legend=true&annotations=false
I don't know what else to do here to get it working so I thought that I could try and install Grafana on the Nagios server just to see if it would work, and it did..
I installed Histou as per the guide and copied the histou.js to the Grafana folder and changed the url to 10.100.1.230 and it just worked..

Am I missing something or is it not possible to have Grafana on a different server?
Note that there are no firewalls what so ever between the machines.

I even tried to install apache and php on the Grafana server and install Histou just like I did on the Nagios server but no luck there either.

Do I need to do some other configuration?

Any help here is appreciated.

Thanks,
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Using Nagios and Grafana on different servers

Post by Box293 »

So Histou just provides pretty graphs that work off the Nagios data that has already been collected.

Just to remove Histou from the troubleshooting, in Grafana are you able to create a dashboard and graph using that data? This link should provide some step-by-step examples:
https://support.nagios.com/kb/article/n ... _Dashboard
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Wicket
Posts: 5
Joined: Wed Jul 18, 2018 3:58 am

Re: Using Nagios and Grafana on different servers

Post by Wicket »

hmm, well it seems that I can create graphs manually. Though I don't know how to make a graph and I don't get the same options as in the link you posted I'm still able to add a query and add
"WHERE host =" and I get a list of all the hosts. I managed to get a graph from the check-host-alive command for a host and it looks like this:
Query
Query
Graph
Graph
graph.png (28.02 KiB) Viewed 3339 times
And when I was adding the data source it says it is working.
So it seems that Grafana is able to get the data from the InfluxDB.

So it seems to be a problem with the Histou addon in Grafana then?

Do I just have to copy over the histou.js file to the Grafana server or does it need PHP etc. on the Grafana server to work or any other configuration?
Wicket
Posts: 5
Joined: Wed Jul 18, 2018 3:58 am

Re: Using Nagios and Grafana on different servers

Post by Wicket »

With some trail and error I found out that it starts to work if I disable https for Grafana..

Just by changing

Code: Select all

protocol = https
to:

Code: Select all

protocol = http
and then restart Grafana and it works like it should.

So now my question. Is this a problem with Grafana or with Histou? And how do I fix this?
I have my Grafana server publicly facing the internet and I don't want to have it insecure due to the logins and the information on the site.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Using Nagios and Grafana on different servers

Post by Box293 »

OK that makes sense, you usually can't mix http and https together as it causes strange issues.

You should be able to change your var url = 'http:// to var url = 'https:// for it to work.

Then all of your access would be via https, like:
https://10.100.1.40:3000/dashboard/scri ... rvice=PING
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Wicket
Posts: 5
Joined: Wed Jul 18, 2018 3:58 am

Re: Using Nagios and Grafana on different servers

Post by Wicket »

Box293 wrote:OK that makes sense, you usually can't mix http and https together as it causes strange issues.

You should be able to change your var url = 'http:// to var url = 'https:// for it to work.

Then all of your access would be via https, like:
https://10.100.1.40:3000/dashboard/scri ... rvice=PING
Yes of course. It's workring if I enable https for Histou.
Seems like something I should have thought about..

Thank you for your help!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using Nagios and Grafana on different servers

Post by scottwilkerson »

Wicket wrote:
Box293 wrote:OK that makes sense, you usually can't mix http and https together as it causes strange issues.

You should be able to change your var url = 'http:// to var url = 'https:// for it to work.

Then all of your access would be via https, like:
https://10.100.1.40:3000/dashboard/scri ... rvice=PING
Yes of course. It's workring if I enable https for Histou.
Seems like something I should have thought about..

Thank you for your help!
Glad it's working

Locking
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked