Network IO is OK

This commit is contained in:
nicolargo 2025-11-09 12:49:44 +01:00
parent b75d1f24c3
commit 8bb2a8a91b
3 changed files with 14 additions and 12 deletions

View File

@ -123,11 +123,11 @@ total_critical=85
total_log=True
#
# Default values if not defined: 50/70/90 (except for iowait)
user_careful=50
user_warning=70
user_critical=90
user_careful=5
user_warning=7
user_critical=9
user_log=False
#user_critical_action=echo {{user}} {{value}} {{max}} > /tmp/cpu.alert
#user_critical_action=echo "{{time}} User CPU {{user}} higher than {{critical}}" > /tmp/cpu.alert
#
system_careful=50
system_warning=70
@ -188,7 +188,7 @@ disable=False
careful=50
warning=70
critical=90
#warning_action_repeat=echo "{{time}} {{percent}} higher than {{warning}}"" >> /tmp/memory.alert
#critical_action_repeat=echo "{{time}} {{percent}} higher than {{critical}}"" >> /tmp/memory.alert
[memswap]
disable=False
@ -244,8 +244,9 @@ hide_zero=False
#wlan0_tx_warning=900000
#wlan0_tx_critical=1000000
#wlan0_tx_log=True
#wlan0_rx_critical_action=echo "{{time}} {{interface_name}} RX {{bytes_recv_rate_per_sec}}Bps" > /tmp/network.alert
# Alias for network interface name
#alias=wlp2s0:WIFI
#alias=wlp0s20f3:WIFI
[ip]
# Disable display of private IP address

View File

@ -219,8 +219,10 @@ class NetworkPlugin(GlancesPluginModel):
bps_tx = int(i['bytes_sent_rate_per_sec'] * 8)
# Decorate the bitrate with the configuration file thresholds
alert_rx = self.get_alert(bps_rx, header=if_real_name + '_rx')
alert_tx = self.get_alert(bps_tx, header=if_real_name + '_tx')
# alert_rx = self.get_alert(bps_rx, header=if_real_name + '_rx')
# alert_tx = self.get_alert(bps_tx, header=if_real_name + '_tx')
alert_rx = self.get_alert(bps_rx, header='rx', action_key=if_real_name)
alert_tx = self.get_alert(bps_tx, header='tx', action_key=if_real_name)
# If nothing is define in the configuration file...
# ... then use the interface speed (not available on all systems)

View File

@ -667,12 +667,12 @@ class GlancesPluginModel:
return self.stats
def get_stat_name(self, header=None, action_key=None):
"""Return the stat name with an optional header and action_key"""
"""Return the stat name with an optional action_key and header"""
ret = self.plugin_name
if header is not None and header != '':
ret += '_' + header
if action_key is not None and action_key != '':
ret += '_' + action_key
if header is not None and header != '':
ret += '_' + header
return ret
def get_alert(
@ -794,7 +794,6 @@ class GlancesPluginModel:
stats_action = copy.deepcopy(self.get_stats_action())
if isinstance(stats_action, list):
# If the stats are stored in a list of dict (fs plugin for example)
# Return the dict for the current header
mustache_dict = {}
for item in stats_action:
# Add the limit to the mustache dict