Exemple #1
0
    def render(self, what, row, tags, custom_vars):
        if (what == "host" or row.get("service_check_command","").startswith("check_mk_active-cmk_inv!")) \
            and inventory.has_inventory(row["host_name"]):

            if not config.user.may("view.inv_host"):
                return

            return 'inv', _("Show Hardware/Software Inventory of this host"), url_to_view(
                row, 'inv_host')
Exemple #2
0
 def render(self, what, row, tags, custom_vars):
     comments = row[what + "_comments_with_extra_info"]
     if len(comments) > 0:
         text = u""
         for c in sorted(comments, key=lambda x: x[4]):
             _id, author, comment, _ty, timestamp = c
             comment = comment.replace("\n", "<br>")
             text += "%s %s: \"%s\" \n" % (paint_age(
                 timestamp, True, 0, 'abs')[1], author, comment)
         return 'comment', text, url_to_view(row, 'comments_of_' + what)
Exemple #3
0
    def render(self, what, row, tags, custom_vars):
        def detail_txt(downtimes_with_extra_info):
            if not downtimes_with_extra_info:
                return ""

            lines = []
            for downtime_entry in downtimes_with_extra_info:
                _downtime_id, author, comment, _origin, _entry_time, start_time, end_time, fixed, duration, _recurring, _is_pending = downtime_entry[:
                                                                                                                                                     11]

                if fixed:
                    time_info = "Start: %s, End: %s" % (
                        cmk.utils.render.date_and_time(start_time),
                        cmk.utils.render.date_and_time(end_time))
                else:
                    time_info = "May start from %s till %s with duration of %s" % \
                                (cmk.utils.render.date_and_time(start_time), cmk.utils.render.date_and_time(end_time), cmk.utils.render.Age(duration))
                    lines.append("%s (%s) - %s" % (author, time_info, comment))

            return "\n%s" % "\n".join(lines)

        # Currently we are in a downtime + link to list of downtimes
        # for this host / service
        if row[what + "_scheduled_downtime_depth"] > 0:
            if what == "host":
                icon = "derived_downtime"
            else:
                icon = "downtime"

            title = _("Currently in downtime")
            title += detail_txt(row[what + "_downtimes_with_extra_info"])

            return icon, title, url_to_view(row, 'downtimes_of_' + what)

        if what == "service" and row["host_scheduled_downtime_depth"] > 0:
            title = _("The host is currently in downtime")
            title += detail_txt(row["host_downtimes_with_extra_info"])

            return 'derived_downtime', title, url_to_view(
                row, 'downtimes_of_host')