| Languages: |
English • Deutsch |
| ||||||||||||||||||||||||||||||||||||
Description of the Addon / Plugin
Contents |
c2n.cgi (c2n) is a filter/wrapper for the frontend of Cacti to include it in Nagios.
It includes the Cacti interface in the right frame of the Nagios web interface. It filters out any possiblity to switch from one host to another using cacti menus. Therefore the authentication system of Nagios will take place and the authentication system of Cacti is unused. It is not possible with a native Cacti to set it up in a distributed manner.
It is also not possible to have several Cacti installations with one interface. c2n.cgi can handle multiple installations of Cacti with seperate databases.
All performance data can be reached via the approriate link (action or notes URL) within the host object.
As a side effect Cacti access is much more faster because a lot of complex an huge Javascripts used for navigation are filtered out. As more hosts are in Cacti as more complex and browser time consuming are these scripts.
It is easy. Place c2n.cgi in a valid CGI directory. I used the nagios cgi directory. Enable the guest account in your Cacti.
It would be good if you hide your cacti. This can be done by using a non public servername (or something like that) or setting up your webserver as a reverse proxy (httpd.conf):
.... LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_connect_module modules/mod_proxy_connect.so ..... # Setting for reverse proxy - M.Fuerstenau - 20.9.2008 ProxyVia On # Start settings for reverse proxy - M.Fuerstenau # Reverse proxy was needed for Cacti and for some administrative websites # because these servers are not reachable from the client network ProxyPass /ci0/ http://server1/ ProxyPassReverse /ci0/ http://server1/ ProxyPass /ci1/ http://server2/ ProxyPassReverse /ci1/ http://server2/ # End settings for reverse proxy - M.Fuerstenau ....
The benefit of using a reverse proxy is that you can use a cacti instance on a server behind a firewall or whereever. It is extremely usefull if the users of the Nagios web frontend are not allowed to connect to that Cacti instance due to security regulations.
In my case I can reach a lot of servers from my Nagios machine only via a firewall. Therefore a central NRPE server is running behind the firewall doing the checks. And now I placed a second Cacti on that server too.
It is possible to make a proxy entry for the local server too. So you can hide a cacti running on the machine like your Nagios.
Not much:
%URL_PART1 = (
0 => "$CALLING_SERVER/ci0",
1 => "$CALLING_SERVER/ci1"
);
%DBHOST = (
0 => "mysqlsrv",
1 => "cacti_probe"
);
%DBLOGIN = (
0 => "stat4nag",
1 => "stat4nag"
);
%DBPASS = (
0 => "stat",
1 => "stat"
);
%DATABASE = (
0 => "cacti",
1 => "cacti"
);
%DBPORT = (
0 => "3306",
1 => "3306"
);
%URL_PART1 makes the mappings for the reverse proxy. The rest is clear.
In every hostdefinition place a line like that:
action_url c2n.cgi?host=$HOSTNAME$&nagios=1&cacti_instance=0
where nagios=1 means the first filter block in the script and cacti_instance=0 means the cacti instance where the index 0 in %URL_PART1 points to. You can also use notes_url instead of action_url.
In cgi.cfg set
# URL TARGET FRAMES # These options determine the target frames in which notes and # action URLs will open. action_url_target=main notes_url_target=main
Set action_url_target or notes_url_target (whatever you prefer) to main. Otherwise a new browser is opened.