Page 3 of 3

Re: the map is blank. Error still.

Posted: Mon Apr 18, 2016 5:09 pm
by tmcdonald
Not seeing anything that should throw off a JSON parser like that, and it looks pretty similar to mine. I'm going to have to show this to our Core dev and see what he has to say about it.

Re: the map is blank. Error still.

Posted: Tue Apr 19, 2016 12:35 pm
by jfrickson
The record dumps you provided were for "query": "programstatus", which is unlikely to cause any problem. You should have some other requests to either statusjson.cgi or objectjson.cgi. One or more of them will have the json parse error you showed earlier. That's the one we need to take a look at.

Re: the map is blank. Error still.

Posted: Wed Apr 20, 2016 3:01 am
by United-Networking
Hi,

right, i'll come to that. You're right, there is one from objectjson.cgi as well:

As you can see, this asks for a complete hosts enumeration, which covers several hundred entities and is somewhat sensitive, as it includes our clients' hosts, too. To me, it looks completely normal, though. An anonymized sample:

Code: Select all

{
  "format_version": 0,
  "result": {
    "query_time": 1461136706000,
    "cgi": "objectjson.cgi",
    "user": "nagiosadmin",
    "query": "hostlist",
    "query_status": "released",
    "program_start": 1461074245000,
    "last_data_update": 1461074246000,
    "type_code": 0,
    "type_text": "Success",
    "message": ""
  },
  "data": {
    "selectors": {
    },
    "hostlist": {
      "Host1": {
        "name": "Host1",
        "display_name": "Host1",
        "alias": "host1",
        "address": "host1",
        "parent_hosts": [
          "dyndns.org"
        ],
        "child_hosts": [
        ],
        "services": [
        ],
        "check_command": "check-host-alive",
        "initial_state": "up",
        "check_interval": 5,00,
        "retry_interval": 1,00,
        "max_attempts": 10,
        "event_handler": "",
        "contact_groups": [
          "admins"
        ],
        "contacts": [
          "nagiosadmin",
          "nagiossupport"
        ],
        "notification_interval": 120,00,
        "first_notification_delay": 0,00,
        "notifications_options": [
          "up",
          "down",
          "ok",
          "warning",
          "recovery"
        ],
        "notification_period": "24x7",
        "check_period": "24x7",
        "flap_detection_enabled": true,
        "low_flap_threshold": 0,00,
        "high_flap_threshold": 0,00,
        "flap_detection_options": [
          "up",
          "down",
          "unreachable",
          "ok",
          "unkwown",
          "warning",
          "critical",
          "recovery",
          "pending",
          "flapping",
          "downtime"
        ],
        "stalking_options": [
        ],
        "check_freshness": false,
        "freshness_threshold": 0,
        "process_performance_data": true,
        "checks_enabled": true,
        "accept_passive_checks": true,
        "event_handler_enabled": true,
        "retain_status_information": true,
        "retain_nonstatus_information": true,
        "obsess": true,
        "hourly_value": false,
        "notes": "",
        "notes_url": "",
        "action_url": "",
        "icon_image": "",
        "icon_image_alt": "",
        "vrml_image": "",
        "statusmap_image": "",
        "have_2d_coords": false,
        "x_2d": -1,
        "y_2d": -1,
        "have_3d_coords": false,
        "x_3d": 0,00,
        "y_3d": 0,00,
        "z_3d": 0,00,
        "should_be_drawn": true,
        "custom_variables": {
        }
      },

...

    }
  }
}
I believe nothing much in the way of error causes can be gleaned from that.

But i noted something about angular.min.js, probably also relevant, from the Console Error tab (End line references moved above code lines for clarity):

Code: Select all

"NetworkError: 401 Unauthorized - https://cloud.united-networking.eu/nagios/map-links.html"
map-links.html
"NetworkError: 401 Unauthorized - https://cloud.united-networking.eu/nagios/map-popup.html"
map-popup.html

angular.min.js (Zeile 103)
Error: JSON.parse: expected double-quoted property name at line 33 column 29 of the JSON data
oc@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:14:151
Yb@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:77:125
Yc/<@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:77:487
s@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:7:300
Yc@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:77:469
c@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:79:109
f/<@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:112:343
Pe/this.$get</l.prototype.$eval@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:126:189
Pe/this.$get</l.prototype.$digest@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:123:278
Pe/this.$get</l.prototype.$apply@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:126:469
l@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:81:420
O@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:86:51
wf/</w.onload@https://cloud.united-networking.eu/nagios/angularjs/angular-1.3.9/angular.min.js:87:78

angular.min.js (Zeile 103)
e/<()

angular.min.js (Zeile 76)
He/this.$get</<()
a = Object { type="object"}
c = undefined

