shinken Package

Diagrams

Simple Acknowledge class diagram :

Inheritance diagram of shinken.acknowledge.Acknowledge

Simple Action class diagram :

Inheritance diagram of shinken.action.__Action, shinken.action.Action, shinken.eventhandler.EventHandler, shinken.notification.Notification, shinken.check.Check

Simple AutoSlots class diagram :

Simple BaseModule class diagram :

Simple Borg class diagram :

Inheritance diagram of shinken.borg.Borg, shinken.macroresolver.MacroResolver

Simple Brok class diagram :

Inheritance diagram of shinken.brok.Brok

Simple CherryPyBackend class diagram :

Simple Comment class diagram :

Inheritance diagram of shinken.comment.Comment

Simple ComplexExpressionFactory class diagram :

Inheritance diagram of shinken.complexexpression.ComplexExpressionFactory

Simple ComplexExpressionNode class diagram :

Inheritance diagram of shinken.complexexpression.ComplexExpressionNode

Simple ContactDowntime class diagram :

Inheritance diagram of shinken.contactdowntime.ContactDowntime

Simple Daemon class diagram :

Simple Daterange class diagram :

Inheritance diagram of shinken.daterange.Daterange, shinken.daterange.CalendarDaterange, shinken.daterange.StandardDaterange, shinken.daterange.MonthWeekDayDaterange, shinken.daterange.MonthDateDaterange, shinken.daterange.WeekDayDaterange, shinken.daterange.MonthDayDaterange

Simple DB class diagram :

Inheritance diagram of shinken.db.DB, shinken.db_oracle.DBOracle, shinken.db_mysql.DBMysql, shinken.db_sqlite.DBSqlite

Simple declared class diagram :

Inheritance diagram of shinken.trigger_functions.declared

Simple DependencyNode class diagram :

Inheritance diagram of shinken.dependencynode.DependencyNode

Simple DependencyNodeFactory class diagram :

Inheritance diagram of shinken.dependencynode.DependencyNodeFactory

Simple Dispatcher class diagram :

Inheritance diagram of shinken.dispatcher.Dispatcher

Simple Downtime class diagram :

Inheritance diagram of shinken.downtime.Downtime

Simple DummyCommandCall class diagram :

Inheritance diagram of shinken.commandcall.DummyCommandCall, shinken.commandcall.CommandCall

Simple ExternalCommand class diagram :

Simple ExternalCommandManager class diagram :

Simple Graph class diagram :

Inheritance diagram of shinken.graph.Graph

Simple HTTPClient class diagram :

Simple HTTPDaemon class diagram :

Simple Load class diagram :

Inheritance diagram of shinken.load.Load

Simple Log class diagram :

Inheritance diagram of shinken.log.Log

Simple memoized class diagram :

Inheritance diagram of shinken.memoized.memoized

Simple Message class diagram :

Inheritance diagram of shinken.message.Message

Simple ModulesContext class diagram :

Simple ModulesManager class diagram :

Simple ModulePhases class diagram :

Simple Property class diagram :

Inheritance diagram of shinken.property.Property, shinken.property.UnusedProp, shinken.property.BoolProp, shinken.property.IntegerProp, shinken.property.FloatProp, shinken.property.CharProp, shinken.property.StringProp, shinken.property.PathProp, shinken.property.ConfigPathProp, shinken.property.ListProp, shinken.property.LogLevelProp, shinken.property.DictProp, shinken.property.AddrProp

Simple SatelliteLink class diagram :

Simple Scheduler class diagram :

Simple SortedDict class diagram :

Inheritance diagram of shinken.sorteddict.SortedDict

Simple Timerange class diagram :

Inheritance diagram of shinken.daterange.Timerange

Simple Worker class diagram :

Inheritance diagram of shinken.worker.Worker

Simple WSGIREFBackend class diagram :

Package

shinken Package

acknowledge Module

class shinken.acknowledge.Acknowledge(ref, sticky, notify, persistent, author, comment, end_time=0)[source]

Allows you to acknowledge the current problem for the specified service. By acknowledging the current problem, future notifications (for the same servicestate) are disabled.

id = 1
properties = {'comment': None, 'author': None, 'sticky': None, 'end_time': None, 'id': None, 'notify': None}

action Module

class shinken.action.Action[source]

Bases: shinken.action.__Action

execute__(force_shell=False)[source]
kill__()[source]

autoslots Module

The AutoSlots Class is a MetaClass: it manages how other classes are created (Classes, not instances of theses classes). Here it’s role is to create the __slots__ list of the class with all properties of Class.properties and Class.running_properties so we do not have to add manually all properties to the __slots__ list when we add a new entry

class shinken.autoslots.AutoSlots[source]

Bases: type

basemodule Module

bin Module

This file is to be imported by every Shinken service component: Arbiter, Scheduler, etc. It just checks for the main requirement of Shinken.

borg Module

class shinken.borg.Borg[source]

Bases: object

Here is the new-style Borg (not much more complex then the “old-style”)

brok Module

class shinken.brok.Brok(type, data)[source]

A Brok is a piece of information exported by Shinken to the Broker. Broker can do whatever he wants with it.

id = 0
my_type = 'brok'
prepare()[source]

check Module

