/usr/share/check_mk/web/plugins/views/datasources.py is in check-mk-multisite 1.2.8p16-1ubuntu0.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | #!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
##################################################################################
# Data sources
##################################################################################
# title: Used as display-string for the datasource in multisite (e.g. view editor)
#
# table: Might be a string which refers to a livestatus table or a function
# which is called instead of the livestatus function query_data().
#
# infos: A key to be used to create groups out of single painters and filters.
# e.g. 'host' groups all painters and filters which begin with "host_".
# Out of this declaration multisite knows which filters or painters are
# available for the single datasources.
#
# merge_by:
# 1. Results in fetching these columns from the datasource.
# 2. Rows from different sites are merged together. For example members
# of hostgroups which exist on different sites are merged together to
# show the user one big hostgroup.
#
# add_columns: list of columns the datasource is known to add itself
#
# add_headers: additional livestatus headers to add to each call
#
# keys: columns which must be fetched in order to execute commands on
# the items (= in order to identify the items and gather all information
# needed for constructing Nagios commands)
# those columns are always fetched from the datasource for each item
#
# idkeys: these are used to generate a key which is unique for each data row
# is used to identify an item between http requests
#
# join: A view can display e.g. host-rows and include information from e.g.
# the service table to create a column which shows e.g. the state of one
# service.
# With this attibute it is configured which tables can be joined into
# this table and by which attribute. It must be given as tuple, while
# the first argument is the name of the table to be joined and the second
# argument is the column in the master table (in this case hosts) which
# is used to match the rows of the master and slave table.
#
# joinkey: Each joined column in the view can have a 4th attribute which is
# used as value for this column to filter the datasource query
# to get the matching row of the slave table.
#
# ignore_limit: Ignore the soft/hard query limits in view.py/query_data(). This
# fixes stats queries on e.g. the log table.
multisite_datasources["hosts"] = {
"title" : _("All hosts"),
"table" : "hosts",
"infos" : [ "host" ],
"keys" : [ "host_name", "host_downtimes" ],
"join" : ( "services", "host_name" ),
"idkeys" : [ "site", "host_name" ],
"description" : _("Displays a list of hosts."),
# When the single info "hostgroup" is used, use the "opthostgroup" filter
# to handle the data provided by the single_spec value of the "hostgroup"
# info, which is in fact the name of the wanted hostgroup
"link_filters" : { "hostgroup": "opthostgroup" },
# When these filters are set, the site hint will not be added to urls
# which link to views using this datasource, because the resuling view
# should show the objects spread accross the sites
"multiple_site_filters" : [
"hostgroup",
"servicegroup",
],
}
multisite_datasources["hostsbygroup"] = {
"title" : _("Hosts grouped by host groups"),
"table" : "hostsbygroup",
"infos" : [ "host", "hostgroup" ],
"keys" : [ "host_name", "host_downtimes" ],
"join" : ( "services", "host_name" ),
"idkeys" : [ "site", "hostgroup_name", "host_name" ],
"description" : _("This datasource has a separate row for each group membership that a host has."),
}
multisite_datasources["services"] = {
"title" : _("All services"),
"table" : "services",
"infos" : [ "service", "host" ],
"keys" : [ "host_name", "service_description", "service_downtimes" ],
"joinkey" : "service_description",
"idkeys" : [ "site", "host_name", "service_description" ],
# When the single info "hostgroup" is used, use the "opthostgroup" filter
# to handle the data provided by the single_spec value of the "hostgroup"
# info, which is in fact the name of the wanted hostgroup
"link_filters" : {
"hostgroup" : "opthostgroup",
"servicegroup" : "optservicegroup",
},
# When these filters are set, the site hint will not be added to urls
# which link to views using this datasource, because the resuling view
# should show the objects spread accross the sites
"multiple_site_filters" : [
"hostgroup",
"servicegroup",
],
}
multisite_datasources["servicesbygroup"] = {
"title" : _("Services grouped by service groups"),
"table" : "servicesbygroup",
"infos" : [ "service", "host", "servicegroup" ],
"keys" : [ "host_name", "service_description", "service_downtimes" ],
"idkeys" : [ "site", "servicegroup_name", "host_name", "service_description" ],
}
multisite_datasources["servicesbyhostgroup"] = {
"title" : _("Services grouped by host groups"),
"table" : "servicesbyhostgroup",
"infos" : [ "service", "host", "hostgroup" ],
"keys" : [ "host_name", "service_description", "service_downtimes" ],
"idkeys" : [ "site", "hostgroup_name", "host_name", "service_description" ],
}
multisite_datasources["hostgroups"] = {
"title" : _("Hostgroups"),
"table" : "hostgroups",
"infos" : [ "hostgroup" ],
"keys" : [ "hostgroup_name" ],
"idkeys" : [ "site", "hostgroup_name" ],
}
# Merged groups across sites
multisite_datasources["merged_hostgroups"] = {
"title" : _("Hostgroups, merged"),
"table" : "hostgroups",
"merge_by" : "hostgroup_name",
"infos" : [ "hostgroup" ],
"keys" : [ "hostgroup_name" ],
"idkeys" : [ "hostgroup_name" ],
}
multisite_datasources["servicegroups"] = {
"title" : _("Servicegroups"),
"table" : "servicegroups",
"infos" : [ "servicegroup" ],
"keys" : [ "servicegroup_name" ],
"idkeys" : [ "site", "servicegroup_name" ],
}
# Merged groups across sites
multisite_datasources["merged_servicegroups"] = {
"title" : _("Servicegroups, merged"),
"table" : "servicegroups",
"merge_by" : "servicegroup_name",
"infos" : [ "servicegroup" ],
"keys" : [ "servicegroup_name" ],
"idkeys" : [ "servicegroup_name" ],
}
multisite_datasources["comments"] = {
"title" : _("Host- and Servicecomments"),
"table" : "comments",
"infos" : [ "comment", "host", "service" ],
"keys" : [ "comment_id", "comment_type", "host_name", "service_description" ],
"idkeys" : [ "comment_id" ],
}
multisite_datasources["downtimes"] = {
"title" : _("Scheduled Downtimes"),
"table" : "downtimes",
"infos" : [ "downtime", "host", "service" ],
"keys" : [ "downtime_id", "service_description" ],
"idkeys" : [ "downtime_id" ],
}
multisite_datasources["log"] = {
"title" : _("The Logfile"),
"table" : "log",
"infos" : [ "log", "host", "service", "contact", "command" ],
"keys" : [],
"idkeys" : [ "log_lineno" ],
"time_filters" : [ "logtime" ],
}
multisite_datasources["log_events"] = {
"title" : _("Host and Service Events"),
"table" : "log",
"add_headers" : "Filter: class = 1\nFilter: class = 3\nOr: 2\n",
"infos" : [ "log", "host", "service" ],
"keys" : [],
"idkeys" : [ "log_lineno" ],
"time_filters" : [ "logtime" ],
}
multisite_datasources["log_host_events"] = {
"title" : _("Host Events"),
"table" : "log",
"add_headers" : "Filter: class = 1\nFilter: class = 3\nOr: 2\nFilter: service_description = \n",
"infos" : [ "log", "host" ],
"keys" : [],
"idkeys" : [ "log_lineno" ],
"time_filters" : [ "logtime" ],
}
multisite_datasources["alert_stats"] = {
"title" : _("Alert Statistics"),
"table" : "log",
"add_headers" : "Filter: class = 1\nStats: state = 0\nStats: state = 1\nStats: state = 2\nStats: state = 3\nStats: state != 0\n",
"add_columns" : [ "alerts_ok", "alerts_warn", "alerts_crit", "alerts_unknown", "alerts_problem" ],
"infos" : [ "log", "host", "service", "contact", "command" ],
"keys" : [],
"idkeys" : [ 'host_name', 'service_description' ],
"ignore_limit" : True,
"time_filters" : [ "logtime" ],
}
|