Sponsored Content
Full Discussion: Sensors in terminal?
Top Forums UNIX for Dummies Questions & Answers Sensors in terminal? Post 302306163 by TonyFullerMalv on Saturday 11th of April 2009 10:45:30 AM
Old 04-11-2009
Okay, if you save the above script as say /usr/local/sbin/lm_sensor_temperature_check.sh with the lines:
#!/bin/ksh
or
#!/bin/bash
as the very first line to specify what shell the script is to run in. Run:
Code:
# chmod 500 /usr/local/sbin/lm_sensor_temperature_check.sh

to make it executable.

Add a line to root crontab to run this script once an hour do the following:
Code:
# crontab -l > /tmp/root.crontab
# echo "0 * * * * /usr/local/sbin/lm_sensor_temperature_check.sh" >> /tmp/root.crontab
# crontab  /tmp/root.crontab

This will now run every hour and if the temp1 line from lm_sensor indicates that the measured temperature is above the 124 critical temperature then it will add a line to the /var/log/syslog log file (check the /etc/syslog.conf log to confirm where the alarm you select gets logged to) that you can then get HP OVO of BMC patrol (or whatever system monitoring software you are using) to look for the "temp1 is too high" string and raise an alert, or else you could replace the "logger -p" line in the script with a line to send an email somewhere, e.g.:
Code:
echo "ALERT: The measured temperature of ${TEMP} is great then critical temp. of ${THRSHOLD}." > /tmp/temp.log
mailx -s "Machines `uname -n` temperature is too high" user@foo.com < /tmp/temp.log


Last edited by TonyFullerMalv; 04-11-2009 at 11:52 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

connecting to unix through hyper terminal - as a dumb terminal

I just changed from windows NT to XP and I am no longer able to connect to my unix system. I used to use hyper terminal -- which acts as dumb terminal to my main frame unix system. I think one of the options used to be "direct to comX". This option isn't listed now. I use a serial port and the... (2 Replies)
Discussion started by: michelle
2 Replies

2. UNIX for Advanced & Expert Users

Pseudo-terminal will not be allocated because stdin is not a terminal.

I am trying to automate a SSH login using Keys using the following command ssh -i id_rsa usernamw@ipaddr. I am successful in doing this and i am getting the Warning Screen and I logon successfully. but when I am executing the command tail -1cf put.dat | ssh -i id_rsa username@ipaddr > get.dat ... (1 Reply)
Discussion started by: Shivdatta
1 Replies

3. UNIX for Dummies Questions & Answers

Gnuplot wxt terminal vs x11 terminal

Hi, I installed ubuntu recently on my pc. And I installed gnuplot as well. When I first started working with gnuplot it was working . I did a plot and when I wanted to fit my data something happened and not the default terminal of gnuplot is xwt! I changed it to: set terminal x11, but it... (0 Replies)
Discussion started by: cosmologist
0 Replies

4. Shell Programming and Scripting

Need help with Expect script for Cisco IPS Sensors, Expect sleep and quoting

This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies

5. UNIX for Dummies Questions & Answers

Sensors Explanations

Hello, I am trying to get some information from the sensors on my pc. But i get confuse with what i get. I don t know where to find out which sensors watches what.. I use "sensors" under ubuntu 10.10. Here is the result of the cmd line sudo sensors. the temp 3 indicates 79°C which... (0 Replies)
Discussion started by: Mat_k
0 Replies

6. UNIX for Dummies Questions & Answers

Does DOS has a terminal or pseudo terminal?

I am wondering if the DOS console works like the unix terminal? (1 Reply)
Discussion started by: vistastar
1 Replies

7. Shell Programming and Scripting

Cannot get terminal application to launch with a graphical launcher when successful in terminal

I have been having an extremely annoying problem. For the record, I am relatively new at this. I've only been working with unix-based OS's for roughly two years, mostly Xubuntu and some Kali. I am pretty familiar with the BASH language, as that's the default shell for debian. Now, I've made this... (16 Replies)
Discussion started by: Huitzilopochtli
16 Replies

8. Shell Programming and Scripting

Print Terminal Output Exactly how it Appears in the Terminal to a New Text File

Hello All, I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly. Is there any way to take the output from the cat... (7 Replies)
Discussion started by: mrm5102
7 Replies

9. UNIX for Beginners Questions & Answers

Trying monitor of sensors through smartphones

I was able to enable the Mosquitto MQTT using instructable Now I need to communicate my new wireless sensor to communicate with Mosquito in such a way that it will display tracker in which it shows the readings of sensor, Also need to know how can to display the notification on smartphones... (0 Replies)
Discussion started by: Brandy85
0 Replies
SoSensor(3)							       Coin							       SoSensor(3)