class shinken.check.Check(status, command, ref, t_to_go, dep_check=None, id=None, timeout=10, poller_tag='None', reactionner_tag='None', env={}, module_type='fork', from_trigger=False, dependency_check=False)[source]

Bases: shinken.action.Action

ODO: Add some comment about this class for the doc

copy_shell()[source]

return a copy of the check but just what is important for execution So we remove the ref and all

get_id()[source]
get_return_from(c)[source]
is_dependent()[source]
is_launchable(t)[source]
my_type = 'check'
properties = {'check_type': <shinken.property.IntegerProp object at 0x7fc33484e710>, 'exit_status': <shinken.property.IntegerProp object at 0x7fc3340fa150>, 'reactionner_tag': <shinken.property.StringProp object at 0x7fc33484e5d0>, 's_time': <shinken.property.FloatProp object at 0x7fc3340faf10>, 'check_time': <shinken.property.IntegerProp object at 0x7fc3340fab90>, 'long_output': <shinken.property.StringProp object at 0x7fc3340fa550>, 'state': <shinken.property.IntegerProp object at 0x7fc3340fad10>, 'internal': <shinken.property.BoolProp object at 0x7fc33484ec10>, 'u_time': <shinken.property.FloatProp object at 0x7fc3340fa290>, 'env': <shinken.property.StringProp object at 0x7fc33484e950>, 'ref': <shinken.property.IntegerProp object at 0x7fc3340faa10>, 'from_trigger': <shinken.property.BoolProp object at 0x7fc33484e990>, 'status': <shinken.property.StringProp object at 0x7fc3340fa2d0>, 'execution_time': <shinken.property.FloatProp object at 0x7fc3340fa850>, 'worker': <shinken.property.StringProp object at 0x7fc33484efd0>, 't_to_go': <shinken.property.IntegerProp object at 0x7fc3340fa210>, 'module_type': <shinken.property.StringProp object at 0x7fc33484ef90>, 'dep_check': <shinken.property.StringProp object at 0x7fc3340fad90>, '_in_timeout': <shinken.property.BoolProp object at 0x7fc3340fa450>, 'type': <shinken.property.StringProp object at 0x7fc3340fa710>, 'depend_on': <shinken.property.StringProp object at 0x7fc3340fa410>, 'is_a': <shinken.property.StringProp object at 0x7fc3340fa750>, 'poller_tag': <shinken.property.StringProp object at 0x7fc33484e690>, 'output': <shinken.property.StringProp object at 0x7fc3340fae90>, 'perf_data': <shinken.property.StringProp object at 0x7fc33484ef50>}
set_type_active()[source]
set_type_passive()[source]

commandcall Module

class shinken.commandcall.CommandCall(commands, call, poller_tag='None', reactionner_tag='None', enable_environment_macros=0)[source]

Bases: shinken.commandcall.DummyCommandCall

This class is use when a service, contact or host define a command with args.

args
call
command
enable_environment_macros
get_command_and_args()[source]

We want to get the command and the args with ! splitting. but don’t forget to protect against the ! to do not split them

get_name()[source]
id = 0
is_valid()[source]
late_linkify_with_command(commands)[source]
module_type
my_type = 'CommandCall'
poller_tag
properties = {'poller_tag': <shinken.property.StringProp object at 0x7fc334b44850>, 'reactionner_tag': <shinken.property.StringProp object at 0x7fc334b44e90>, 'valid': <shinken.property.BoolProp object at 0x7fc334b449d0>, 'call': <shinken.property.StringProp object at 0x7fc334dcba90>, 'enable_environment_macros': <shinken.property.BoolProp object at 0x7fc334b44790>, 'timeout': <shinken.property.IntegerProp object at 0x7fc334b44990>, 'late_relink_done': <shinken.property.BoolProp object at 0x7fc334b447d0>, 'command': <shinken.property.StringProp object at 0x7fc334dcb950>, 'args': <shinken.property.StringProp object at 0x7fc334b44950>, 'module_type': <shinken.property.StringProp object at 0x7fc334b44a50>}
reactionner_tag
timeout
valid
class shinken.commandcall.DummyCommandCall[source]

Bases: object

Ok, slots are fun: you cannot set the __autoslots__ on the same class you use, fun isn’t it? So we define* a dummy useless class to get such :)

comment Module

class shinken.comment.Comment(ref, persistent, author, comment, comment_type, entry_type, source, expires, expire_time)[source]
id = 1
properties = {'comment': None, 'source': None, 'entry_time': None, 'comment_type': None, 'author': None, 'expire_time': None, 'entry_type': None, 'can_be_deleted': None, 'expires': None, 'persistent': None}

complexexpression Module

class shinken.complexexpression.ComplexExpressionFactory(ctx='hostgroups', grps=None, all_elements=None)[source]

Bases: object

eval_cor_pattern(pattern)[source]
find_object(pattern)[source]
class shinken.complexexpression.ComplexExpressionNode[source]

Bases: object

is_valid()[source]
resolve_elements()[source]

contactdowntime Module

class shinken.contactdowntime.ContactDowntime(ref, start_time, end_time, author, comment)[source]
cancel()[source]
check_activation()[source]
enter()[source]
exit()[source]
id = 1
in_scheduled_downtime()[source]
properties = {'comment': None, 'author': None, 'start_time': None, 'is_in_effect': None, 'end_time': None, 'can_be_deleted': None}

