shinken-monitoring / mod-livestatus

Shinken module for presenting data with a MK/Livestatus comptabile interface
GNU Affero General Public License v3.0
15 stars 20 forks source link

Livestatus return string instead of integer for "last_hard_state" #12

Closed Frescha closed 9 years ago

Frescha commented 10 years ago

I used the following Livestatus Query to get information from a nagios host with livestatus enabled:

GET services
Columns: host_state host_name state last_hard_state

The result was:

0;localhost;0;0

Now I am querying Shinken 1.2.4 with the same query, the result differs:

0;localhost;0;OK 

The result should be the same as the result of the livestatus implementation of Mathias Kettner.

Frescha commented 10 years ago

https://github.com/naparuba/shinken/issues/873

olivierHa commented 10 years ago

Shinken 1.2.4 ?

2013/12/8 Andreas Karfusehr notifications@github.com

naparuba/shinken#873 https://github.com/naparuba/shinken/issues/873

— Reply to this email directly or view it on GitHubhttps://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-30087636 .

LarsMichelsen commented 10 years ago

Guys, please fix this. This is a livestatus protocol violation. This makes NagVis only_hard_states mode, which uses the last_hard_state field, unusuable with Shinken. The field needs to provide integer state representations, just like the state field.

olivierHa commented 10 years ago

I will try to reproduce it.

2014-01-28 LaMi- notifications@github.com

Guys, please fix this. This is a livestatus protocol violation. This makes NagVis only_hard_states mode, which uses the last_hard_state field, unusuable with Shinken. The field needs to provide integer state representations, just like the state field.

Reply to this email directly or view it on GitHubhttps://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-33520236 .

LarsMichelsen commented 10 years ago

Seems it uses the wrong field. Here my grep & quick fix. It is untested, but should solve the problem.

