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

[dev.icinga.com #10449] Livestatus log query - filter "class" yields empty results #3540

Closed
icinga-migration opened this issue Oct 23, 2015 · 13 comments
Labels
area/livestatus Legacy interface bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

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

Created by krausm on 2015-10-23 09:12:57 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2015-11-26 18:17:08 +00:00)
Target Version: 2.4.2
Last Update: 2015-12-02 10:17:52 +00:00 (in Redmine)

Icinga Version: 2.3.11
Backport?: Already backported
Include in Changelog: 1

A livetstatus log query with the "class" filter set yields only empty results:

GET log
Columns: class time type state host_name service_description plugin_output message options state_type contact_name
Filter: time >= 1445551200
Filter: time <= 1445637600
Filter: class = 3
And: 3

Attached ist the debug log (nonworking.log.gz) with some additional output ("ADDITIONAL_DEBUG"), indicating that log_class is recognized during log parsing.

Executing the same query without the "class" filter yields results (attached file: working_results.gz):

GET log
Columns: class time type state host_name service_description plugin_output message options state_type contact_name
Filter: time >= 1445551200
Filter: time <= 1445637600
And: 2

Attached is the debug log (working.log.gz), but this shows no real differences.

Very interesting is the result of the working example:

...
;1445589460;SERVICE ALERT;1;i2devel;http;HTTP WARNING: HTTP/1.1 403 Forbidden - 5184 bytes in 0.001 second response time;[1445589460] SERVICE ALERT: i2devel;http;WARNING;HARD;1;HTTP WARNING: HTTP/1.1 403 Forbidden - 5184 bytes in 0.001 second response time ;i2devel;http;WARNING;HARD;1;HTTP WARNING: HTTP/1.1 403 Forbidden - 5184 bytes in 0.001 second response time;HARD;
;1445589460;SERVICE NOTIFICATION;3;i2devel;http;;[1445589460] SERVICE NOTIFICATION: icingaadmin;i2devel;http;WARNING;mail-service-notification;HTTP WARNING: HTTP/1.1 403 Forbidden - 5184 bytes in 0.001 second response time ;;icingaadmin;i2devel;http;WARNING;mail-service-notification;HTTP WARNING: HTTP/1.1 403 Forbidden - 5184 bytes in 0.001 second response time ;;WARNING;icingaadmin
...

The leading ";" indicates, that the column "class" is in fact empty. This would explain the empty result set when using the filter "class".

To summarize: either the filtering using "class" is not working or more probably the class is not stored correctly. My limited knowledge of C** hindered me, digging deeper into the second assumption.

Greetings, Michael

Attachments

Changesets

2015-11-26 18:15:54 +00:00 by mfriedrich 3d4e48a

Livestatus: Fix "class" filter for log table

fixes #10449

2015-11-26 18:18:05 +00:00 by mfriedrich bcb5eef

Livestatus: Fix "class" filter for log table

fixes #10449

2015-12-02 09:08:01 +00:00 by (unknown) 5b7421a

Fix problem with livestatus filter "type"

There was a regression in changeset 3d4e48aa124fd76493fe7ca6584fe6ee541104c5 for issue 10449 that
made the "class" filter work, but broke the "type" filter. Reverting some changes seems to do the
trick.

refs #10449

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>

2015-12-02 10:18:05 +00:00 by (unknown) 1ce8e64

Fix problem with livestatus filter "type"

There was a regression in changeset 3d4e48aa124fd76493fe7ca6584fe6ee541104c5 for issue 10449 that
made the "class" filter work, but broke the "type" filter. Reverting some changes seems to do the
trick.

refs #10449

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>

2015-12-04 09:27:47 +00:00 by mfriedrich 55f804a

Update AUTHORS

refs #10449

2015-12-04 09:28:02 +00:00 by mfriedrich 18b58a0

Update AUTHORS

refs #10449
@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-10-27 20:25:58 +00:00

The parser stores log_type/class

