Page 1 of 2

Views section: Newly added view does not display

Posted: Fri May 25, 2018 2:04 pm
by Phisith
Nagios XI, version 5.4.13

After adding a new view:
- Nothing happens when clicking on the newly added view
- View doesn’t show up in the view rotation

Steps to repro:
1. Click on ‘Views’ --> “Add New View”
2. Enter title and URL and click submit
3. Under ‘My Views’, click on the new link that was added

Re: Views section: Newly added view does not display

Posted: Fri May 25, 2018 2:41 pm
by lmiltchev
I was not able to recreate the issue in Nagios XI 5.4.13. I added a new view:
example01.PNG
and I can see if just fine. It is also included in the rotation.
example02.PNG
What is the URL that you are using? Do you see any errors when you inspect the element in the browser (F12)?

Re: Views section: Newly added view does not display

Posted: Tue May 29, 2018 8:32 am
by Phisith
No external link works. The screenshot is a test for www.google.com. It doesn't show anything except for a blank page.

Re: Views section: Newly added view does not display

Posted: Tue May 29, 2018 8:51 am
by Phisith
After pressing F12. I see an error "The requested URL /nagios/views/www.google.com was not found on this server (see F12_error-2.png).
F12_error-2.png
And also notice a java error on the debug screen (see F12_error-1.png).
F12_error-1.png

Re: Views section: Newly added view does not display

Posted: Tue May 29, 2018 11:00 am
by lmiltchev
Google won't work - it's a setting on their site. They don't allow loading iframes in the browser (as many other sites). Try adding 'https://www.nagios.com/'. Did this work?

Re: Views section: Newly added view does not display

Posted: Tue May 29, 2018 2:26 pm
by Phisith
https://www.nagios.com/ worked.

Is there a way for me to check if a site will work in the Nagios XI view rotation (short of adding it and see what happens)?

Re: Views section: Newly added view does not display

Posted: Tue May 29, 2018 5:04 pm
by scottwilkerson
Phisith wrote:https://www.nagios.com/ worked.

Is there a way for me to check if a site will work in the Nagios XI view rotation (short of adding it and see what happens)?
No, you pretty much are going to have to trial/error.

I will note you need to add the full url including https:// otherwise XI thinks it is local and just a path on the nagios server.

Re: Views section: Newly added view does not display

Posted: Wed May 30, 2018 8:43 am
by lmiltchev
@Phisith, you could use a php script to try to find out if you could use this website in Views.

Example php script (test.php):

Code: Select all

#!/usr/bin/php
<?php
$url = $argv[1];
$header = get_headers($url, 1);
//echo $header["X-Frame-Options"];
if ((@$header["X-Frame-Options"] == "DENY") || (@$header["X-Frame-Options"] == "SAMEORIGIN") || (@$header["X-Frame-Options"] == "ALLOW-FROM")) {
        echo "You can't use this website\n\r";
} else {
        echo "Go ahead. You can use this website\n\r";
}
?>
The way you would use it is by running the following from the command line:

Code: Select all

php test.php <url>
where you substitute <url> with the actual URL of the website. See below:

Code: Select all

[root@main-nagios-xi tmp]# php test.php https://www.npr.org
Go ahead. You can use this website
[root@main-nagios-xi tmp]# php test.php https://www.yahoo.com
You can't use this website
Hope this helps.

Re: Views section: Newly added view does not display

Posted: Wed May 30, 2018 12:40 pm
by Phisith
Nice! Thank you for the php script.

Re: Views section: Newly added view does not display

Posted: Wed May 30, 2018 1:51 pm
by lmiltchev
You are welcome! Can we close this topic?