diff --git a/module/mapping.py b/module/mapping.py
index 5433dfa..a24eb90 100644
--- a/module/mapping.py
+++ b/module/mapping.py
@@ -455,7 +455,7 @@ livestatus_attribute_map = {
         },
         'last_hard_state': {
             'description': 'Last hard state',
-            'function': lambda item, req: item.last_hard_state,
+            'function': lambda item, req: item.last_hard_state_id,
             'datatype': int,
         },
         'last_hard_state_change': {
LarsMichelsen commented 10 years ago

Why is there no progress on this issue? There is a patch available and it is a trivial fix.

Again: NagVis support is broken without this fix.

lausser commented 10 years ago

Hi,

i applied your patch. It’s true, NagVis was not usable without it.

Gerhard

Von: LaMi- [mailto:notifications@github.com] Gesendet: Donnerstag, 17. April 2014 08:21 An: shinken-monitoring/mod-livestatus Betreff: Re: [mod-livestatus] Livestatus return string instead of integer for "last_hard_state" (#12)

Why is there no progress on this issue? There is a patch available and it is a trivial fix.

Again: NagVis support is broken without this fix.

— Reply to this email directly or view it on GitHub https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40684766 . https://github.com/notifications/beacon/198968__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMzMzNDg4NCwiZGF0YSI6eyJpZCI6MjE2NjQ2OTV9fQ==--d95784d17db2ccfe089d478a6779615a0619a6f5.gif

naparuba commented 10 years ago

Thanks :)

On Thu, Apr 17, 2014 at 9:03 AM, Gerhard Lausser notifications@github.comwrote:

Hi,

i applied your patch. It’s true, NagVis was not usable without it.

Gerhard

Von: LaMi- [mailto:notifications@github.com] Gesendet: Donnerstag, 17. April 2014 08:21 An: shinken-monitoring/mod-livestatus Betreff: Re: [mod-livestatus] Livestatus return string instead of integer for "last_hard_state" (#12)

Why is there no progress on this issue? There is a patch available and it is a trivial fix.

Again: NagVis support is broken without this fix.

— Reply to this email directly or view it on GitHub < https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40684766> . < https://github.com/notifications/beacon/198968__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMzMzNDg4NCwiZGF0YSI6eyJpZCI6MjE2NjQ2OTV9fQ==--d95784d17db2ccfe089d478a6779615a0619a6f5.gif>

— Reply to this email directly or view it on GitHubhttps://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40686878 .

LarsMichelsen commented 10 years ago

Yay, thanks a lot!

Do you already have a schedule for the next release (which includes this fix)?

Best regards Lars

On 17.04.2014 09:13, Gabès Jean wrote:

Thanks :)

On Thu, Apr 17, 2014 at 9:03 AM, Gerhard Lausser notifications@github.comwrote:

Hi,

i applied your patch. It’s true, NagVis was not usable without it.

Gerhard

Von: LaMi- [mailto:notifications@github.com] Gesendet: Donnerstag, 17. April 2014 08:21 An: shinken-monitoring/mod-livestatus Betreff: Re: [mod-livestatus] Livestatus return string instead of integer for "last_hard_state" (#12)

Why is there no progress on this issue? There is a patch available and it is a trivial fix.

Again: NagVis support is broken without this fix.

— Reply to this email directly or view it on GitHub <

https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40684766> . <

https://github.com/notifications/beacon/198968__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMzMzNDg4NCwiZGF0YSI6eyJpZCI6MjE2NjQ2OTV9fQ==--d95784d17db2ccfe089d478a6779615a0619a6f5.gif>

— Reply to this email directly or view it on GitHubhttps://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40686878 .

— Reply to this email directly or view it on GitHub https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40687463.

Lars Michelsen IT Keltenstraße 4 85586 Poing

Mobile: +49 151 26965801 E-Mail: lm@larsmichelsen.com

naparuba commented 10 years ago

It's published: http://shinken.io/package/livestatus :)

On Thu, Apr 17, 2014 at 9:15 AM, LaMi- notifications@github.com wrote:

Yay, thanks a lot!

Do you already have a schedule for the next release (which includes this fix)?

Best regards Lars

On 17.04.2014 09:13, Gabès Jean wrote:

Thanks :)

On Thu, Apr 17, 2014 at 9:03 AM, Gerhard Lausser notifications@github.comwrote:

Hi,

i applied your patch. It’s true, NagVis was not usable without it.

Gerhard

Von: LaMi- [mailto:notifications@github.com] Gesendet: Donnerstag, 17. April 2014 08:21 An: shinken-monitoring/mod-livestatus Betreff: Re: [mod-livestatus] Livestatus return string instead of integer for "last_hard_state" (#12)

Why is there no progress on this issue? There is a patch available and it is a trivial fix.

Again: NagVis support is broken without this fix.

— Reply to this email directly or view it on GitHub <

https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40684766

. <

https://github.com/notifications/beacon/198968__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMzMzNDg4NCwiZGF0YSI6eyJpZCI6MjE2NjQ2OTV9fQ==--d95784d17db2ccfe089d478a6779615a0619a6f5.gif

— Reply to this email directly or view it on GitHub< https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40686878

.

— Reply to this email directly or view it on GitHub < https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40687463 .

Lars Michelsen IT Keltenstraße 4 85586 Poing

Mobile: +49 151 26965801 E-Mail: lm@larsmichelsen.com

— Reply to this email directly or view it on GitHubhttps://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40687587 .

LarsMichelsen commented 10 years ago

lol, nice one! Thanks

On 17.04.2014 09:23, Gabès Jean wrote:

It's published: http://shinken.io/package/livestatus :)

On Thu, Apr 17, 2014 at 9:15 AM, LaMi- notifications@github.com wrote:

Yay, thanks a lot!

Do you already have a schedule for the next release (which includes this fix)?

Best regards Lars

On 17.04.2014 09:13, Gabès Jean wrote:

Thanks :)

On Thu, Apr 17, 2014 at 9:03 AM, Gerhard Lausser notifications@github.comwrote:

Hi,

i applied your patch. It’s true, NagVis was not usable without it.

Gerhard

Von: LaMi- [mailto:notifications@github.com] Gesendet: Donnerstag, 17. April 2014 08:21 An: shinken-monitoring/mod-livestatus Betreff: Re: [mod-livestatus] Livestatus return string instead of integer for "last_hard_state" (#12)

Why is there no progress on this issue? There is a patch available and it is a trivial fix.

Again: NagVis support is broken without this fix.

— Reply to this email directly or view it on GitHub <

https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40684766

. <

https://github.com/notifications/beacon/198968__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMzMzNDg4NCwiZGF0YSI6eyJpZCI6MjE2NjQ2OTV9fQ==--d95784d17db2ccfe089d478a6779615a0619a6f5.gif

— Reply to this email directly or view it on GitHub<

https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40686878

.

— Reply to this email directly or view it on GitHub <

https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40687463

.

Lars Michelsen IT Keltenstraße 4 85586 Poing

Mobile: +49 151 26965801 https://eiger:7001/12/0015126965801 E-Mail: lm@larsmichelsen.com

— Reply to this email directly or view it on GitHubhttps://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40687587 .

— Reply to this email directly or view it on GitHub https://github.com/shinken-monitoring/mod-livestatus/issues/12#issuecomment-40688003.

Lars Michelsen IT Keltenstraße 4 85586 Poing

Mobile:+49 151 26965801 https://eiger:7001/12/0015126965801 E-Mail: lm@larsmichelsen.com

gst commented 9 years ago

better late than never.