0

I have an Icinga server (which is basically a fork of Nagios) at one of my clients' sites. I access the server via ssh and don't have access to other ports.

Since there are a couple of things that can go down at that site, I prefer to check the site at least on a daily basis. So I run the following command:

ssh -L 8080:localhost:80 user@remote.host

and check the Icinga web UI with my browser at:

http://localhost:8080

Pretty standard.

The problem is, that if I had more clients like this, ssh-ing into each of those servers would be a painful experience. The most welcome solution would be to configure mail alerts on those hosts, unfortunately those machines don't have internet access and the ssh I'm accessing them through is the only contact with them.

Is there some way to gather info from those instances via ssh? Let's say Icinga dumps current alerts into a file and I scp that file to my local instance? Or any other solution?

I'd really appreciate to be able to come to work and see any alerts in some place (local dashboard, mail, whatever).

EDIT The remote site should have its own Icinga setup, so anyone inside that network can check alerts in it. Additionally I'd like to have a local instance at my place, that would aggregate those remote instances and show only alerts from them. That way I could perhaps configure it to send email on alerts (sent from my local Icinga instance)

Marcin Cylke
  • 101
  • 4

3 Answers3

1

For starters you can designate each site with a particular port 8080, 8081, etc. and then use something like autossh to maintain the connections. Then you'd be connected and would just need to go from 8080 to 8081 check each site that you've mapped to a designed local port.

This type of approach could be scaled up so that instead of you looking at each sites' local port, you could have a script do the checking instead. Depending on what's on each site' Icinga site, you could periodically check it with your own Nagios/Icinga site that's been configured to check for the various things you've been checking for manually.

It's really hard to provide more info without more specifics.

slm
  • 7,355
  • 16
  • 54
  • 72
1

Usually the solution would be to set up a distributed Nagios setup with NSCA. However, since you say you don't have Internet access from these hosts and SSH is all you can do, you'll have to get a bit more creative. Probably best would be to maintain SSH sessions as you are now, but with remote port forwarding (-R instead of -L) to provide a socket for NSCA to submit results to a centralized Nagios. You could also have the remote Nagios write results to a file, use SSH to fetch that file, and replay it on a central Nagios server. Either way. you can then look at the web UI on the central Nagios and see results for all your sites. (You'll need to do some configuration management; all the monitoring points you have defined for each host remotely need to be mirrored on the central server.)

techieb0y
  • 4,161
  • 16
  • 17
1

Combine the SSH tunneling suggested by slm with one of the various add-ons that exposes the nagios/icinga status via XML/JSON/SOAP/whatever-you-prefer.

Then you'll need to write (find?) a script that can scrape the status from all of those various localhost:8080, localhost:8081, etc., possibly using check_multi or equivalent.

It will be somewhat fragile, but with carefully defined dependencies and a tool to keep those tunnels open, it could work.

Keith
  • 4,627
  • 14
  • 25
  • 1
    you don't necessarily need an addon for that. you can also use the classic ui json export (namely status.cgi e.g.) - for details on the parameter check the icinga docs: http://docs.icinga.org/latest/en/cgiparams.html Other than that - the Icinga Web Rest API may also suit your needs, if installed. Icinga Mobile uses that e.g. – dnsmichi Jun 18 '13 at 21:16