mirror of
https://github.com/nicolargo/glances.git
synced 2025-01-03 07:03:40 +03:00
Corect an issue with default max events number (0 instead of 10)
This commit is contained in:
parent
c59dc2bc16
commit
8f6fe14ea1
@ -428,7 +428,7 @@ disable=False
|
||||
[alert]
|
||||
disable=False
|
||||
# Maximum number of alerts to display (default is 10)
|
||||
; max_events=10
|
||||
;max_events=10
|
||||
|
||||
##############################################################################
|
||||
# Client/server
|
||||
|
@ -25,15 +25,16 @@ services:
|
||||
- "/run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro"
|
||||
- "./glances.conf:/glances/conf/glances.conf"
|
||||
environment:
|
||||
- GLANCES_OPT: "-C /glances/conf/glances.conf -w"
|
||||
- TZ: "${TZ}"
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: 1
|
||||
capabilities: [gpu]
|
||||
- TZ=${TZ}
|
||||
- "GLANCES_OPT=-C /glances/conf/glances.conf -w"
|
||||
# Uncomment for GPU compatibilty (Nvidia) inside the container
|
||||
# deploy:
|
||||
# resources:
|
||||
# reservations:
|
||||
# devices:
|
||||
# - driver: nvidia
|
||||
# count: 1
|
||||
# capabilities: [gpu]
|
||||
labels:
|
||||
- "traefik.port=61208"
|
||||
- "traefik.frontend.rule=Host:glances.docker.localhost"
|
||||
|
@ -13,12 +13,13 @@ services:
|
||||
- "/run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro"
|
||||
- "./glances.conf:/glances/conf/glances.conf"
|
||||
environment:
|
||||
- GLANCES_OPT: "-C /glances/conf/glances.conf -w"
|
||||
- TZ: "${TZ}"
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: 1
|
||||
capabilities: [gpu]
|
||||
- TZ=${TZ}
|
||||
- "GLANCES_OPT=-C /glances/conf/glances.conf -w"
|
||||
# Uncomment for GPU compatibilty (Nvidia) inside the container
|
||||
# deploy:
|
||||
# resources:
|
||||
# reservations:
|
||||
# devices:
|
||||
# - driver: nvidia
|
||||
# count: 1
|
||||
# capabilities: [gpu]
|
||||
|
@ -13,6 +13,7 @@ import time
|
||||
from datetime import datetime
|
||||
|
||||
from glances.processes import glances_processes, sort_stats
|
||||
from glances.logger import logger
|
||||
|
||||
|
||||
class GlancesEvents(object):
|
||||
@ -108,7 +109,8 @@ class GlancesEvents(object):
|
||||
self._create_event(event_state, event_type, event_value, proc_list, proc_desc, peak_time)
|
||||
else:
|
||||
# Event exist, update it
|
||||
self._update_event(event_index, event_state, event_type, event_value, proc_list, proc_desc, peak_time)
|
||||
self._update_event(event_index,
|
||||
event_state, event_type, event_value, proc_list, proc_desc, peak_time)
|
||||
|
||||
return self.len()
|
||||
|
||||
@ -128,7 +130,7 @@ class GlancesEvents(object):
|
||||
time.mktime(datetime.now().timetuple()), # START DATE
|
||||
-1, # END DATE
|
||||
event_state, # STATE: WARNING|CRITICAL
|
||||
event_type, # TYPE: CPU, LOAD, MEM...
|
||||
event_type, # TYPE: CPU, LOAD, MEM...
|
||||
event_value, # MAX
|
||||
event_value, # AVG
|
||||
event_value, # MIN
|
||||
|
@ -183,7 +183,7 @@ class PluginModel(GlancesPluginModel):
|
||||
|
||||
# Set the maximum number of events to display
|
||||
if config is not None and (config.has_section('alert') or config.has_section('alerts')):
|
||||
glances_events.set_max_events(config.get_int_value('alert', 'max_events'))
|
||||
glances_events.set_max_events(config.get_int_value('alert', 'max_events', default=10))
|
||||
|
||||
def update(self):
|
||||
"""Nothing to do here. Just return the global glances_log."""
|
||||
@ -211,6 +211,7 @@ class PluginModel(GlancesPluginModel):
|
||||
# New line
|
||||
ret.append(self.curse_new_line())
|
||||
# Start
|
||||
# TODO: Related to #2591, manege TZ in order to make it work inside containers
|
||||
msg = str(datetime.fromtimestamp(alert[0]))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
# Duration
|
||||
|
@ -73,7 +73,7 @@ class GlancesPluginModel(object):
|
||||
# Internal or external module (former prefixed by 'glances.plugins')
|
||||
_mod = self.__class__.__module__.replace('glances.plugins.', '')
|
||||
self.plugin_name = _mod.split('.')[0]
|
||||
|
||||
|
||||
if self.plugin_name.startswith('glances_'):
|
||||
self.plugin_name = self.plugin_name.split('glances_')[1]
|
||||
logger.debug("Init {} plugin".format(self.plugin_name))
|
||||
@ -689,7 +689,7 @@ class GlancesPluginModel(object):
|
||||
# Add _LOG to the return string
|
||||
# So stats will be highlighted with a specific color
|
||||
log_str = "_LOG"
|
||||
# Add the log to the list
|
||||
# Add the log to the events list
|
||||
glances_events.add(ret, stat_name.upper(), value)
|
||||
|
||||
# Manage threshold
|
||||
|
Loading…
Reference in New Issue
Block a user