https://github.com/Icinga/icinga2/blob/master/lib/livestatus/livestatuslogutility.cpp#L104

https://github.com/Icinga/icinga2/blob/master/lib/livestatus/livestatuslogutility.cpp#L149

Yet, the logentries are handed over as is
https://github.com/Icinga/icinga2/blob/master/lib/livestatus/logtable.cpp#L108

https://github.com/Icinga/icinga2/blob/master/lib/livestatus/logtable.cpp#L179

Changing the parser prefix for all log types and classes should fix it. Though I can't test my theory on my ipad now.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-11-25 16:07:26 +00:00

  • Status changed from New to Feedback
  • Assigned to set to krausm

@icinga-migration
Copy link
Author

Updated by krausm on 2015-11-26 10:21:23 +00:00

Hi Michi,

at OSMC i had a short talk with Gunnar about that:
i tried to understand and sort out what you suggested in #1, but i have no clue where to start.

Do you have anyone, who could have a look on the code, or do you have a starting point / some code snippets for a c**-noob like me?

With the log parser working, we would have made a huge step for integrating Icinga2 in OMD Labs Edition: there would still exist some rough edges, but no real showstoppers.

Thanks & Greetings,
Michael

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-11-26 18:16:48 +00:00

  • Subject changed from livestatus log query - filter "class" yields empty results to Livestatus log query - filter "class" yields empty results
  • Status changed from Feedback to Assigned
  • Assigned to changed from krausm to mfriedrich
  • Target Version set to 2.5.0

You should learn C** and join the team maintaining the Livestatus feature ;-)

Not fixed

michi@mbmif ~/coding/icinga/icinga2/test/livestatus (master) $ sudo ./run_queries queries/log/class
GET log
Filter: time >= 1348657741
Filter: class = 1
ResponseHeader: fixed16

200           0

Fixed

michi@mbmif ~/coding/icinga/icinga2/test/livestatus (master) $ sudo ./run_queries queries/log/class
Querying Livestatus socket: /usr/local/icinga2/var/run/icinga2/cmd/livestatus
GET log
Filter: time >= 1348657741
Filter: class = 1
ResponseHeader: fixed16