NAME
SoSensor - The SoSensor class is the abstract base class for all sensors. Sensors is a mechanism in Coin for scheduling jobs to be run upon specific events. The events in question could be particular points in time, or changes to entities in the scene graph. SYNOPSIS
#include <Inventor/sensors/SoSensor.h> Inherited by SoDelayQueueSensor, and SoTimerQueueSensor. Public Member Functions SoSensor (void) SoSensor (SoSensorCB *func, void *data) virtual ~SoSensor (void) void setFunction (SoSensorCB *callbackfunction) SoSensorCBPtr getFunction (void) const void setData (void *callbackdata) void * getData (void) const virtual void schedule (void)=0 virtual void unschedule (void)=0 virtual SbBool isScheduled (void) const =0 virtual void trigger (void) virtual SbBool isBefore (const SoSensor *s) const =0 void setNextInQueue (SoSensor *next) SoSensor * getNextInQueue (void) const Static Public Member Functions static void initClass (void) Protected Attributes SoSensorCB * func void * funcData Detailed Description The SoSensor class is the abstract base class for all sensors. Sensors is a mechanism in Coin for scheduling jobs to be run upon specific events. The events in question could be particular points in time, or changes to entities in the scene graph. See documentation of subclasses for insight into exactly for what types of events we can trigger sensor callbacks. For most tasks where application programmers can use sensors, it is also possible to achieve the same results by using engines. There are a few important differences between sensors and engines, though: Engines are considered part of the scene graph, and is written to file upon SoWriteAction export operations. Sensors, on the other hand, are not included in export operations. Engines basically connects fields (and comes with a lot of builtin functionality for combining and converting inputs and outputs), you just decide which engine you want, connect inputs and output and forgets about it. Sensors are a lot more flexible in what you can do when they trigger, as control is transfered internally from Coin to your registered callback functions. See also: SoSensorManager, SoEngine Constructor &; Destructor Documentation SoSensor::SoSensor (void) Constructor. SoSensor::SoSensor (SoSensorCB *funcptr, void *data) Constructor taking as parameters the sensor callback function func and the user data pointer which will be passed the callback. See also: setFunction(), setData() SoSensor::~SoSensor (void) [virtual] Destructor. Member Function Documentation void SoSensor::setFunction (SoSensorCB *callbackfunction) Set the callback function pointer which will be used when the sensor is triggered. See also: getFunction(), setData() SoSensorCB * SoSensor::getFunction (void) const Returns the callback function pointer. See also: setFunction() void SoSensor::setData (void *callbackdata) Set the user-supplied data pointer which will be used as the first argument to the sensor callback function. See also: getData(), setFunction() void * SoSensor::getData (void) const Returns the user-supplied callback function data pointer. See also: setData() void SoSensor::schedule (void) [pure virtual] Put the sensor in a queue to be triggered at a later time. See also: unschedule(), isScheduled() Implemented in SoDelayQueueSensor, SoTimerSensor, SoAlarmSensor, and SoTimerQueueSensor. void SoSensor::unschedule (void) [pure virtual] Remove sensor from queue. The sensor will not be triggered unless it is later rescheduled. See also: schedule(), isScheduled() Implemented in SoDelayQueueSensor, SoTimerSensor, and SoTimerQueueSensor. SbBool SoSensor::isScheduled (void) const [pure virtual] Check if this sensor is scheduled for triggering. See also: schedule(), unschedule() Implemented in SoDelayQueueSensor, and SoTimerQueueSensor. void SoSensor::trigger (void) [virtual] Trigger the sensor's callback function. Reimplemented in SoDataSensor, SoDelayQueueSensor, SoTimerQueueSensor, and SoFieldSensor. SbBool SoSensor::isBefore (const SoSensor *s) const [pure virtual] Returns TRUE if this sensor should precede sensor s in its sensor queue. void SoSensor::setNextInQueue (SoSensor *next) This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. Open Inventor function not implemented in Coin. SoSensor * SoSensor::getNextInQueue (void) const This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. Open Inventor function not implemented in Coin. void SoSensor::initClass (void) [static] Sets up initialization for static data for the sensors. Called by SoDB::init(). Member Data Documentation SoSensorCB * SoSensor::func [protected] Function to be called when a sensor triggers. void * SoSensor::funcData [protected] Data passed to the callback function. Author Generated automatically by Doxygen for Coin from the source code. Version 3.1.3 Wed May 23 2012 SoSensor(3)
All times are GMT -4. The time now is 11:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy