Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ScriptAlias for our happy green checkmark. #343

Merged
merged 1 commit into from Aug 20, 2015

Conversation

ChrisLundquist
Copy link
Contributor

It appears /cgi-bin/jsonstatus.cgi is hard coded, make it work.

$ grep -r "getCoreStatus" .
./html/main.php:        getCoreStatus();
./html/main.php:    function getCoreStatus() {
$ sudo grep -r "main.php" .
./html/index.php:$url = 'main.php';
./html/side.php:            <li><a href="main.php" target="<?php echo $link_target;?>">Home</a></li>
./update-version:perl -i -p -e "s/this_year = '.*';/this_year = '$YEAR';/;" html/main.php
./update-version:perl -i -p -e "s/releasedate\">.*<\//releasedate\">$LONGDATE<\//;" html/main.php
./update-version:perl -i -p -e "s/this_version = '.*';/this_version = '$newversion';/;" html/main.php

It appears /cgi-bin/jsonstatus.cgi is hard coded, make it work.

```
$ grep -r "getCoreStatus" .
./html/main.php:		getCoreStatus();
./html/main.php:	function getCoreStatus() {
```

```
$ sudo grep -r "main.php" .
./html/index.php:$url = 'main.php';
./html/side.php:			<li><a href="main.php" target="<?php echo $link_target;?>">Home</a></li>
./update-version:perl -i -p -e "s/this_year = '.*';/this_year = '$YEAR';/;" html/main.php
./update-version:perl -i -p -e "s/releasedate\">.*<\//releasedate\">$LONGDATE<\//;" html/main.php
./update-version:perl -i -p -e "s/this_version = '.*';/this_version = '$newversion';/;" html/main.php
```
@@ -18,6 +18,7 @@
Alias /stylesheets /etc/<%= node['nagios']['server']['vname'] %>/stylesheets
<% end -%>
ScriptAlias <%= node['nagios']['cgi-path'] %> <%= node['nagios']['cgi-bin'] %>
ScriptAlias /cgi-bin/statusjson.cgi <%= node['nagios']['cgi-bin'] %>/statusjson.cgi

This comment was marked as outdated.

This comment was marked as outdated.

@sbotman
Copy link
Contributor

sbotman commented Mar 17, 2015

I see your point. And while looking at this again, it's basically the same as the line above it.
Will investigate on my environment what is going on here, because currently I have no clue what this cgi does :)

@ChrisLundquist
Copy link
Contributor Author

The problem on Ubuntu 14.04 was that node['nagios']['cgi-path'] ended with nagios3/ and the javascript call did not match. The real solution is to have nagios core fix this based on ./configure options, but that seems like it might take longer.

@bheuvel
Copy link
Contributor

bheuvel commented May 19, 2015

@sbotman , @ChrisLundquist
Checked on 'server-source-centos-70' and 'server-source-ubuntu-1204';
while the "regular" cgi urls are nicely generated upon the configure switch '--with-cgiurl', this specific call to this specific URL has apparently not been made variable and result in:
$.get('cgi-bin/statusjson.cgi?query=programstatus', function(d) {

As @ChrisLundquist indicated, this would need to be corrected in the Nagios Core (configure/compile) indeed.

Untill then, JSON status url, in the home.php page, will allways use
$.get('cgi-bin/statusjson.cgi?query=programstatus', function(d) {

which results in NOT getting a green checkmark with message such as "Daemon running with PID 25975".

A link to more info on the JSON pages
When using the '/jsonquery.html', it will generate url's for "all" (3) jsonpages.

So a workaround could be to ADD
ScriptAlias /cgi-bin/statusjson.cgi <%= node['nagios']['cgi-bin'] %>/statusjson.cgi
which would "fix" the home.php page

or (option 2)

ScriptAlias /cgi-bin/statusjson.cgi <%= node['nagios']['cgi-bin'] %>/statusjson.cgi
ScriptAlias /cgi-bin/objectjson.cgi <%= node['nagios']['cgi-bin'] %>/objectjson.cgi
ScriptAlias /cgi-bin/archivejson.cgi <%= node['nagios']['cgi-bin'] %>/archivejson.cgi

which would "fix" all JSON pages, but keep explicit exceptions/workarounds
or (option 3)

ScriptAlias /cgi-bin <%= node['nagios']['cgi-bin'] %>

which would "fix" all JSON pages, but might be to generic and create a conflict with potential other websites hosted on the same server.

All have pros and cons, "therefore" I would suggest to use option 1 for now, iow use this pull request.

@sbotman
Copy link
Contributor

sbotman commented Aug 12, 2015

@bheuvel, your suggestion is to merge this if I understand you correctly? If so, please do :)

bheuvel added a commit that referenced this pull request Aug 20, 2015
Add ScriptAlias for our happy green checkmark.
@bheuvel bheuvel merged commit e8b4a32 into sous-chefs:master Aug 20, 2015
@lock
Copy link

lock bot commented Jul 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants