shinken-solutions / shinken

Flexible and scalable monitoring framework
http://www.shinken-monitoring.org
GNU Affero General Public License v3.0
1.13k stars 336 forks source link

add support for anag (android app with widget support) #650

Closed kiranos closed 9 years ago

kiranos commented 11 years ago

I would like that anag supported Shinken, we use it heavily for its widget of active alarms. http://damien.degois.info/android/aNag/summary

It supports cgi and json (icinga 1.6+) Would be great if shinken ui could generate these compatible json output.

With anag support there is no need for shinkens own app.

xkilian commented 11 years ago

Shinken supports the Livestatus API, which has Python and JSON based output formats. Livestatus is a very flexible and powerful query language. aNag should support Livestatus, which is the standard for getting state data out of Nagios3 and Shinken.

It would certainly be a great addition to see aNag have backend support from both Icinga and Shinken via Livestatus.

Thank you.

naparuba commented 11 years ago

Yes, asking an UI to export raw data is not a good way, and should be better to use a true api, like LiveStatus.

Jean

On Tue, Oct 30, 2012 at 4:14 AM, xkilian notifications@github.com wrote:

Shinken supports the Livestatus API, which has Python and JSON based output formats. Livestatus is a very flexible and powerful query language. aNag should support Livestatus, which is the standard for getting state data out of Nagios3 and Shinken.

It would certainly be a great addition to see aNag have backend support from both Icinga and Shinken via Livestatus.

Thank you.

— Reply to this email directly or view it on GitHubhttps://github.com/naparuba/shinken/issues/650#issuecomment-9893760.

kiranos commented 11 years ago

Got a reply:

Mk Livestatus is a module to query status via a kind of rest API directly from the process memory (in Nagios and Icinga). When I tested this, there was no authentication and no way to submit commands. So it doesn't fit aNag needs.

Can you provide some info of how this can be achieved?

naparuba commented 11 years ago

I'm not sure for the auth thing, but for command there is no problem about it (maybe add after you looked at).

Jean

On Tue, Oct 30, 2012 at 8:59 AM, Stefan Eriksson notifications@github.comwrote:

Got a reply:

Mk Livestatus is a module to query status via a kind of rest API directly from the process memory (in Nagios and Icinga). When I tested this, there was no authentication and no way to submit commands. So it doesn't fit aNag needs.

Can you provide some info of how this can be achieved?

— Reply to this email directly or view it on GitHubhttps://github.com/naparuba/shinken/issues/650#issuecomment-9897393.

kiranos commented 11 years ago

There is support for AUTH I found from 1.13+ of livestatus

david-guenault commented 11 years ago

livestatus is the best way to query and interact with nagios/shinken monitoring system from an external tool. But i do not recomment to expose directly livestatus, we should consider creating some json webservice that take real authentication. This is not a really big deal but need some development.

sound interesting for me

2012/10/30 Stefan Eriksson notifications@github.com

There is support I found from 1.13+ of livestatus

Reply to this email directly or view it on GitHubhttps://github.com/naparuba/shinken/issues/650#issuecomment-9898316.

olivierHa commented 11 years ago

Hello

I agree with David, Livestatus is great, but exposing it directly isn't recommended. A module or an addon to the webui could be best to deal with aNag.

Regards

Olivier

2012/10/30 David GUENAULT notifications@github.com

livestatus is the best way to query and interact with nagios/shinken monitoring system from an external tool. But i do not recomment to expose directly livestatus, we should consider creating some json webservice that take real authentication. This is not a really big deal but need some development.

sound interesting for me

2012/10/30 Stefan Eriksson notifications@github.com

There is support I found from 1.13+ of livestatus

Reply to this email directly or view it on GitHub< https://github.com/naparuba/shinken/issues/650#issuecomment-9898316>.

— Reply to this email directly or view it on GitHubhttps://github.com/naparuba/shinken/issues/650#issuecomment-9899202.

babs commented 11 years ago

I can handle lot's of things in aNag but it has to fit particular criteria, that's all :)

Regards, D.

olivierHa commented 11 years ago

Why closing this issue ?

Json output is something we can do I think

babs commented 11 years ago

I'd be glad to try to implement this on aNag, and I'm open to discuss but what about order submission ? Would it be possible to mimic an icinga output and/or command submission ?

olivierHa commented 11 years ago

Yes I think it is possible to "mimic" the output of icinga. Is there any spec somewhere of their json output ?

2013/1/22 Damien Degois notifications@github.com

I'd be glad to try to implement this on aNag, and I'm open to discuss but what about order submission ? Would it be possible to mimic an icinga output and/or command submission ?

— Reply to this email directly or view it on GitHubhttps://github.com/naparuba/shinken/issues/650#issuecomment-12541018.

babs commented 11 years ago

I can summarize what it looks like :D

babs commented 11 years ago

all requests are object (key => value) All "root object" contains a json version key containing the version as string In newer version, all request contains a key with an object that state the monitoring process status (PID, active, last status change age [useful for crash detection] ...)