daemon Module

daterange Module

class shinken.daterange.CalendarDaterange(syear, smon, smday, swday, swday_offset, eyear, emon, emday, ewday, ewday_offset, skip_interval, other)[source]

Bases: shinken.daterange.Daterange

get_start_and_end_time(ref=None)[source]
class shinken.daterange.Daterange(syear, smon, smday, swday, swday_offset, eyear, emon, emday, ewday, ewday_offset, skip_interval, other)[source]

Bases: object

get_min_from_t(t)[source]
get_min_sec_from_morning()[source]
get_min_sec_out_from_morning()[source]
classmethod get_month_by_id(month_id)[source]
classmethod get_month_id(month)[source]
get_next_future_timerange_invalid(t)[source]
get_next_future_timerange_valid(t)[source]
get_next_invalid_day(t)[source]
get_next_invalid_time_from_t(t)[source]
get_next_valid_day(t)[source]
get_next_valid_time_from_t(t)[source]
get_start_and_end_time(ref=None)[source]
classmethod get_weekday_by_id(weekday_id)[source]
classmethod get_weekday_id(weekday)[source]
is_correct()[source]
is_time_day_invalid(t)[source]
is_time_day_valid(t)[source]
is_time_valid(t)[source]
months = {'march': 3, 'august': 8, 'september': 9, 'december': 12, 'june': 6, 'july': 7, 'november': 11, 'february': 2, 'october': 10, 'may': 5, 'january': 1, 'april': 4}
rev_months = {1: 'january', 2: 'february', 3: 'march', 4: 'april', 5: 'may', 6: 'june', 7: 'july', 8: 'august', 9: 'september', 10: 'october', 11: 'november', 12: 'december'}
rev_weekdays = {0: 'monday', 1: 'tuesday', 2: 'wednesday', 3: 'thursday', 4: 'friday', 5: 'saturday', 6: 'sunday'}
weekdays = {'monday': 0, 'tuesday': 1, 'friday': 4, 'wednesday': 2, 'thursday': 3, 'sunday': 6, 'saturday': 5}
class shinken.daterange.MonthDateDaterange(syear, smon, smday, swday, swday_offset, eyear, emon, emday, ewday, ewday_offset, skip_interval, other)[source]

Bases: shinken.daterange.Daterange

get_start_and_end_time(ref=None)[source]
class shinken.daterange.MonthDayDaterange(syear, smon, smday, swday, swday_offset, eyear, emon, emday, ewday, ewday_offset, skip_interval, other)[source]

Bases: shinken.daterange.Daterange

get_start_and_end_time(ref=None)[source]
class shinken.daterange.MonthWeekDayDaterange(syear, smon, smday, swday, swday_offset, eyear, emon, emday, ewday, ewday_offset, skip_interval, other)[source]

Bases: shinken.daterange.Daterange

get_start_and_end_time(ref=None)[source]
is_correct()[source]
class shinken.daterange.StandardDaterange(day, other)[source]

Bases: shinken.daterange.Daterange

get_start_and_end_time(ref=None)[source]
is_correct()[source]
class shinken.daterange.Timerange(entry)[source]

Bases: object

get_first_sec_out_from_morning()[source]
get_sec_from_morning()[source]
is_correct()[source]
is_time_valid(t)[source]
class shinken.daterange.WeekDayDaterange(syear, smon, smday, swday, swday_offset, eyear, emon, emday, ewday, ewday_offset, skip_interval, other)[source]

Bases: shinken.daterange.Daterange

get_start_and_end_time(ref=None)[source]
shinken.daterange.find_day_by_offset(year, month, offset)[source]
shinken.daterange.find_day_by_weekday_offset(year, month, weekday, offset)[source]

db Module

class shinken.db.DB(table_prefix='')[source]

Bases: object

DB is a generic class for SQL Database

create_insert_query(table, data)[source]

Create a INSERT query in table with all data of data (a dict)

create_update_query(table, data, where_data)[source]

Create a update query of table with data, and use where data for the WHERE clause

fetchall()[source]

Get all entry

fetchone()[source]

Just get an entry

stringify(val)[source]

Get a unicode from a value

db_mysql Module

class shinken.db_mysql.DBMysql(host, user, password, database, character_set, table_prefix='', port=3306)[source]

Bases: shinken.db.DB

DBMysql is a MySQL access database class

connect_database()[source]

Create the database connection TODO: finish (begin :) ) error catch and conf parameters... Import to catch exception

execute_query(query, do_debug=False)[source]

Just run the query TODO: finish catch

db_oracle Module

class shinken.db_oracle.DBOracle(user, password, database, table_prefix='')[source]

Bases: shinken.db.DB

Manage connection and query execution against Oracle databases.

connect_database()[source]

Create the database connection TODO: finish (begin :) ) error catch and conf parameters...

execute_query(query)[source]

Execute a query against an Oracle database.

db_sqlite Module

class shinken.db_sqlite.DBSqlite(db_path, table_prefix='')[source]

Bases: shinken.db.DB

DBSqlite is a sqlite access database class

connect_database()[source]

Create the database connection

execute_query(query)[source]

Just run the query

dependencynode Module

class shinken.dependencynode.DependencyNode[source]

Bases: object

get_complex_and_node_state()[source]
get_complex_node_state()[source]
get_complex_or_node_state()[source]
get_complex_xof_node_state()[source]
get_reverse_state(state)[source]
get_simple_node_state()[source]
get_state()[source]
is_valid()[source]
list_all_elements()[source]
switch_zeros_of_values()[source]
class shinken.dependencynode.DependencyNodeFactory(bound_item)[source]

Bases: object

eval_complex_cor_pattern(pattern, hosts, services, running=False)[source]
eval_cor_pattern(pattern, hosts, services, running=False)[source]
eval_simple_cor_pattern(pattern, hosts, services, running=False)[source]
eval_xof_pattern(node, pattern)[source]
expand_expression(pattern, hosts, services, running=False)[source]
find_object(pattern, hosts, services)[source]
get_host_filters(expr)[source]
get_srv_host_filters(expr)[source]
get_srv_service_filters(expr)[source]
host_flags = 'grlt'
service_flags = 'grl'

dispatcher Module

This is the class of the dispatcher. Its role is to dispatch configurations to other elements like schedulers, reactionner, pollers, receivers and brokers. It is responsible for high availability part. If an element dies and the element type has a spare, it sends the config of the dead one to the spare

class shinken.dispatcher.Dispatcher(conf, arbiter)[source]
check_alive()[source]
check_bad_dispatch()[source]
check_dispatch()[source]
dispatch()[source]
get_scheduler_ordered_list(r)[source]

downtime Module

class shinken.downtime.Downtime(ref, start_time, end_time, fixed, trigger_id, duration, author, comment)[source]
add_automatic_comment()[source]
cancel()[source]
del_automatic_comment()[source]
enter()[source]
exit()[source]
fill_data_brok_from(data, brok_type)[source]
get_initial_status_brok()[source]
id = 1
in_scheduled_downtime()[source]
properties = {'comment': <shinken.property.StringProp object at 0x7fc3347f6510>, 'entry_time': <shinken.property.IntegerProp object at 0x7fc334095190>, 'start_time': <shinken.property.IntegerProp object at 0x7fc3340950d0>, 'is_in_effect': <shinken.property.BoolProp object at 0x7fc3347f6390>, 'has_been_triggered': <shinken.property.BoolProp object at 0x7fc3347f6110>, 'trigger_id': <shinken.property.IntegerProp object at 0x7fc334d95050>, 'duration': <shinken.property.IntegerProp object at 0x7fc334095090>, 'author': <shinken.property.StringProp object at 0x7fc334d95e10>, 'can_be_deleted': <shinken.property.BoolProp object at 0x7fc3347f6590>, 'activate_me': <shinken.property.StringProp object at 0x7fc334095610>, 'real_end_time': <shinken.property.IntegerProp object at 0x7fc334d95d90>, 'end_time': <shinken.property.IntegerProp object at 0x7fc334d95110>, 'fixed': <shinken.property.BoolProp object at 0x7fc334095110>}
trigger_me(other_downtime)[source]

easter Module

shinken.easter.dark()[source]
.-.

|_:_|

/(_Y_)

( /M/ )