200    11732157
attempt;class;command_name;comment;contact_name;current_command_custom_variable_names;current_command_custom_variable_values;current_command_custom_variables;current_command_line;current_command_modified_attributes;current_command_modified_attributes_list;current_command_name;current_contact_alias;current_contact_can_submit_commands;current_contact_cv_is_json;current_contact_email;current_contact_host_notification_period;current_contact_host_notifications_enabled;current_contact_in_host_notification_period;current_contact_in_service_notification_period;current_contact_modified_attributes;current_contact_modified_attributes_list;current_contact_name;current_contact_pager;current_contact_service_notification_period;current_contact_service_notifications_enabled;current_contact_vars_variable_names;current_contact_vars_variable_values;current_contact_vars_variables;current_host_accept_passive_checks;current_host_acknowledged;current_host_acknowledgement_type;current_host_action_url;current_host_action_url_expanded;current_host_active_checks_enabled;current_host_address;current_host_address6;current_host_alias;current_host_check_command;current_host_check_command_expanded;current_host_check_flapping_recovery_notification;current_host_check_freshness;current_host_check_interval;current_host_check_options;current_host_check_period;current_host_check_source;current_host_check_type;current_host_checks_enabled;current_host_childs;current_host_comments;current_host_comments_with_extra_info;current_host_comments_with_info;current_host_contact_groups;current_host_contacts;current_host_current_attempt;current_host_current_notification_number;current_host_custom_variable_names;current_host_custom_variable_values;current_host_custom_variables;current_host_cv_is_json;current_host_display_name;current_host_downtimes;current_host_downtimes_with_info;current_host_event_handler;current_host_event_handler_enabled;current_host_execution_time;current_host_filename;current_host_first_notification_delay;current_host_flap_detection_enabled;current_host_groups;current_host_hard_state;current_host_has_been_checked;current_host_high_flap_threshold;current_host_host_name;current_host_icon_image;current_host_icon_image_alt;current_host_icon_image_expanded;current_host_in_check_period;current_host_in_notification_period;current_host_initial_state;current_host_is_executing;current_host_is_flapping;current_host_is_reachable;current_host_last_check;current_host_last_hard_state;current_host_last_hard_state_change;current_host_last_notification;current_host_last_state;current_host_last_state_change;current_host_last_time_down;current_host_last_time_unreachable;current_host_last_time_up;current_host_latency;current_host_long_plugin_output;current_host_low_flap_threshold;current_host_max_check_attempts;current_host_modified_attributes;current_host_modified_attributes_list;current_host_name;current_host_next_check;current_host_next_notification;current_host_no_more_notifications;current_host_notes;current_host_notes_expanded;current_host_notes_url;current_host_notes_url_expanded;current_host_notification_interval;current_host_notification_period;current_host_notifications_enabled;current_host_num_services;current_host_num_services_crit;current_host_num_services_hard_crit;current_host_num_services_hard_ok;current_host_num_services_hard_unknown;current_host_num_services_hard_warn;current_host_num_services_ok;current_host_num_services_pending;current_host_num_services_unknown;current_host_num_services_warn;current_host_obsess_over_host;current_host_original_attributes;current_host_parents;current_host_pending_flex_downtime;current_host_percent_state_change;current_host_perf_data;current_host_plugin_output;current_host_pnpgraph_present;current_host_process_performance_data;current_host_retry_interval;current_host_scheduled_downtime_depth;current_host_services;current_host_services_with_info;current_host_services_with_state;current_host_staleness;current_host_state;current_host_state_type;current_host_statusmap_image;current_host_total_services;current_host_worst_service_hard_state;current_host_worst_service_state;current_host_x_2d;current_host_x_3d;current_host_y_2d;current_host_y_3d;current_host_z_3d;current_service_accept_passive_checks;current_service_acknowledged;current_service_acknowledgement_type;current_service_action_url;current_service_action_url_expanded;current_service_active_checks_enabled;current_service_check_command;current_service_check_command_expanded;current_service_check_freshness;current_service_check_interval;current_service_check_options;current_service_check_period;current_service_check_source;current_service_check_type;current_service_checks_enabled;current_service_comments;current_service_comments_with_extra_info;current_service_comments_with_info;current_service_contact_groups;current_service_contacts;current_service_current_attempt;current_service_current_notification_number;current_service_custom_variable_names;current_service_custom_variable_values;current_service_custom_variables;current_service_cv_is_json;current_service_description;current_service_display_name;current_service_downtimes;current_service_downtimes_with_info;current_service_event_handler;current_service_event_handler_enabled;current_service_execution_time;current_service_first_notification_delay;current_service_flap_detection_enabled;current_service_groups;current_service_has_been_checked;current_service_high_flap_threshold;current_service_icon_image;current_service_icon_image_alt;current_service_icon_image_expanded;current_service_in_check_period;current_service_in_notification_period;current_service_initial_state;current_service_is_executing;current_service_is_flapping;current_service_is_reachable;current_service_last_check;current_service_last_hard_state;current_service_last_hard_state_change;current_service_last_notification;current_service_last_state;current_service_last_state_change;current_service_last_time_critical;current_service_last_time_ok;current_service_last_time_unknown;current_service_last_time_warning;current_service_latency;current_service_long_plugin_output;current_service_low_flap_threshold;current_service_max_check_attempts;current_service_modified_attributes;current_service_modified_attributes_list;current_service_next_check;current_service_next_notification;current_service_no_more_notifications;current_service_notes;current_service_notes_expanded;current_service_notes_url;current_service_notes_url_expanded;current_service_notification_interval;current_service_notification_period;current_service_notifications_enabled;current_service_obsess_over_service;current_service_original_attributes;current_service_percent_state_change;current_service_perf_data;current_service_plugin_output;current_service_pnpgraph_present;current_service_process_performance_data;current_service_retry_interval;current_service_scheduled_downtime_depth;current_service_service_description;current_service_staleness;current_service_state;current_service_state_type;host_accept_passive_checks;host_acknowledged;host_acknowledgement_type;host_action_url;host_action_url_expanded;host_active_checks_enabled;host_address;host_address6;host_alias;host_check_command;host_check_command_expanded;host_check_flapping_recovery_notification;host_check_freshness;host_check_interval;host_check_options;host_check_period;host_check_source;host_check_type;host_checks_enabled;host_childs;host_comments;host_comments_with_extra_info;host_comments_with_info;host_contact_groups;host_contacts;host_current_attempt;host_current_notification_number;host_custom_variable_names;host_custom_variable_values;host_custom_variables;host_cv_is_json;host_display_name;host_downtimes;host_downtimes_with_info;host_event_handler;host_event_handler_enabled;host_execution_time;host_filename;host_first_notification_delay;host_flap_detection_enabled;host_groups;host_hard_state;host_has_been_checked;host_high_flap_threshold;host_host_name;host_icon_image;host_icon_image_alt;host_icon_image_expanded;host_in_check_period;host_in_notification_period;host_initial_state;host_is_executing;host_is_flapping;host_is_reachable;host_last_check;host_last_hard_state;host_last_hard_state_change;host_last_notification;host_last_state;host_last_state_change;host_last_time_down;host_last_time_unreachable;host_last_time_up;host_latency;host_long_plugin_output;host_low_flap_threshold;host_max_check_attempts;host_modified_attributes;host_modified_attributes_list;host_name;host_next_check;host_next_notification;host_no_more_notifications;host_notes;host_notes_expanded;host_notes_url;host_notes_url_expanded;host_notification_interval;host_notification_period;host_notifications_enabled;host_num_services;host_num_services_crit;host_num_services_hard_crit;host_num_services_hard_ok;host_num_services_hard_unknown;host_num_services_hard_warn;host_num_services_ok;host_num_services_pending;host_num_services_unknown;host_num_services_warn;host_obsess_over_host;host_original_attributes;host_parents;host_pending_flex_downtime;host_percent_state_change;host_perf_data;host_plugin_output;host_pnpgraph_present;host_process_performance_data;host_retry_interval;host_scheduled_downtime_depth;host_services;host_services_with_info;host_services_with_state;host_staleness;host_state;host_state_type;host_statusmap_image;host_total_services;host_worst_service_hard_state;host_worst_service_state;host_x_2d;host_x_3d;host_y_2d;host_y_3d;host_z_3d;lineno;message;options;plugin_output;service_description;state;state_type;time;type
1;1;;;;;;;;0;0;;;1;;;;;;;0;0;;;;;;;;1;0;0;;;1;;;icingacamp;check_hostalive!;check_hostalive!;0;1;5;;24x7;mbmif.int.netways.de;0;1;;;;;;;1;0;service_range;15;service_range|15;0;icingacamp;;;;1;0.0110571;;;0;hg1,hg2;1;1;30;icingacamp;;;;1;1;;0;0;1;1448561326;1;1444411001;0;1;1444410969;0;0;0;0;Usage:\ncheck_ping -H  -w ,% -c ,%\n [-p packets] [-t timeout] [-4;30;3;0;0;icingacamp;1448561816;0;0;;;;;1;;1;15;5;1;3;3;1;5;0;4;1;0;null;parent;0;0;;check_ping: Invalid hostname/address - ;0;0;1;0;random-0,random-1,random-10,random-11,random-12,random-13,random-14,random-2,random-3,random-4,random-5,random-6,random-7,random-8,random-9;random-0|3|1|Hello from mbmif.local,random-1|2|1|Hello from mbmif.local,random-10|0|1|Hello from mbmif.local,random-11|0|1|Hello from mbmif.local,random-12|2|1|Hello from mbmif.local,random-13|0|1|Hello from mbmif.local,random-14|3|1|Hello from mbmif.local,random-2|2|1|Hello from mbmif.local,random-3|2|1|Hello from mbmif.local,random-4|1|1|Hello from mbmif.local,random-5|2|1|Hello from mbmif.local,random-6|0|1|Hello from mbmif.local,random-7|3|1|Hello from mbmif.local,random-8|3|1|Hello from mbmif.local,random-9|0|1|Hello from mbmif.local;random-0|3|1,random-1|2|1,random-10|0|1,random-11|0|1,random-12|2|1,random-13|0|1,random-14|3|1,random-2|2|1,random-3|2|1,random-4|1|1,random-5|2|1,random-6|0|1,random-7|3|1,random-8|3|1,random-9|0|1;0.000265794;1;1;;15;3;3;;;;;;1;0;0;;;1;check_random!;check_random!;1;0.0833333;;24x7;mbmif.int.netways.de;0;1;;;;;;1;0;;;;;random-3;random-3;;;;1;0.0018611;;0;;1;30;;;;1;1;;0;0;0;1448561613;2;1448561613;0;3;1448561613;1448561613;1448561604;1448561609;1448561608;0;;30;3;0;0;1448561618;0;0;;;;;1;;1;0;null;22;time=1448561613.3136981;Hello from mbmif.local;0;1;0.0166667;0;random-3;1.67455e-05;2;1;1;0;0;;;1;;;icingacamp;check_hostalive!;check_hostalive!;0;1;5;;24x7;mbmif.int.netways.de;0;1;;;;;;;1;0;service_range;15;service_range|15;0;icingacamp;;;;1;0.0110571;;;0;hg1,hg2;1;1;30;icingacamp;;;;1;1;;0;0;1;1448561326;1;1444411001;0;1;1444410969;0;0;0;0;Usage:\ncheck_ping -H  -w ,% -c ,%\n [-p packets] [-t timeout] [-4;30;3;0;0;icingacamp;1448561816;0;0;;;;;1;;1;15;5;1;3;3;1;5;0;4;1;0;null;parent;0;0;;check_ping: Invalid hostname/address - ;0;0;1;0;random-0,random-1,random-10,random-11,random-12,random-13,random-14,random-2,random-3,random-4,random-5,random-6,random-7,random-8,random-9;random-0|3|1|Hello from mbmif.local,random-1|2|1|Hello from mbmif.local,random-10|0|1|Hello from mbmif.local,random-11|0|1|Hello from mbmif.local,random-12|2|1|Hello from mbmif.local,random-13|0|1|Hello from mbmif.local,random-14|3|1|Hello from mbmif.local,random-2|2|1|Hello from mbmif.local,random-3|2|1|Hello from mbmif.local,random-4|1|1|Hello from mbmif.local,random-5|2|1|Hello from mbmif.local,random-6|0|1|Hello from mbmif.local,random-7|3|1|Hello from mbmif.local,random-8|3|1|Hello from mbmif.local,random-9|0|1|Hello from mbmif.local;random-0|3|1,random-1|2|1,random-10|0|1,random-11|0|1,random-12|2|1,random-13|0|1,random-14|3|1,random-2|2|1,random-3|2|1,random-4|1|1,random-5|2|1,random-6|0|1,random-7|3|1,random-8|3|1,random-9|0|1;0.000265795;1;1;;15;3;3;;;;;;72;[1448560928] SERVICE ALERT: icingacamp;random-3;OK;HARD;1;Hello from mbmif.local;icingacamp;random-3;OK;HARD;1;Hello from mbmif.local;Hello from mbmif.local;random-3;0;HARD;1448560928;6
...
...

Unfortunately the Livestatus protocol specification does not provide values for the "type" field, so this cannot be filtered by integer values (but is fixed as well).

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-11-26 18:17:08 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 3d4e48a.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-11-26 18:18:10 +00:00

  • Target Version changed from 2.5.0 to 2.4.2
  • Backport? changed from TBD to Yes

@icinga-migration
Copy link
Author

Updated by krausm on 2015-11-27 15:16:59 +00:00

Hi Michi,

i can confirm, your "class" filter works. Ran your test "test/livestatus/queries/log/class" against a freshly checked out Icinga (branch: master).

But as i ran all your provided tests using run_queries, it seems, that the filter "type" is broken:
Your tests "avail" and "avail_svc" bail out.

With some queries i found out, that no "type" filter works:

First using "time" and "class" restriction works:

GET log
Columns: class time type state host_name service_description plugin_output message options state_type contact_name
Filter: time >= 1348657741
Filter: class = 1
And: 2
ResponseHeader: fixed16

200        3318
1;1448636202;6;0;i2devel;procs;PROCS OK: 103 processes;[1448636202] SERVICE ALERT: i2devel;procs;OK;HARD;1;PROCS OK: 103 processes ;i2devel;procs;OK;HARD;1;PROCS OK: 103 processes;HARD;
1;1448636208;6;0;i2devel;load;OK - load average: 0.70, 0.78, 0.44;[1448636208] SERVICE ALERT: i2devel;load;OK;HARD;1;OK - load average: 0.70, 0.78, 0.44;i2devel;load;OK;HARD;1;OK - load average: 0.70, 0.78, 0.44;HARD;
...

But using EVERY "type" filter leads to an error message:

GET log
Columns: class time type state host_name service_description plugin_output message options state_type contact_name
Filter: time >= 1348657741
Filter: type = HOST ALERT
And: 2
ResponseHeader: fixed16

452        3812
Error: Can't convert 'HOST ALERT' to a floating point number.

    (0) liblivestatus.so: void boost::throw_exception >(boost::exception_detail::error_info_injector const&) (+0xe8) [0x7f892b66e6e8]
    (1) liblivestatus.so: void boost::exception_detail::throw_exception_(std::invalid_argument const&, char const*, char const*, int) (+0x69) [0x7f892b66e7a9]
    (2) liblivestatus.so: double icinga::Convert::ToDouble(icinga::String const&) (+0x40a) [0x7f892b67dd7a]
    (3) liblivestatus.so: icinga::AttributeFilter::Apply(boost::intrusive_ptr const&, icinga::Value const&) (+0x52f) [0x7f892b65737f]
    (4) liblivestatus.so: icinga::AndFilter::Apply(boost::intrusive_ptr const&, icinga::Value const&) (+0x2f) [0x7f892b6133cf]
    (5) liblivestatus.so: icinga::Table::FilteredAddRow(std::vector >&, boost::intrusive_ptr const&, int, icinga::Value const&, icinga::LivestatusGroupByType, boost::intrusive_ptr const&) (+0x73) [0x7f892b6426d3]
    (6) liblivestatus.so: boost::detail::function::function_obj_invoker3 >&, boost::intrusive_ptr const&, int, icinga::Value const&, icinga::LivestatusGroupByType, boost::intrusive_ptr const&>, boost::_bi::list7, boost::reference_wrapper > >, boost::_bi::value >, boost::_bi::value, boost::arg<1>, boost::arg<2>, boost::arg<3> > >, bool, icinga::Value const&, icinga::LivestatusGroupByType, boost::intrusive_ptr const&>::invoke(boost::detail::function::function_buffer&, icinga::Value const&, icinga::LivestatusGroupByType, boost::intrusive_ptr const&) (+0x3c) [0x7f892b664bfc]
    (7) liblivestatus.so: icinga::LogTable::UpdateLogEntries(boost::intrusive_ptr const&, int, int, boost::function const&)> const&) (+0xcf) [0x7f892b642d7f]
    (8) liblivestatus.so: icinga::LivestatusLogUtility::CreateLogCache(std::map, std::allocator > >, icinga::HistoryTable*, long, long, boost::function const&)> const&) (+0x3ad) [0x7f892b65d38d]
    (9) liblivestatus.so: icinga::LogTable::FetchRows(boost::function const&)> const&) (+0x299) [0x7f892b65db99]
    (10) liblivestatus.so: icinga::Table::FilterRows(boost::intrusive_ptr const&, int) (+0x17c) [0x7f892b619c0c]
    (11) liblivestatus.so: icinga::LivestatusQuery::ExecuteGetHelper(boost::intrusive_ptr const&) (+0xf3) [0x7f892b6615e3]
    (12) liblivestatus.so: icinga::LivestatusQuery::Execute(boost::intrusive_ptr const&) (+0x254) [0x7f892b662b24]
    (13) liblivestatus.so: icinga::LivestatusListener::ClientHandler(boost::intrusive_ptr const&) (+0x1b7) [0x7f892b662f37]
    (14) libbase.so: icinga::ThreadPool::WorkerThread::ThreadProc(icinga::ThreadPool::Queue&) (+0x313) [0x7f8936de9bc3]
    (15) libboost_thread-mt.so.1.53.0:  (+0xd24a) [0x7f893781d24a]
    (16) libpthread.so.0:  (+0x7df5) [0x7f8933ec0df5]
    (17) libc.so.6: clone (+0x6d) [0x7f89343d31ad]