{
    "cgi_json_version": "1.9.0", 
    "icinga_status": {
        "check_host_freshness": false, 
        "check_service_freshness": true, 
        "disable_notifications_expire_time": 0, 
        "event_handlers_enabled": true, 
        "flap_detection_enabled": true, 
        "host_checks_being_executed": true, 
        "icinga_pid": 24712, 
        "last_external_command_check": 1358180177, 
        "last_log_file_rotation": 1358118000, 
        "notifications_enabled": true, 
        "obsessing_over_hosts": false, 
        "obsessing_over_services": false, 
        "passive_host_checks_being_accepted": true, 
        "passive_service_checks_being_accepted": true, 
        "performance_data_being_processed": true, 
        "process_state_ok": true, 
        "program_start": 1356047788, 
        "program_version": "1.9.0dev", 
        "reading_status_data_ok": true, 
        "service_checks_being_executed": true, 
        "status_data_age": 678157, 
        "timezone": "CET", 
        "total_running_time": "32d 12h 42m 27s"
    }, 
   <payload's request (status, downtime, TAC etc...)>
}

then elements looks like this: For status element they are in a status key that contains one of the following two array of objects, a service_status array OR a host_status array (depends of what you're asking for). Those contains objects with following attributes (almost those shown by CGI HTML tables with completed with more info):

{
"action_url": null, 
"active_checks_enabled": true, 
"attempts": "1/5", 
"duration": "1d  6h 28m 37s", 
"has_been_acknowledged": false, 
"host_display_name": "c1-db1",
"host_name": "c1-db1", 
"in_scheduled_downtime": false, 
"is_flapping": false, 
"last_check": "01-22-2013 13:29:12", 
"notes_url": null, 
"notifications_enabled": true, 
"passive_checks_enabled": true, 
"service_description": "MySQL",  ## Only on service status
"service_display_name": "MySQL", ## Only on service status
"state_type": "HARD", 
"status": "OK", 
"status_information": "MySQL: OK, SQLquery OK - Query took 11.635 sec"
}

Downtimes contains the same as html output, I can find out key values if needed (also for other outputs) :)

Regards, Damien

babs commented 11 years ago

JSON ouput is a kind of output plugin. It's an argument (jsonoutput) to append to the status.cgi query string that change its output behavior but keep the server side filtering.

On another hand, it might be preferable to have all-in-one output [status (services and hosts)] in one gziped output.

This said, the server side mechanism, is pretty interesting when talking about mobile devices, to filter out Ok services to avoid network quota consumption and CPU/RAM/battery waste etc.

olivierHa commented 11 years ago

In fact, maybe (don't know if it is possible), a wrapper of livestatus to answer such queries. Could you send some full examples of queries/answers ?

2013/1/22 Damien Degois notifications@github.com

JSON ouput is a kind of output plugin. It's an argument (jsonoutput) to append to the status.cgi query string that change its output behavior but keep the server side filtering.

On another hand, it might be preferable to have all-in-one output [status (services and hosts)] in one gziped output.

This said, the server side mechanism, is pretty interesting when talking about mobile devices, to filter out Ok services to avoid network quota consumption and CPU/RAM/battery waste etc.

— Reply to this email directly or view it on GitHubhttps://github.com/naparuba/shinken/issues/650#issuecomment-12542999.

babs commented 11 years ago

A wrapper over livestatus to filter translation + output refoactoring, why not but what about action / command submissions ?

naparuba commented 11 years ago

LiveStatus manage the command execution too.

Jean On Tue, Jan 22, 2013 at 2:41 PM, Damien Degois notifications@github.comwrote:

r over livestatus to filter translation + output refoactoring, why not but what about action / command sub

babs commented 11 years ago

Sweet! recheck host, service, all services of an host, submit passive results, ack (with expiration), custom notif,disable notif (service/host/all services of an host), downtime ?

naparuba commented 11 years ago

All commands are possible, even adding a poller without reboot :)

Jean On Tue, Jan 22, 2013 at 4:49 PM, Damien Degois notifications@github.comwrote:

(with expiration)

babs commented 11 years ago

Perfect. Does the wrapper will be a separate element (adaptable to other mklivestatus compatible monitoring servers) ?

If yes, it might be interesting to think about a standardized/general API (query/result and submission/status) with just few changes for each particular backends :)

Damien

Seb-Solon commented 10 years ago

Any news on that? I think it's module related btw

olivierHa commented 10 years ago

Indeed, it is module related. :)

2014-07-15 15:40 GMT+02:00 Sébastien Coavoux notifications@github.com:

Any news on that? I think it's module related btw

— Reply to this email directly or view it on GitHub https://github.com/naparuba/shinken/issues/650#issuecomment-49032480.

babs commented 10 years ago

I've no clue on module structure nor entry point. I'm pretty busy now, is there a crash course ?

Seb-Solon commented 10 years ago

Well I can explain you basically how LS work. Come in #shinken freenode if you have time :)

naparuba commented 9 years ago

I close as it do not impact framework now :)

babs commented 9 years ago

Just an update for late readers. The best way is to use Thruk and connect aNag to it :)

naparuba commented 9 years ago

Really cool ^^