This file is indexed.

/usr/lib/python3/dist-packages/Nagstamon/Objects.py is in nagstamon 3.0.2-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
# encoding: utf-8

# Nagstamon - Nagios status monitor for your desktop
# Copyright (C) 2008-2014 Henri Wahl <h.wahl@ifw-dresden.de> et al.
#
# This program 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; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

# for python2 and upcomping python3 compatiblity
from __future__ import print_function, absolute_import, unicode_literals


STATES = ['WARNING', 'UNKNOWN', 'CRITICAL', 'UNREACHABLE', 'DOWN', 'INFORMATION', 'AVERAGE', 'HIGH', 'DISASTER']


class GenericObject(object):

    """
    template for hosts and services
    """

    def __init__(self):
        self.name = ''
        self.status = ''
        self.status_information = ''
        # default state is soft, to be changed by status_type check
        self.status_type = ''
        self.last_check = ''
        self.duration = ''
        self.attempt = ''
        self.passiveonly = False
        self.acknowledged = False
        self.notifications_disabled = False
        self.flapping = False
        self.scheduled_downtime = False
        # compress all flags like acknowledged and flapping into one string
        self.host_flags = ''
        self.service_flags = ''
        self.visible = True
        # Check_MK also has site info
        self.site = ''
        # server to be added to hash
        self.server = ''
        # might help in Qt
        self.host = ''
        self.service = ''
        self.dummy_column = ''

    def is_passive_only(self):
        return bool(self.passiveonly)

    def is_flapping(self):
        return bool(self.flapping)

    def has_notifications_disabled(self):
        return bool(self.notifications)

    def is_acknowledged(self):
        return bool(self.acknowledged)

    def is_in_scheduled_downtime(self):
        return bool(self.scheduled_downtime)

    def is_visible(self):
        return bool(self.visible)

    def get_name(self):
        """
            return stringified name
        """
        return str(self.name)

    def get_host_name(self):
        """
            Extracts host name from status item.
            Presentation purpose.
        """
        return ''

    def get_service_name(self):
        """
            Extracts service name from status item.
            Presentation purpose.
        """
        return ''

    def get_hash(self):
        """
            returns hash of event status information - different for host and service thus empty here
        """
        return ''

    def get_columns(self, columns_wanted):
        """
            Yield host/service status information for treeview table columns
        """
        for c in columns_wanted:
            yield str(self.__dict__[c])


class GenericHost(GenericObject):

    """
        one host which is monitored by a Nagios server, gets populated with services
    """

    def __init__(self):
        GenericObject.__init__(self)
        # take all the faulty services on host
        self.services = dict()

    def get_host_name(self):
        return str(self.name)

    def is_host(self):
        """
            decides where to put acknowledged/downtime pixbufs in Liststore for Treeview in Popwin
        """
        return True

    def get_hash(self):
        """
        return hash for event history tracking
        """
        return " ".join((self.server, self.site, self.name, self.status))


class GenericService(GenericObject):

    """
        one service which runs on a host
    """

    def __init__(self):
        GenericObject.__init__(self)

    def get_host_name(self):
        return str(self.host)

    def get_service_name(self):
        return str(self.name)

    def is_host(self):
        """
            decides where to put acknowledged/downtime pixbufs in Liststore for Treeview in Popwin
        """
        return False

    def get_hash(self):
        """
            return hash for event history tracking
        """
        return " ".join((self.server, self.site, self.host, self.name, self.status))


class Result(object):

    """
    multi purpose result object, used in Servers.Generic.FetchURL()
    """
    result = ''
    error = ''
    status_code = 0

    def __init__(self, **kwds):
        # add all keywords to object, every mode searchs inside for its favorite arguments/keywords
        for k in kwds:
            self.__dict__[k] = kwds[k]