nicolargo / glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
http://nicolargo.github.io/glances/
Other
26.38k stars 1.5k forks source link

Actions does not work in server mode #1879

Open klin938 opened 3 years ago

klin938 commented 3 years ago

Describe the bug Glances starts as server mode does not trigger configured actions

To Reproduce Steps to reproduce the behavior:

  1. /usr/local/bin/glances -s OR /usr/local/bin/glances -s -C /etc/glances/glances.conf
  2. added CPU actions such as: total_warning_action=/opt/host_utils/test.sh total_critical_action=/opt/host_utils/test.sh
  3. Generate some CPU loads such as for i in $(seq $(getconf _NPROCESSORS_ONLN)); do yes > /dev/null & done

Expected behavior test.sh sends a email to root

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

glances --issue

========================================================= Glances version 3.1.7 with PsUtil 5.8.0

alert [OK] 0.0000s [[1623734993.0, -1, 'CRITICAL', 'CPU_TOTAL', 100.0, 100.0, 100.0, 100.0, 1, [], '', 'cpu_percent']] amps [OK] 0.0002s [{'key': 'dropbox', 'name': 'Dropbox', 'result': None, 'refresh': 3.0, 'timer': 0.6666746139526367, 'count': 0, 'countmin': 1.0, 'cou cloud [OK] 0.0000s {} connections [N/A] core [OK] 0.0065s {'phys': 32, 'log': 64} cpu [OK] 0.0010s {'total': 100.0, 'user': 99.0, 'system': 1.0, 'idle': 0.0, 'nice': 0.0, 'iowait': 0.0, 'irq': 0.0, 'softirq': 0.0, 'steal': 0.0, 'gue diskio [OK] 0.0018s [{'time_since_update': 1, 'disk_name': 'sda', 'read_count': 0, 'write_count': 0, 'read_bytes': 0, 'write_bytes': 0, 'key': 'disk_name docker [OK] 0.0001s [] folders [OK] 0.0000s [] fs [OK] 0.0008s [{'device_name': '/dev/sda1', 'fs_type': 'ext4', 'mnt_point': '/', 'size': 884752564224, 'used': 31802556416, 'free': 807983296512, ' gpu [OK] 0.0000s [] help [OK] 0.0000s None ip [OK] 0.0000s {} irq [OK] 0.0262s [{'irq_line': 'LOC', 'irq_rate': 5570, 'key': 'irq_line', 'time_since_update': 0.0862588882446289}, {'irq_line': 'RES', 'irq_rate': 3 load [OK] 0.0001s {'min1': 64.1, 'min5': 52.71, 'min15': 44.67, 'cpucore': 64} mem [OK] 0.0003s {'total': 540844027904, 'available': 533587288064, 'percent': 1.3, 'used': 7256739840, 'free': 533587288064, 'active': 3640410112, 'i memswap [OK] 0.0005s {'total': 0, 'used': 0, 'free': 0, 'percent': 0.0, 'sin': 0, 'sout': 0} network [OK] 0.0024s [{'interface_name': 'p2059p1', 'time_since_update': 1, 'cumulative_rx': 8971611, 'rx': 60, 'cumulative_tx': 582731, 'tx': 0, 'cumulat now [OK] 0.0000s 2021-06-15 15:29:53 AEST percpu [OK] 0.0006s [{'key': 'cpu_number', 'cpu_number': 0, 'total': 100.0, 'user': 98.0, 'system': 0.0, 'idle': 0.0, 'nice': 0.0, 'iowait': 0.0, 'irq': ports [OK] 0.0064s [] processcount [OK] 0.5201s {'total': 679, 'running': 65, 'sleeping': 614, 'thread': 887, 'pid_max': 0} processlist [OK] 0.0011s [{'cpu_percent': 102.0, 'memory_info': pmem(rss=626688, vms=110649344, shared=524288, text=24576, lib=0, data=323584, dirty=0), 'user psutilversion [OK] 0.0000s (5, 8, 0) quicklook [OK] 0.0013s {'cpu': 100.0, 'percpu': [{'key': 'cpu_number', 'cpu_number': 0, 'total': 100.0, 'user': 98.0, 'system': 0.0, 'idle': 0.0, 'nice': 0. raid [N/A] sensors [OK] 0.0191s [{'label': 'k10temp 1', 'value': 51, 'unit': 'C', 'type': 'temperature_core', 'key': 'label'}, {'label': 'k10temp 2', 'value': 51, 'u smart [N/A] system [OK] 0.0198s {'os_name': 'Linux', 'hostname': 'c6145-1-20.local', 'platform': '64bit', 'linux_distro': 'CentOS Linux 7.8.2003', 'os_version': '3.1 uptime [OK] 0.0005s {'seconds': 90829} wifi [N/A] ` Additional context When I startup glances normally (as interactive mode), or glances --stdout cpu.user,mem.used,load, the actions triggered and script executed properly.

nicolargo commented 3 years ago

Yes, for the moment actions are manage per plugins, so they are only triggered on the server side, not the client side.