Notice the Error: Can't convert 'HOST ALERT' to a floating point number.

As already said, this happens with all other types as well.

Many greetings,
Michael

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-11-27 15:33:09 +00:00

I can't find any reference of filtering for the "type" attribute in the MK live status docs, so I assume you can't do that.

@icinga-migration
Copy link
Author

Updated by krausm on 2015-11-27 16:10:46 +00:00

I did nothave a look at the docs, but seemingly Thruk uses this for its menu point "Alerts".

As already said also icinga2's own tests contain those filters already (see avail and avail_svc).

The type is set, as well as the class, for example:

        else if (type.Contains("CURRENT HOST STATE")) {
            bag->Set("class", LogEntryClassState);
            bag->Set("type", LogEntryTypeHostCurrentState);
        } 

Maybe i try with an older version in the next couple of days, as i wonder, why i did not see this error earlier, since clicking "Alerts" in Thruk when testing is quite normal, and i cannot imagine, that i haven't tried clicking it before...

Greetings,
Michael

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-11-27 17:50:40 +00:00

Those "tests" were a manual attempt by myself in order to get some use cases and results. No need for being correct or complete. I'll happily purge them when I find the time to finish the boost tests for Livestatus.

If you think that "type" should be filtered, open a new issue. This one targets the "class" only which has been fixed.

