Javascript - Nagios CGIs

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
estebanmonge
Posts: 50
Joined: Mon Feb 06, 2012 11:13 pm

Javascript - Nagios CGIs

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Javascript - Nagios CGIs

Post 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.
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Javascript - Nagios CGIs

Post 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
Nicholas Scott
Former Nagios employee
estebanmonge
Posts: 50
Joined: Mon Feb 06, 2012 11:13 pm

Re: Javascript - Nagios CGIs

Post 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
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Javascript - Nagios CGIs

Post 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.
Nicholas Scott
Former Nagios employee
estebanmonge
Posts: 50
Joined: Mon Feb 06, 2012 11:13 pm

Re: Javascript - Nagios CGIs

Post 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.
estebanmonge
Posts: 50
Joined: Mon Feb 06, 2012 11:13 pm

Re: Javascript - Nagios CGIs

Post 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!!!
Image

Uploaded with ImageShack.us
estebanmonge
Posts: 50
Joined: Mon Feb 06, 2012 11:13 pm

Re: Javascript - Nagios CGIs

Post 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.
Locked