GithubHelp home page GithubHelp logo

check_temp's Introduction

check_temp's People

Contributors

elyrith avatar jackbenny avatar kikniknik avatar lucaswall avatar onkobu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

check_temp's Issues

Output of sensors cannot be parsed

Currently sensors' output looks like:

k10temp-pci-00c3
Adapter: PCI adapter
Tdie:         +27.0°C  (high = +70.0°C)
Tctl:         +27.0°C  

Adding -A removes the line starting with Adapter. But the combination of grep and head -n1 only yields k10temp-pci-00c3. Instead the second line seems to always contain the/a temperature. (Tdie could also be temp1 or any arbitrary string depending on the kernel. I'm running on kernel 5.4.72 with lm-sensors-3.6.0.)

--sensor have spaces,display_name fail.

my sensor output

tg3-pci-0301
Adapter: PCI adapter
temp1:        +73.0°C  (high = +100.0°C, crit = +110.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +41.0°C  (high = +85.0°C, crit = +105.0°C)
Core 0:        +33.0°C  (high = +85.0°C, crit = +105.0°C)
Core 1:        +40.0°C  (high = +85.0°C, crit = +105.0°C)
Core 2:        +35.0°C  (high = +85.0°C, crit = +105.0°C)
Core 3:        +37.0°C  (high = +85.0°C, crit = +105.0°C)

acpitz-acpi-0
Adapter: ACPI interface
temp1:         +8.3°C  (crit = +31.3°C)

tg3-pci-0300
Adapter: PCI adapter
temp1:        +73.0°C  (high = +100.0°C, crit = +110.0°C)

power_meter-acpi-0
Adapter: ACPI interface
power1:        0.00 W  (interval = 300.00 s)

i run it with

bash -x ./check_temp.sh -w 65 -c 75 -s "Core 1",cpu -s Core\ 2,cpu2 

out,

+ VERSION='Version 1.0'
+ AUTHOR='(c) 2011 Jack-Benny Persson ([email protected])'
++ awk '{print $2}'
++ whereis -b -B /bin /sbin /usr /bin/arch /bin/ash /bin/base64 /bin/bash /bin/bbconfig /bin/busybox /bin/cat /bin/chgrp /bin/chmod /bin/chown /bin/conspy /bin/cp /bin/date /bin/dd /bin/df /bin/dmesg /bin/dnsdomainname /bin/dumpkmap /bin/echo /bin/ed /bin/egrep /bin/false /bin/fatattr /bin/fdflush /bin/fgrep /bin/findmnt /bin/fsync /bin/getopt /bin/grep /bin/gunzip /bin/gzip /bin/hostname /bin/ionice /bin/iostat /bin/ipcalc /bin/kbd_mode /bin/kill /bin/link /bin/linux32 /bin/linux64 /bin/ln /bin/login /bin/ls /bin/lsblk /bin/lzop /bin/makemime /bin/mkdir /bin/mknod /bin/mktemp /bin/more /bin/mount /bin/mountpoint /bin/mpstat /bin/mv /bin/netstat /bin/nice /bin/pidof /bin/ping /bin/ping6 /bin/pipe_progress /bin/printenv /bin/ps /bin/pwd /bin/reformime /bin/rev /bin/rm /bin/rmdir /bin/run-parts /bin/sed /bin/setpriv /bin/setserial /bin/sh /bin/sleep /bin/stat /bin/stty /bin/su /bin/sync /bin/tar /bin/touch /bin/true /bin/umount /bin/uname /bin/usleep /bin/watch /bin/wdctl /bin/zcat /sbin/acpid /sbin/adjtimex /sbin/agetty /sbin/apk /sbin/arp /sbin/blkdiscard /sbin/blkid /sbin/blkzone /sbin/blockdev /sbin/chcpu /sbin/ctrlaltdel /sbin/depmod /sbin/fbsplash /sbin/fdisk /sbin/findfs /sbin/fsck /sbin/fsck.cramfs /sbin/fsck.minix /sbin/fsfreeze /sbin/fstrim /sbin/getty /sbin/halt /sbin/hdparm /sbin/hwclock /sbin/ifconfig /sbin/ifdown /sbin/ifenslave /sbin/ifup /sbin/init /sbin/inotifyd /sbin/insmod /sbin/ip /sbin/ipaddr /sbin/iplink /sbin/ipneigh /sbin/iproute /sbin/iprule /sbin/iptunnel /sbin/klogd /sbin/ldconfig /sbin/loadkmap /sbin/logread /sbin/losetup /sbin/lsmod /sbin/mdev /sbin/mkdosfs /sbin/mkfs /sbin/mkfs.bfs /sbin/mkfs.cramfs /sbin/mkfs.minix /sbin/mkfs.vfat /sbin/mkmntdirs /sbin/mkswap /sbin/modinfo /sbin/modprobe /sbin/nameif /sbin/nologin /sbin/pivot_root /sbin/poweroff /sbin/raidautorun /sbin/raw /sbin/reboot /sbin/rmmod /sbin/route /sbin/setconsole /sbin/slattach /sbin/swaplabel /sbin/swapoff /sbin/swapon /sbin/switch_root /sbin/sysctl /sbin/syslogd /sbin/tunctl /sbin/udhcpc /sbin/vconfig /sbin/watchdog /sbin/wipefs /sbin/zramctl /usr/bin /usr/include /usr/lib /usr/libexec /usr/local /usr/sbin /usr/share /usr/src -f sensors
+ SENSORPROG=/usr/bin/sensors
+ '[' -e /utils.sh ']'
+ STATE_OK=0
+ STATE_WARNING=1
+ STATE_CRITICAL=2
+ STATE_UNKNOWN=3
+ thresh_warn=
+ thresh_crit=
+ default_sensor=CPU
+ sensor_declared=false
+ STATE=0
+ [[ ! -x /usr/bin/sensors ]]
+ [[ -n -w ]]
+ case "$1" in
+ [[ -z 65 ]]
+ [[ 65 = +([0-9]) ]]
+ thresh=65
+ thresh_warn=65
+ shift 2
+ [[ -n -c ]]
+ case "$1" in
+ [[ -z 75 ]]
+ [[ 75 = +([0-9]) ]]
+ thresh=75
+ thresh_crit=75
+ shift 2
+ [[ -n -s ]]
+ case "$1" in
+ [[ -z Core 1,cpu ]]
+ sensor_declared=true
+ process_sensor Core 1,cpu
++ echo Core
+ sensor=Core
++ echo Core
+ sensor_display=Core
+ echo 'sensor is Core'
sensor is Core
+ [[ -z Core ]]
+ [[ -z 65 ]]
+ [[ -z 75 ]]
+ [[ 75 -lt 65 ]]
++ /usr/bin/sensors
++ grep Core
++ head -n1
++ head -n1
++ grep -o '+[0-9]\+\(\.[0-9]\+\)\?[^ \t,()]*'
+ WHOLE_TEMP=+33.0°C
++ echo +33.0°C
++ grep -o '[0-9]\+\(\.[0-9]\+\)\?'
+ TEMPF=33.0
++ echo 33.0
++ cut -d. -f1
+ TEMP=33
+ echo Core test
Core test
+ echo Core test
Core test
+ [[ '' -ge 1 ]]
+ PERFDATA=' Core=33;65;75'
+ [[ 33 != +([0-9]) ]]
+ [[ 33 -gt 75 ]]
+ [[ 33 -gt 65 ]]
+ OUTPUT_TEXT=', Core has temperature: +33.0°C'
+ set_state 0
+ [[ 0 -lt 0 ]]
+ shift 2
+ [[ -n -s ]]
+ case "$1" in
+ [[ -z Core 2,cpu2 ]]
+ sensor_declared=true
+ process_sensor Core 2,cpu2
++ echo Core
+ sensor=Core
++ echo Core
+ sensor_display=Core
+ echo 'sensor is Core'
sensor is Core
+ [[ -z Core ]]
+ [[ -z 65 ]]
+ [[ -z 75 ]]
+ [[ 75 -lt 65 ]]
++ /usr/bin/sensors
++ grep -o '+[0-9]\+\(\.[0-9]\+\)\?[^ \t,()]*'
++ ++ grep Core
head -n1
++ head -n1
+ WHOLE_TEMP=+33.0°C
++ echo +33.0°C
++ grep -o '[0-9]\+\(\.[0-9]\+\)\?'
+ TEMPF=33.0
++ echo 33.0
++ cut -d. -f1
+ TEMP=33
+ echo Core test
Core test
+ echo Core test
Core test
+ [[ '' -ge 1 ]]
+ PERFDATA=' Core=33;65;75 Core=33;65;75'
+ [[ 33 != +([0-9]) ]]
+ [[ 33 -gt 75 ]]
+ [[ 33 -gt 65 ]]
+ OUTPUT_TEXT=', Core has temperature: +33.0°C, Core has temperature: +33.0°C'
+ set_state 0
+ [[ 0 -lt 0 ]]
+ shift 2
+ [[ -n '' ]]
+ '[' true = false ']'
+ case "$STATE" in
+ STATE_TEXT=OK
++ echo , Core has temperature: +33.0°C, Core has temperature: +33.0°C
++ sed -e 's/, //'
+ OUTPUT_TEXT='Core has temperature: +33.0°C, Core has temperature: +33.0°C'
+ echo 'TEMPERATURE OK - Core has temperature: +33.0°C, Core has temperature: +33.0°C | Core=33;65;75 Core=33;65;75'
TEMPERATURE OK - Core has temperature: +33.0°C, Core has temperature: +33.0°C | Core=33;65;75 Core=33;65;75
+ exit 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.