Skip to content

Commit

Permalink
Add reporting of logging volume to Smolt.
Browse files Browse the repository at this point in the history
This reports the logging volume as a percentage of the total amount
stored in the database, for each urgency level. This is intended as a
simple metric to determine stability of MythTV, as higher counts of
higher urgency levels will indicate an increase in problems seen by the
user base.

(cherry picked from commit 5f90b1d)
  • Loading branch information
wagnerrp committed Oct 10, 2012
1 parent 3800761 commit 84431ca
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -453,7 +453,20 @@ def ProcessSmoltInfo(self):


return myth_systemrole , mythremote return myth_systemrole , mythremote



def ProcessLogUrgency(self):
c = _DB.cursor()
c.execute("""SELECT level,count(level) FROM logging GROUP BY level""")
levels = ('EMERG', 'ALERT', 'CRIT', 'ERR',
'WARNING', 'NOTICE', 'INFO') # ignore debugging from totals
counts = {}
total = 0.
for level,count in c.fetchall():
if level in range(len(levels)):
counts[levels[level]] = count
total += count
for k,v in counts.items():
counts[k] = v/total
return {'logurgency':counts}






Expand All @@ -470,6 +483,7 @@ def get_data(self,gate):
self._data.update(self.ProcessMySQL()) self._data.update(self.ProcessMySQL())
self._data.update(self.ProcessScheduler()) self._data.update(self.ProcessScheduler())
self._data.update(self.Processtuners()) self._data.update(self.Processtuners())
self._data.update(self.ProcessLogUrgency())


self._data.theme = _SETTINGS.Theme self._data.theme = _SETTINGS.Theme
self._data.country = _SETTINGS.Country self._data.country = _SETTINGS.Country
Expand Down

0 comments on commit 84431ca

Please sign in to comment.