angular.min.js (Zeile 112)
f/<()

angular.min.js (Zeile 126)
Pe/this.$get</l.prototype.$eval()
a = Object { type="object"}
b = undefined

angular.min.js (Zeile 123)
Pe/this.$get</l.prototype.$digest()

angular.min.js (Zeile 126)
Pe/this.$get</l.prototype.$apply()
a = undefined

angular.min.js (Zeile 81)
l()
b = 200
c = Object { type="longString"}
d = "Date: Wed, 20 Apr 2016 0...n/json; charset=utf-8\r\n"
e = "OK"

angular.min.js (Zeile 86)
O()
a = Object { type="object"}
d = 200
e = Object { type="longString"}
f = "Date: Wed, 20 Apr 2016 0...n/json; charset=utf-8\r\n"
g = "OK"

angular.min.js (Zeile 87)
wf/</w.onload()
And yes, i felt moved to check on owner and permissions:
They were nagios:nagios and 664, respectively, for all of the files under /nagios and /nagios/js.

Re: the map is blank. Error still.

Posted: Wed Apr 20, 2016 5:12 pm
by Nagios Support
We will need to do some more digging into this, and will get back to you within the next 24 hours.

Re: the map is blank. Error still.

Posted: Thu Apr 21, 2016 9:19 am
by jfrickson
United-Networking wrote:right, i'll come to that. You're right, there is one from objectjson.cgi as well:

As you can see, this asks for a complete hosts enumeration, which covers several hundred entities and is somewhat sensitive, as it includes our clients' hosts, too. To me, it looks completely normal, though. An anonymized sample:

Code: Select all

1  {
2    "format_version": 0,
3    "result": {
4      "query_time": 1461136706000,
5      "cgi": "objectjson.cgi",
6      "user": "nagiosadmin",
7      "query": "hostlist",
8      "query_status": "released",
9      "program_start": 1461074245000,
10     "last_data_update": 1461074246000,
11     "type_code": 0,
12     "type_text": "Success",
13     "message": ""
14   },
15   "data": {
16     "selectors": {
17     },
18     "hostlist": {
19       "Host1": {
20         "name": "Host1",
21         "display_name": "Host1",
22         "alias": "host1",
23         "address": "host1",
24         "parent_hosts": [
25           "dyndns.org"
26         ],
27         "child_hosts": [
28         ],
29         "services": [
30         ],
31         "check_command": "check-host-alive",
32         "initial_state": "up",
33         "check_interval": 5,00,
34         "retry_interval": 1,00,
35         "max_attempts": 10,
36         "event_handler": "",
37         "contact_groups": [
38           "admins"
39         ],

       ----- snip -----
I believe nothing much in the way of error causes can be gleaned from that.

Code: Select all

----- snip -----
Error: JSON.parse: expected double-quoted property name at line 33 column 29 of the JSON data
----- snip -----
Ok, as I suspected, here's the problem. I added line numbers to the JSON object. As the error message says, go to line 33, column 29.

Code: Select all

        "check_interval": 5,00,
....+....1....+....2....+....3
That check_interval number is Five Point Zero Zero. The JSON parser expects numbers to be in 5.00 with a decimal point. The parser saw the comma and expected another object, but it just found 00.

Did you ever put in the fix I proposed in my message from 2016-Apr-14? That fix should be exactly what this needs. It will cause floating-point numbers to be printed in the "correct" format.

Re: the map is blank. Error still.

Posted: Fri Apr 22, 2016 2:57 am
by United-Networking
Hi,

...meaning, in the format that angular.min.js can stomach.

Yes you were apparently right with your proposal on Apr 14. I will go and do that ASAP.

If this remedies the problem, will there be a bugfix release?

Re: the map is blank. Error still.

Posted: Fri Apr 22, 2016 8:46 am
by United-Networking
Hi,

a colleague (for whom the map works) gave me the inspiration for a less painful solution than recompiling and replacing our otherwise working Nagios installation:

In Firefox 45.0.1 (and probably earlier as well), there's a Settings > Content > Language > Choose preferred languages for web page display. This is translated from german, so probably not necessary the same as in an english Firefox.
The following dialogue window listed German, English (US), English.
In about:config, this means changing intl.accept_languages from de,en-US,en to en-US.

I removed all but English (US), [OK]ed that and re-opened that objectjson.cgi list. Lo and behold, the numbers now had a decimal full stop. And also, the Nagios map now works again. Yay!

Since i have no pressing need to read english web pages in german, this means my problem is SOLVED, IMHO.

Re: the map is blank. Error still.

Posted: Fri Apr 22, 2016 8:56 am
by jfrickson
Great! And yes, the fix is in the code for the next release.

I'm happy it's working for you now!