Kind regards,
Michael

@icinga-migration
Copy link
Author

Updated by krausm on 2015-12-02 08:35:32 +00:00

Hi Michi,

sorry for the late response and thank you for the clarification.

I started to dig into the issue to open a new issue, but then i discovered, that the type filtering may be a regression:

Livestatus query used is:

GET log
Columns: class time type state host_name service_description plugin_output message options state_type contact_name
Filter: time >= 1348657741
Filter: type = HOST ALERT
And: 2
ResponseHeader: fixed16

When testing that against Icinga2 2.3.11, the result is:

200         220
;1448889486;HOST ALERT;0;;;PING OK - Packet loss = 0%, RTA = 0.04 ms;[1448889486] HOST ALERT: i2devel;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.04 ms;i2devel;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.04 ms;HARD;

Testing it against Icinga2 master( 6a83703 ), the result is:

452        3952
Error: Can't convert 'HOST ALERT' to a floating point number.

    (0) liblivestatus.so: void boost::throw_exception >(boost::exception_detail::error_info_injector const&) (+0xe8) [0x7fa229be1848]
    (1) liblivestatus.so: void boost::exception_detail::throw_exception_(std::invalid_argument const&, char const*, char const*, int) (+0x69) [0x7fa229be1909]
    (2) liblivestatus.so: double icinga::Convert::ToDouble(icinga::String const&) (+0x40a) [0x7fa229bf0e9a]
    (3) liblivestatus.so: icinga::AttributeFilter::Apply(boost::intrusive_ptr const&, icinga::Value const&) (+0x772) [0x7fa229bc97e2]
    (4) liblivestatus.so: icinga::AndFilter::Apply(boost::intrusive_ptr const&, icinga::Value const&) (+0x2f) [0x7fa229b8523f]
    (5) liblivestatus.so: icinga::AndFilter::Apply(boost::intrusive_ptr const&, icinga::Value const&) (+0x2f) [0x7fa229b8523f]
    (6) liblivestatus.so: icinga::Table::FilteredAddRow(std::vector >&, boost::intrusive_ptr const&, int, icinga::Value const&, icinga::LivestatusGroupByType, boost::intrusive_ptr const&) (+0x73) [0x7fa229bb4843]
    (7) liblivestatus.so: boost::detail::function::function_obj_invoker3 >&, boost::intrusive_ptr const&, int, icinga::Value const&, icinga::LivestatusGroupByType, boost::intrusive_ptr const&>, boost::_bi::list7, boost::reference_wrapper > >, boost::_bi::value >, boost::_bi::value, boost::arg<1>, boost::arg<2>, boost::arg<3> > >, bool, icinga::Value const&, icinga::LivestatusGroupByType, boost::intrusive_ptr const&>::invoke(boost::detail::function::function_buffer&, icinga::Value const&, icinga::LivestatusGroupByType, boost::intrusive_ptr const&) (+0x3c) [0x7fa229bd7e8c]
    (8) liblivestatus.so: icinga::LogTable::UpdateLogEntries(boost::intrusive_ptr const&, int, int, boost::function const&)> const&) (+0xcf) [0x7fa229bb4eef]
    (9) liblivestatus.so: icinga::LivestatusLogUtility::CreateLogCache(std::map, std::allocator > >, icinga::HistoryTable*, long, long, boost::function const&)> const&) (+0x3ad) [0x7fa229bd06bd]
    (10) liblivestatus.so: icinga::LogTable::FetchRows(boost::function const&)> const&) (+0x299) [0x7fa229bd0ec9]
    (11) liblivestatus.so: icinga::Table::FilterRows(boost::intrusive_ptr const&, int) (+0x17c) [0x7fa229b8bb2c]
    (12) liblivestatus.so: icinga::LivestatusQuery::ExecuteGetHelper(boost::intrusive_ptr const&) (+0xf3) [0x7fa229bd4913]
    (13) liblivestatus.so: icinga::LivestatusQuery::Execute(boost::intrusive_ptr const&) (+0x254) [0x7fa229bd5e54]
    (14) liblivestatus.so: icinga::LivestatusListener::ClientHandler(boost::intrusive_ptr const&) (+0x1b7) [0x7fa229bd6267]
    (15) libbase.so: icinga::ThreadPool::WorkerThread::ThreadProc(icinga::ThreadPool::Queue&) (+0x313) [0x7fa23119ebc3]
    (16) libboost_thread-mt.so.1.53.0:  (+0xd24a) [0x7fa231bd224a]
    (17) libpthread.so.0:  (+0x7df5) [0x7fa22e275df5]
    (18) libc.so.6: clone (+0x6d) [0x7fa22e7881ad]

So it seems changing "log_type" to "type" caused some kind of regression. I will try to inspect that tonight.

My question is: do we track that regression here, or should i open a new issue?

Many Greetings,
Michael

@icinga-migration
Copy link
Author

Updated by krausm on 2015-12-02 09:06:40 +00:00

  • File added 0001-Fixed-problem-with-livestatus-filter-type-notworking.patch

I reverted "type" to "log_type" in your changeset - that seems to do the trick:

Both queries

...
Filter: class = 1
...

and

...
Filter: type = HOST ALERT
....

now return results.

Patch file is attached.

Many greetings,
Michael

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-12-02 10:17:52 +00:00

Ah ok, thanks. Merged.

@icinga-migration icinga-migration added bug Something isn't working area/livestatus Legacy interface labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.4.2 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/livestatus Legacy interface bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant