Page 1 of 1
Javascript - Nagios CGIs
Posted: Thu Jan 03, 2013 12:45 am
by estebanmonge
Hi folks:
Is it possible to insert Javascript code in Extra Actions icon for make a dropdown menu instead a link?
The idea is add more than one link in the icon for different actions.
Thanks
Re: Javascript - Nagios CGIs
Posted: Thu Jan 03, 2013 10:52 am
by slansing
The only way to do this is to modify the core CGI's and then recompile Nagios, this is a standard feature on Nagios XI but not core.
Re: Javascript - Nagios CGIs
Posted: Thu Jan 03, 2013 1:47 pm
by nscott
If Nagios XI is completely out of the question you could checkout V-Shell. Its a popular web frontend for Nagios Core.
http://exchange.nagios.org/directory/Ad ... ll/details
Re: Javascript - Nagios CGIs
Posted: Thu Jan 03, 2013 4:45 pm
by estebanmonge
OK... Can I obtain vía PHP/HTML/JavaScript without modify CGI some variables, such IP or HOSTNAME? For example adding HTML code to SSI share files.
I tried to insert PHP code in SSI files but doesn't works
Re: Javascript - Nagios CGIs
Posted: Thu Jan 03, 2013 5:17 pm
by nscott
Well, you could try the SSI approach, I would recommend using a PHP frontend, but if you want to go this route its availabe, here is the overview on sourceforge:
http://nagios.sourceforge.net/docs/3_0/cgiincludes.html
It will only include headers and footers, but that should do it for you.
Re: Javascript - Nagios CGIs
Posted: Thu Jan 03, 2013 7:18 pm
by estebanmonge
OK, to use PHP you need create a PHP CLI script, for example:
#!/usr/bin/php
<?php
echo "<b>Nagios es pura vida</b>";
?>
But I have the dude... I want capture the hostname and create a dropdown menu in header for make ping.
Re: Javascript - Nagios CGIs
Posted: Thu Jan 03, 2013 9:51 pm
by estebanmonge
Okis, I can make a little menu with util options with pure CSS and PHP code, I can adquire via URL the hostname.
In the image can see the look, and for demonstrative purposes I printed the hostname.
Now I need the IP, but via URL it's impossible, I have two options:
Via MK livestatus, I know how do it, but isn't standard and need additional steps
Via pure Nagios tricks... I don't know how, status.cgi, status.dat ¿? ¡¡¡Help appreciated!!!
Uploaded with
ImageShack.us
Re: Javascript - Nagios CGIs
Posted: Sat Jan 05, 2013 12:04 pm
by estebanmonge
Finally I can obtain IP via Livestatus and pure PHP code!!! thanks to LiveStatusSlave... I going to upload the script in the web comming soon.