‘. _.’-/’-‘-‘._
‘: _/.–’[[[[]’–._
‘: /_’ : |::”| : ‘.\
‘: // ./ |oUU| .’ :
‘: _:’..’ \_|___|_/ : :|
‘:. .’ |_[___]_| :.’:
[::\ | : | | : ; : \
‘-‘ /’.| |.’ .;.’ | |_ ‘-‘ : | | .: : | | | | ‘. : | / :. .; |

/ | | :__/ : \

| | : | | ||

/ : : |: / |__| /|

snd | : : :_/_| /’._\ ‘–|_
/___.-/_|-‘
‘-‘
shinken.easter.episode_iv()[source]
shinken.easter.get_coffee()[source]
(
) (
___...(——-)-....___

.-“” ) ( “”-.

.-‘``’|-._ ) _.-|

/ .–.| “”—...........—”“ |

/ / | | | | | |

| |
| |
``| | _/ / /

(__/ /

_..—”“` /`“”—.._

.-‘ / ‘-.

: `-.__ __.-‘ : : ) “”—...—”” ( :

‘._ “–...___...–” _.’
jgs “”–..__ __..–”“/
‘._ “’”—-.....______.....—-“’” _.’
“”–..,,_____ _____,,..–”“
“’”—-“’”
shinken.easter.myip()[source]
shinken.easter.naheulbeuk()[source]
shinken.easter.perdu()[source]
shinken.easter.what_it_make_me_think(subject)[source]

eventhandler Module

class shinken.eventhandler.EventHandler(command, id=None, ref=None, timeout=10, env={}, module_type='fork', reactionner_tag='None', is_snapshot=False)[source]

Bases: shinken.action.Action

check_time
command
copy_shell()[source]
env
execution_time
exit_status
get_id()[source]
get_outputs(out, max_plugins_output_length)[source]
get_return_from(e)[source]
is_a
is_launchable(t)[source]
is_snapshot
long_output
module_type
my_type = 'eventhandler'
output
perf_data
properties = {'status': <shinken.property.StringProp object at 0x7fc334b38a50>, 'module_type': <shinken.property.StringProp object at 0x7fc3345fc350>, 'check_time': <shinken.property.IntegerProp object at 0x7fc3345fc890>, 'exit_status': <shinken.property.StringProp object at 0x7fc334b38ad0>, 'execution_time': <shinken.property.FloatProp object at 0x7fc334884f90>, 's_time': <shinken.property.FloatProp object at 0x7fc334884cd0>, 'worker': <shinken.property.StringProp object at 0x7fc33462a610>, 'timeout': <shinken.property.IntegerProp object at 0x7fc3345fc7d0>, 't_to_go': <shinken.property.StringProp object at 0x7fc334884ed0>, 'is_snapshot': <shinken.property.BoolProp object at 0x7fc33462a1d0>, 'is_a': <shinken.property.StringProp object at 0x7fc334b38d90>, 'long_output': <shinken.property.StringProp object at 0x7fc334884d10>, 'reactionner_tag': <shinken.property.StringProp object at 0x7fc33462a6d0>, 'command': <shinken.property.StringProp object at 0x7fc334884d90>, 'u_time': <shinken.property.FloatProp object at 0x7fc3348846d0>, 'env': <shinken.property.StringProp object at 0x7fc334884fd0>, 'output': <shinken.property.StringProp object at 0x7fc334884e50>, '_in_timeout': <shinken.property.StringProp object at 0x7fc334b38150>, 'sched_id': <shinken.property.IntegerProp object at 0x7fc3345fc510>, 'type': <shinken.property.StringProp object at 0x7fc334b38b10>, 'perf_data': <shinken.property.StringProp object at 0x7fc334884e90>}
reactionner_tag
s_time
sched_id
status
t_to_go
timeout
type
u_time
worker

external_command Module

graph Module

class shinken.graph.Graph[source]

Graph is a class to make graph things like DFS checks or accessibility Why use an atomic bomb when a little hammer is enough?

add_edge(from_node, to_node)[source]
add_node(node)[source]
add_nodes(nodes)[source]
dfs_get_all_childs(root)[source]
get_accessibility_packs()[source]
loop_check()[source]

http_client Module

http_daemon Module

load Module

class shinken.load.Load(m=1, initial_value=0)[source]

This class is for having a easy Load calculation without having to send value at regular interval (but it’s more efficient if you do this :) ) and without having a list or other stuff. It’s just an object, an update and a get You can define m: the average for m minutes. The val is the initial value. It’s better if it’s 0 but you can choose.

get_load()[source]
update_load(new_val, forced_interval=None)[source]

log Module

class shinken.log.BrokHandler(broker)[source]

Bases: logging.Handler

This log handler is forwarding log messages as broks to the broker.

Only messages of level higher than DEBUG are send to other satellite to not risk overloading them.

emit(record)[source]
class shinken.log.ColorStreamHandler(stream=None)[source]

Bases: logging.StreamHandler

emit(record)[source]
class shinken.log.Log(name='Shinken', level=0, log_set=False)[source]

Bases: logging.Logger

Shinken logger class, wrapping access to Python logging standard library. See : https://docs.python.org/2/howto/logging.html#logging-flow for more detail about how log are handled

debug(*args, **kwargs)[source]
error(*args, **kwargs)[source]
info(*args, **kwargs)[source]
load_obj(object, name_=None)[source]

We load the object where we will put log broks with the ‘add’ method

register_local_log(path, level=None, purge_buffer=True)[source]

The shinken logging wrapper can write to a local file if needed and return the file descriptor so we can avoid to close it.

Add logging to a local log-file.

The file will be rotated once a day

setLevel(level)[source]

Set level of logger and handlers. The logger need the lowest level (see link above)

set_human_format(on=True)[source]

Set the output as human format.

If the optional parameter on is False, the timestamps format will be reset to the default format.

warning(*args, **kwargs)[source]
shinken.log.naglog_result(level, result, *args)[source]

Function use for old Nag compatibility. We to set format properly for this call only.

Dirty Hack to keep the old format, we should have another logger and use one for Shinken logs and another for monitoring data

macroresolver Module

class shinken.macroresolver.MacroResolver[source]

Bases: shinken.borg.Borg

Please Add a Docstring to describe the class here

get_env_macros(data)[source]
init(conf)[source]
macros = {'TOTALSERVICESCRITICALUNHANDLED': '_get_total_services_critical_unhandled', 'PROCESSSTARTTIME': '_get_process_start_time', 'SHORTDATETIME': '_get_short_date_time', 'TOTALHOSTPROBLEMSUNHANDLED': '_get_total_host_problems_unhandled', 'TOTALSERVICESWARNINGUNHANDLED': '_get_total_services_warning_unhandled', 'TOTALSERVICEPROBLEMSUNHANDLED': '_get_total_service_problems_unhandled', 'DATE': '_get_date', 'TOTALHOSTSUP': '_get_total_hosts_up', 'TOTALSERVICESCRITICAL': '_get_total_services_critical', 'TOTALHOSTSUNREACHABLEUNHANDLED': '_get_total_hosts_unreachable_unhandled', 'TIMET': '_get_timet', 'TOTALHOSTSUNREACHABLE': '_get_total_hosts_unreachable', 'TOTALSERVICESUNKNOWN': '_get_total_services_unknown', 'TOTALHOSTSDOWNUNHANDLED': '_get_total_hosts_unhandled', 'TOTALSERVICESUNKNOWNUNHANDLED': '_get_total_services_unknown_unhandled', 'EVENTSTARTTIME': '_get_events_start_time', 'TOTALSERVICESOK': '_get_total_service_ok', 'TOTALSERVICEPROBLEMS': '_get_total_service_problems', 'TOTALHOSTSDOWN': '_get_total_hosts_down', 'TOTALHOSTPROBLEMS': '_get_total_host_problems', 'LONGDATETIME': '_get_long_date_time', 'TIME': '_get_time', 'TOTALSERVICESWARNING': '_get_total_services_warning'}
my_type = 'macroresolver'
output_macros = ['HOSTOUTPUT', 'HOSTPERFDATA', 'HOSTACKAUTHOR', 'HOSTACKCOMMENT', 'SERVICEOUTPUT', 'SERVICEPERFDATA', 'SERVICEACKAUTHOR', 'SERVICEACKCOMMENT']
resolve_command(com, data)[source]
resolve_simple_macros_in_string(c_line, data, args=None)[source]

memoized Module

class shinken.memoized.memoized(func)[source]

Bases: object

Decorator that caches a function’s return value each time it is called. If called later with the same arguments, the cached value is returned, and not re-evaluated.

message Module

class shinken.message.Message(id, type, data=None, source=None)[source]

This is a simple message class for communications between actionners and workers

get_data()[source]
get_from()[source]
get_type()[source]
my_type = 'message'
str()[source]

modulesctx Module

modulesmanager Module

notification Module

class shinken.notification.Notification(type='PROBLEM', status='scheduled', command='UNSET', command_call=None, ref=None, contact=None, t_to_go=0, contact_name='', host_name='', service_description='', reason_type=1, state=0, ack_author='', ack_data='', escalated=False, contacts_notified=0, start_time=0, end_time=0, notification_type=0, id=None, notif_nb=1, timeout=10, env={}, module_type='fork', reactionner_tag='None', enable_environment_macros=0)[source]

Bases: shinken.action.Action

Please Add a Docstring to describe the class here

ack_author
ack_data
already_start_escalations
check_time
command
command_call
contact
contact_name
contacts_notified
copy_shell()[source]
creation_time
enable_environment_macros
end_time
env
escalated
execution_time
exit_status
fill_data_brok_from(data, brok_type)[source]
get_id()[source]
get_initial_status_brok()[source]
get_return_from(n)[source]
host_name
is_a
is_administrative()[source]
is_launchable(t)[source]
macros = {'NOTIFICATIONAUTHORNAME': 'author_name', 'HOSTNOTIFICATIONNUMBER': 'notif_nb', 'NOTIFICATIONAUTHORALIAS': 'author_alias', 'NOTIFICATIONRECIPIENTS': 'recipients', 'HOSTNOTIFICATIONID': 'id', 'NOTIFICATIONAUTHOR': 'author', 'NOTIFICATIONISESCALATED': 'escalated', 'NOTIFICATIONTYPE': 'type', 'SERVICENOTIFICATIONNUMBER': 'notif_nb', 'NOTIFICATIONCOMMENT': 'comment', 'SERVICENOTIFICATIONID': 'id'}
module_type
my_type = 'notification'
notif_nb
notification_type
output
properties = {'reason_type': <shinken.property.StringProp object at 0x7fc334b40e10>, 'status': <shinken.property.StringProp object at 0x7fc334adff50>, 'u_time': <shinken.property.FloatProp object at 0x7fc334adf7d0>, 'ack_data': <shinken.property.StringProp object at 0x7fc334b40290>, 'execution_time': <shinken.property.FloatProp object at 0x7fc334adff10>, 'creation_time': <shinken.property.IntegerProp object at 0x7fc3340fa590>, 'start_time': <shinken.property.StringProp object at 0x7fc3346ba150>, 's_time': <shinken.property.FloatProp object at 0x7fc334adfd10>, 'worker': <shinken.property.StringProp object at 0x7fc334adfad0>, 'command_call': <shinken.property.StringProp object at 0x7fc334adffd0>, 'notif_nb': <shinken.property.IntegerProp object at 0x7fc334adf610>, 'reactionner_tag': <shinken.property.StringProp object at 0x7fc3340faf50>, 'module_type': <shinken.property.StringProp object at 0x7fc334adfb50>, 't_to_go': <shinken.property.IntegerProp object at 0x7fc334adf6d0>, 'service_description': <shinken.property.StringProp object at 0x7fc334b40f50>, 'notification_type': <shinken.property.IntegerProp object at 0x7fc3346bac10>, 'contact_name': <shinken.property.StringProp object at 0x7fc3346ba550>, 'sched_id': <shinken.property.IntegerProp object at 0x7fc334adfcd0>, 'timeout': <shinken.property.IntegerProp object at 0x7fc334adf9d0>, 'exit_status': <shinken.property.IntegerProp object at 0x7fc334adf650>, 'check_time': <shinken.property.IntegerProp object at 0x7fc334adf250>, 'contacts_notified': <shinken.property.StringProp object at 0x7fc334adf290>, 'ack_author': <shinken.property.StringProp object at 0x7fc334b404d0>, 'enable_environment_macros': <shinken.property.BoolProp object at 0x7fc3340fa990>, 'escalated': <shinken.property.BoolProp object at 0x7fc334adfc10>, 'is_a': <shinken.property.StringProp object at 0x7fc3346ba050>, 'state': <shinken.property.StringProp object at 0x7fc334b40ad0>, 'contact': <shinken.property.StringProp object at 0x7fc334adfe90>, 'command': <shinken.property.StringProp object at 0x7fc334adf990>, 'end_time': <shinken.property.StringProp object at 0x7fc3346baf90>, 'env': <shinken.property.StringProp object at 0x7fc334adfb10>, 'output': <shinken.property.StringProp object at 0x7fc334b40190>, '_in_timeout': <shinken.property.BoolProp object at 0x7fc334adff90>, 'already_start_escalations': <shinken.property.StringProp object at 0x7fc3340fa9d0>, 'type': <shinken.property.StringProp object at 0x7fc3346ba310>, 'host_name': <shinken.property.StringProp object at 0x7fc33468b710>}
reactionner_tag
reason_type
s_time
sched_id
service_description
start_time
state
status
t_to_go
timeout
type
u_time
worker

property Module

class shinken.property.UnusedProp(text=None)[source]

Bases: shinken.property.Property

A unused Property. These are typically used by Nagios but no longer useful/used by Shinken.

This is just to warn the user that the option he uses is no more used in Shinken.

class shinken.property.BoolProp(default=<object object>, class_inherit=None, unmanaged=False, help='', no_slots=False, fill_brok=None, conf_send_preparation=None, brok_transformation=None, retention=False, retention_preparation=None, to_send=False, override=False, managed=True, split_on_coma=True, merging='uniq')[source]

Bases: shinken.property.Property

A Boolean Property.

Boolean values are currently case insensitively defined as 0, false, no, off for False, and 1, true, yes, on for True).

static pythonize(val)[source]
class shinken.property.IntegerProp(default=<object object>, class_inherit=None, unmanaged=False, help='', no_slots=False, fill_brok=None, conf_send_preparation=None, brok_transformation=None, retention=False, retention_preparation=None, to_send=False, override=False, managed=True, split_on_coma=True, merging='uniq')[source]

Bases: shinken.property.Property

Please Add a Docstring to describe the class here

pythonize(val)[source]
class shinken.property.FloatProp(default=<object object>, class_inherit=None, unmanaged=False, help='', no_slots=False, fill_brok=None, conf_send_preparation=None, brok_transformation=None, retention=False, retention_preparation=None, to_send=False, override=False, managed=True, split_on_coma=True, merging='uniq')[source]

Bases: shinken.property.Property

Please Add a Docstring to describe the class here

pythonize(val)[source]
class shinken.property.CharProp(default=<object object>, class_inherit=None, unmanaged=False, help='', no_slots=False, fill_brok=None, conf_send_preparation=None, brok_transformation=None, retention=False, retention_preparation=None, to_send=False, override=False, managed=True, split_on_coma=True, merging='uniq')[source]

Bases: shinken.property.Property

Please Add a Docstring to describe the class here

pythonize(val)[source]
class shinken.property.StringProp(default=<object object>, class_inherit=None, unmanaged=False, help='', no_slots=False, fill_brok=None, conf_send_preparation=None, brok_transformation=None, retention=False, retention_preparation=None, to_send=False, override=False, managed=True, split_on_coma=True, merging='uniq')[source]

Bases: shinken.property.Property

Please Add a Docstring to describe the class here

pythonize(val)[source]
class shinken.property.ListProp(default=<object object>, class_inherit=None, unmanaged=False, help='', no_slots=False, fill_brok=None, conf_send_preparation=None, brok_transformation=None, retention=False, retention_preparation=None, to_send=False, override=False, managed=True, split_on_coma=True, merging='uniq')[source]

Bases: shinken.property.Property

Please Add a Docstring to describe the class here

pythonize(val)[source]

satellite Module

scheduler Module

singleton Module

sorteddict Module

class shinken.sorteddict.SortedDict(*args, **kwargs)[source]

Bases: dict

Dictionary with sorted keys.

The interface is similar to the ordinary dict’s one, but:

  • methods: __repr__(), __str__(), __iter__(), iterkeys(), itervalues(), iteritems(), keys(), values(), items() and popitem() – return results taking into consideration sorted keys order;
  • new methods: largest_key(), largest_item(), smallest_key(), smallest_item() added.
clear() → None. Remove all items from D.[source]
copy() → a shallow copy of D (still as a SortedDict).[source]
classmethod fromkeys(S[, v]) → New dict with keys from S and values equal to v.[source]

v defaults to None.

items() → a list of (key, value) pairs sorted by keys[source]

(add reverse=True for reverse ordering).

iteritems() → an iterator over (key, value) pairs sorted by keys[source]

(add reverse=True for reverse ordering).

iterkeys(reverse=False)

D.__iter__() <==> iter(D) <==> D.iterkeys() -> an iterator over sorted keys (add reverse=True for reverse ordering).

itervalues() → an iterator over values sorted by keys[source]

(add reverse=True for reverse ordering).

keys() → a sorted list of keys[source]

(add reverse=True for reverse ordering).

largest_item() → a (key, value) pair with the largest key;[source]

raise KeyError if D is empty.

largest_key() → the largest key; raise KeyError if D is empty.[source]
pop(k[, d]) → v, remove specified key and return the corresponding value.[source]

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() → (k, v). Remove and return a (key, value) pair with[source]

the largest key; raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D[source]
smallest_item() → a (key, value) pair with the smallest key;[source]

raise KeyError if D is empty.

smallest_key() → the smallest key; raise KeyError if D is empty.[source]
update([E, ]**F) → None. Update D from dict/iterable E and F.[source]

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → a list of values sorted by keys[source]

(add reverse=True for reverse ordering).

shinken.sorteddict.dictdoc(method)[source]

A decorator making reuse of the ordinary dict’s docstrings more concise.

trigger_functions Module

class shinken.trigger_functions.declared(f)[source]

Bases: object

Decorator to add function in trigger environnement

util Module

shinken.util.alive_then_spare_then_deads(x, y)[source]
shinken.util.apply_change_recursive_pattern_change(s, rule)[source]
shinken.util.expand_with_macros(ref, value)[source]
shinken.util.expand_xy_pattern(pattern)[source]
shinken.util.expect_file_dirs(root, path)[source]
shinken.util.filter_any(name)[source]
shinken.util.filter_host_by_bp_rule_label(label)[source]
shinken.util.filter_host_by_group(group)[source]
shinken.util.filter_host_by_name(name)[source]
shinken.util.filter_host_by_regex(regex)[source]
shinken.util.filter_host_by_tag(tpl)[source]
shinken.util.filter_none(name)[source]
shinken.util.filter_service_by_bp_rule_label(label)[source]
shinken.util.filter_service_by_host_bp_rule_label(label)[source]
shinken.util.filter_service_by_host_name(host_name)[source]
shinken.util.filter_service_by_host_tag_name(tpl)[source]
shinken.util.filter_service_by_hostgroup_name(group)[source]
shinken.util.filter_service_by_name(name)[source]
shinken.util.filter_service_by_regex_host_name(regex)[source]
shinken.util.filter_service_by_regex_name(regex)[source]
shinken.util.filter_service_by_servicegroup_name(group)[source]
shinken.util.format_t_into_dhms_format(t)[source]
shinken.util.from_bool_to_int(b)[source]
shinken.util.from_bool_to_string(b)[source]
shinken.util.from_float_to_int(val)[source]
shinken.util.from_list_to_split(val)[source]
shinken.util.get_customs_keys(d)[source]
shinken.util.get_customs_values(d)[source]
shinken.util.get_day(t)[source]
shinken.util.get_end_of_day(year, month_id, day)[source]
shinken.util.get_key_value_sequence(entry, default_value=None)[source]
shinken.util.get_obj_full_name(obj)[source]
shinken.util.get_obj_name(obj)[source]
shinken.util.get_obj_name_two_args_and_void(obj, value)[source]
shinken.util.get_sec_from_morning(t)[source]
shinken.util.get_start_of_day(year, month_id, day)[source]
shinken.util.get_wday(t)[source]
shinken.util.got_generation_rule_pattern_change(xy_couples)[source]
shinken.util.is_complex_expr(expr)[source]
shinken.util.jsonify_r(obj)[source]
shinken.util.list_split(val, split_on_coma=True)[source]
shinken.util.nighty_five_percent(t)[source]
shinken.util.print_date(t)[source]
shinken.util.safe_print(*args)[source]
shinken.util.scheduler_no_spare_first(x, y)[source]
shinken.util.sort_by_ids(x, y)[source]
shinken.util.split_semicolon(line, maxsplit=None)[source]

Split a line on semicolons characters but not on the escaped semicolons

shinken.util.strip_and_uniq(tab)[source]
shinken.util.to_best_int_float(val)[source]
shinken.util.to_bool(val)[source]
shinken.util.to_char(val)[source]
shinken.util.to_float(val)[source]
shinken.util.to_hostnames_list(ref, tab)[source]
shinken.util.to_int(val)[source]
shinken.util.to_list_of_names(ref, tab)[source]
shinken.util.to_list_string_of_names(ref, tab)[source]
shinken.util.to_name_if_possible(ref, value)[source]
shinken.util.to_split(val, split_on_coma=True)[source]
shinken.util.to_svc_hst_distinct_lists(ref, tab)[source]
shinken.util.unique_value(val)[source]

worker Module

class shinken.worker.Worker(id, s, returns_queue, processes_by_worker, mortal=True, timeout=300, max_plugins_output_length=8192, target=None, loaded_into='unknown', http_daemon=None)[source]

This class is used for poller and reactionner to work. The worker is a process launch by theses process and read Message in a Queue (self.s) (slave) They launch the Check and then send the result in the Queue self.m (master) they can die if they do not do anything (param timeout)

add_idletime(time)[source]
check_for_system_time_change()[source]
do_work(s, returns_queue, c)[source]
get_new_checks()[source]
id = 0
is_alive()[source]
is_killable()[source]
is_mortal()[source]
join(timeout=None)[source]
launch_new_checks()[source]
manage_finished_checks()[source]
reset_idle()[source]
send_message(msg)[source]
set_proctitle()[source]
set_zombie()[source]
start()[source]
terminate()[source]
work(s, returns_queue, c)[source]