Icinga / icinga-web

Icinga Web 1.x, the old new web interface (EOL 31.12.2018)
22 stars 11 forks source link

[dev.icinga.com #3064] Bad Evaluation of process_perf_data (current icinga-web gitmaster 7c59) #892

Closed icinga-migration closed 12 years ago

icinga-migration commented 12 years ago

This issue has been migrated from Redmine: https://dev.icinga.com/issues/3064

Created by ossmon on 2012-09-04 13:33:37 +00:00

Assignee: mhein Status: Resolved (closed on 2012-10-11 15:42:18 +00:00) Target Version: 1.8 Last Update: 2012-10-11 15:42:18 +00:00 (in Redmine)

Icinga Version: 1.7.0
Icinga Web Version: 1.8.0
IDO Version: 1.7.0
OS Version: RHEL6.1
DB Type: MySQL
DB Version: 5.1.61
Browser Version: Firefox 11.0

With the new Integration on PNP4Nagios, the evaluation of the parameter process_perf_data doesn't work anymore. The PNP4Nagios Icons should be only displayed if the parameter is 1.

Attachments

Changesets

2012-10-11 12:35:29 +00:00 by mhein f7268eb4a30a7db8470f1cdb5af9c7d4e60cdb39

Fixes #3064 EXTUTIL.Event chaining problem
icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-09-24 14:41:42 +00:00

what do you mean by "new pnp4nagios integration"? what did change?

icinga-migration commented 12 years ago

Updated by ossmon on 2012-09-24 17:48:13 +00:00

Hi dnsmichi, in the icinga web master that I have installed, there was a redesign of the integration of the pnp4nagios icon, as also the info box pop up. When you click, on a service, a new line will be inserted with the icons. The icons for pnp4nagios and info box are no more present as columns. I will do tomorrow a screenshot (i'am now at home :-))

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-09-24 17:51:37 +00:00

ah, the detail pages?

icinga_web_1.8_detailspages.png

icinga-migration commented 12 years ago

Updated by ossmon on 2012-09-24 18:00:38 +00:00

You were faster. Yes it is the new design that I mean.

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-09-24 18:01:34 +00:00

ok, i am not very familar with this right now. but i guess, web devs got a bug ;-)

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-10-04 17:10:48 +00:00

using

service status popup icinga_web_1.8_details_pnpgraphs_popup.png

host status popup icinga_web_1.8_details_pnpgraphs_popup_host.png

service pnp cronk (untitled name is #3240) icinga_web_1.8_details_pnpgraphs_cronk.png

for me, this is looking good. can you recheck, if your hosts/services really have "process_perf_data" set to 1?

icinga-migration commented 12 years ago

Updated by ossmon on 2012-10-04 19:57:07 +00:00

Hi, the problem was with services or hosts which have process_perf_data = 0. In this case, the pnp icon should not be displayed. Do you have some services or hosts ?

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-10-04 20:26:46 +00:00

ah ok. now i get it.

i guess, this only checks, if the perfdata column contains valid data?

attached is a config for that.

icinga_web_1.8_3064_perfdata_icon_there.png

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-10-04 21:11:45 +00:00

since the handling of all such template grids has been extensively rewritten, the pnp template extension now holds conditions.

                                    show

                                        function() {
                                            if (this.getRecord().get("process_performance_data") === "1") {
                                                return true;
                                            } else {
                                                return false;
                                            }
                                        }

app/modules/Cronks/lib/js/Cronk/grid/events/EventMixin.js evaluates the condition name, as well as fires the fn function, evaluting on "show", if the items will be shown or not.

i am not sure whether the condition on === "1" is wrong, or process_performance_data is always set to 1 in this regard.

if (this.getRecord().get("process_performance_data") === "1") {

the field itsself is defined...

                HOST_PROCESS_PERFORMANCE_DATA

the debug query looks like this

SELECT DISTINCT i.icon_image AS i__0, i2.instance_name AS i2__1, i.host_object_id AS i__2, i4.name1 AS i4__3, i.alias AS i__4, i.display_name AS i__5, i3.current_state AS i3__
6, (CASE WHEN i3.last_state_change<='1970-01-01 00:00:00' THEN i5.program_start_time ELSE i3.last_state_change END) AS i__7, i3.last_check AS i3__8, i3.next_check AS i3__9, i5.program_start_time AS i5__10, i3.output AS i3__11, i3.current_check_attempt AS i3__12, 
i3.max_check_attempts AS i3__13, i3.process_performance_data AS i3__14, i3.max_check_attempts AS i3__15, i3.perfdata AS i3__16, i2.instance_id AS i2__17, i.host_id AS i__18, i.action_url AS i__19, i.notes_url AS i__20, (i3.has_been_checked-1)*-1 AS i__21, i3.noti
fications_enabled AS i3__22, i3.problem_has_been_acknowledged AS i3__23, i3.scheduled_downtime_depth AS i3__24, i3.has_been_checked AS i3__25 FROM icinga_hosts i LEFT JOIN icinga_instances i2 ON i.instance_id = i2.instance_id LEFT JOIN icinga_hoststatus i3 ON i.h
ost_object_id = i3.host_object_id LEFT JOIN icinga_objects i4 ON i.host_object_id = i4.object_id LEFT JOIN icinga_programstatus i5 ON i2.instance_id = i5.instance_id WHERE (i.config_type = '1')
[Thu Oct  4 21:04:20 2012] [debug] API_Views_ApiDQLViewModel::getResult()@82 : Processing query SELECT DISTINCT i.icon_image AS i__0, i2.instance_name AS i2__1, i.host_object_id AS i__2, i4.name1 AS i4__3, i.alias AS i__4, i.display_name AS i__5, i3.current_state
 AS i3__6, (CASE WHEN i3.last_state_change<='1970-01-01 00:00:00' THEN i5.program_start_time ELSE i3.last_state_change END) AS i__7, i3.last_check AS i3__8, i3.next_check AS i3__9, i5.program_start_time AS i5__10, i3.output AS i3__11, i3.current_check_attempt AS 
i3__12, i3.max_check_attempts AS i3__13, i3.process_performance_data AS i3__14, i3.max_check_attempts AS i3__15, i3.perfdata AS i3__16, i2.instance_id AS i2__17, i.host_id AS i__18, i.action_url AS i__19, i.notes_url AS i__20, (i3.has_been_checked-1)*-1 AS i__21,
 i3.notifications_enabled AS i3__22, i3.problem_has_been_acknowledged AS i3__23, i3.scheduled_downtime_depth AS i3__24, i3.has_been_checked AS i3__25 FROM icinga_hosts i LEFT JOIN icinga_instances i2 ON i.instance_id = i2.instance_id LEFT JOIN icinga_hoststatus i
3 ON i.host_object_id = i3.host_object_id LEFT JOIN icinga_objects i4 ON i.host_object_id = i4.object_id LEFT JOIN icinga_programstatus i5 ON i2.instance_id = i5.instance_id WHERE (i.config_type = '1') LIMIT 25 

and its resultset for 3064localhost-test

{"HOST_ICON_IMAGE":"s.gif' width='0' height='0' border='0'><\/a>

so the data backend is correct, but it seems that the condition match for showing the data is not.

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-10-04 21:14:47 +00:00

ok. even when i manipulate the function handler, always returning false, the icon gets shown.

                                /pnp4nagios/image?host={host_name}&srv=_HOST_&view=0
                                icinga-icon-image-arrow

                                400
                                Hostgraph for {host_name}

                                    show

                                        function() {
                                        //if (this.getRecord().get("process_performance_data") === "1") {
                                        //      return true;
                                        //  } else {
                                                return false;
                                                //  }
                                        }

                            grideventbutton
                            pnp4nagios_host_image_hover
                            icinga-icon-image-arrow
                            Host performance chart
                            Graph

so my final guess - the return value of that function is never evaluated and somehow always true.

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-10-04 21:24:16 +00:00

this function adds "show" as c.condition, and wraps the final name into "testShowcondition", which is called below, doing the visibility foo.

                    var name = c.condition + "condition";
                    var internalName = "test" + Ext.util.Format.capitalize(name);
                    var fn = Ext.decode(c.fn);

                    if (Ext.isFunction(this[internalName])) {
                        this.internalConditionMethods[name] = this[internalName];
                    }

                    if (Ext.isFunction(fn)) {
                        this.on(name, fn, this);
                    }

fireEvent will call the inner function, returning the value into testShowcondition.

        testConditions: function() {
            Ext.iterate(this.internalConditionMethods, function(eventName, runFn) {
                runFn.call(this, this.fireEvent(eventName));
            }, this);
        },

so from a coders perspective, this looks good, though my js debugging capabilities end here.

icinga-migration commented 12 years ago

Updated by mhein on 2012-10-11 12:38:22 +00:00

Applied in changeset f7268eb4a30a7db8470f1cdb5af9c7d4e60cdb39.

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-10-11 13:32:42 +00:00

sorry, have to reopen - it's partly resolved, so the initial cause not showing it, actually is.

icinga_web_1.8_3064_nopnp_correct.png

but - all the hosts which have it set =1 only show the "detail" item, an "graph" vanished.

icinga_web_1.8_3064_pnp_popup_vanished.png

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-10-11 13:39:28 +00:00

ok, more tests - it's only a valid bug for the host view.

the services will show "graph" like normal.

icinga_web_1.8_3064_graph_services_ok.png

icinga-migration commented 12 years ago

Updated by mhein on 2012-10-11 15:33:55 +00:00

I think it's closed now

icinga-migration commented 12 years ago

Updated by mfriedrich on 2012-10-11 15:42:18 +00:00

yep, looking good.

the one fixed

icinga_web_1.8_3064_graph_hostsok.png

and the one without anything (greyed out activation could work too, but is confusing)

icinga_web_1.8_3064_nograph_hostsok.png

new template install required, and clearcache