8
votes
Loop to print changes in irrigation state to turn on and off a pump when water is low
Just curious, but have you checked CPU usage ? Programs that run in a while loop can be terribly inefficient and taxing. Here you are just probing a sensor, this does not look like a computationally-...
7
votes
Laptop battery level monitor for Linux
You could replace your get_str_from_file function with the standard read_to_string function:
For instance like so:
...
6
votes
Accepted
NRPE script for monitoring load average
This looks pretty good. Some suggestions:
[[ is preferred over [ in Bash.
This script could benefit from ...
6
votes
Loop to print changes in irrigation state to turn on and off a pump when water is low
If I understand what you are trying to do, I think you can (1) remember the
prior state, (2) print only on changes, and (3) select the message to
print based on the new state.
...
5
votes
Accepted
C# classes for system health metrics
A design pattern often used, is to have a non generic base type and a generic type derived from it or a type implementing a non generic as well as a generic interface. An example is
...
5
votes
Log monitoring with pythonic tail -f and process killing
Using regex for such a simple task as finding if a line contains a string is not worth it. The built-in str.__contains__, being called by the keyword ...
5
votes
Python script for alerting disk usage and take action if needed
Overall not bad! You've managed to avoid many of the "usual suspects" when it comes to Python scripting practices.
make_logger could use a return ...
5
votes
Remotely collect server data using Net::OpenSSH
Looks good to me. Kudos for the "... or die" idiom. More informative output would be "unable to run df on $s" or "unable to run svmon on $s".
You don't have to do ...
4
votes
BASH script to monitor subprocess and throttle it for CPU temperature control
Although unrelated to the code, I'll mention that for a CPU to overheat, especially a dual-core CPU, is not usual except with very high ambient temps. I'd suggest removing the heat sink and re-...
4
votes
Accepted
Laptop battery level monitor for Linux
Unwrapping options is probably fine for this simple little app that only you’re using, but it dumps out a panic if the result is None. I like your use of ...
4
votes
Express.js functions to start session, authenticate user, perform ping, search for user, reset password, and import product XML
The general rule is that you should never incorporate user-controlled input into a string that will be interpreted by a computer system without escaping it first. Specifically, at a quick glance, it'...
4
votes
Accepted
Loop to print changes in irrigation state to turn on and off a pump when water is low
I agree with @Anonymous that you should not loop continuously like that, or you'll waste energy and CPU time continuously checking the values. To solve this you can just sleep, wake up every minute, ...
3
votes
Accepted
Python script for alerting disk usage and take action if needed
First, some minor issues:
logger is a global variable, and all your functions are completely dependent on it being present -- and if you ...
3
votes
C# classes for system health metrics
I just have a couple of minor points to add to Olivier Jacot-Descombes' excellent answer.
...
3
votes
NRPE script for monitoring load average
I’d agree with all of l0b0’s answer – including the suggestion of using grep to process /proc/cpuinfo. An alternate way to count ...
3
votes
Bash script to send notifications when low on ram
Kudos to you! This is a nice little script, easy to read and to understand. However, there is no reason to reach for expr. Most shells (including ...
3
votes
Send a tweet to ISP when internet speed drops
Let me add improvement, in regard that has already been added in other comments:
Use the out-of-box Python logger package instead of writing own one
Totally agree with @grajdeanu-alex about a ...
3
votes
Accepted
Multithreaded C program to calculate CPU usage of cgroups
Global Variables
I see this comment just prior to the declarations for the global variables:
//TODO: localize?
My answer would be yes. It is very difficult to read,...
3
votes
Accepted
Python script which sends telegram message if Raspberry Pi's temperature crosses 60 °C
chatId -> chat_id and similar for other members and method names, by PEP8 standard
...
2
votes
Automatic ping check program
Note: Bear in mind that you are relying on the OS's ability to correctly calculate packet loss. (Please see: https://networkengineering.stackexchange.com/questions/30940/difference-between-ping-timed-...
2
votes
Check SMART status on MacOS and pop up alert
Some suggestions:
A direct string comparison test may be flaky especially if the string contains multiple space characters. I can think of three alternatives:
Use regex matching: this can be achieved ...
2
votes
A website status monitor in Python/Flask
This looks like a very good status page. Well done !
Review
from settings import refresh_interval, filename, site_down
I recommend that you use set of config ...
2
votes
Log monitoring with pythonic tail -f and process killing
... about making this class based, but it really doesn't make sense to do
it ...
I'd not agree with that, because:
same arguments filename/f and ...
2
votes
Accepted
NRPE script for monitoring memory usage
I don't understand why it should be a warning to have over 80% of the system RAM available. If anything needs a warning, it should be having under 20% of RAM available, right?
Reading each line into ...
2
votes
Accepted
Online check with retry logic and anti-flapping
If, as you say in your comments, everything is more or less a single main() function, I would start by splitting things up to make reasonning about each part (and ...
1
vote
Accepted
Program to continuously check availability of internet connection c#
You probably want to avoid using recursion on conn. Say you did not have internet connection for a long time. Then, for every failed connection you will add a new ...
1
vote
Log monitoring with pythonic tail -f and process killing
Here is my contribution.
You should not make the while True loop, instead of that you should use inotify in order to been notify only when changes happen on the file that you are monitoring, here is ...
1
vote
Accepted
HTTP status monitoring
Not a full review, but several issues pop up at a quick scan:
Avoid panic, it's meant for reporting a bug in the program (e.g. dividing by zero, failing a bounds ...
1
vote
Accepted
Application to monitor device power levels for deviations
I'll also begin with the low hanging fruit mentioned by Mateusz Konieczny. PEP8/pylint/etc. your code. It is decently formatted, but there are some issues. Before even considering optimizing ...
1
vote
Bash script to send notifications when low on ram
I like the script. But I have maybe some suggestions for improvement.
This part:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
status-monitoring × 53python × 17
linux × 12
networking × 11
beginner × 9
bash × 8
email × 7
performance × 6
python-3.x × 6
shell × 6
c × 5
c# × 4
ruby × 4
multithreading × 4
perl × 4
plugin × 4
ssh × 4
python-2.x × 3
json × 3
http × 3
logging × 3
socket × 3
javascript × 2
node.js × 2
api × 2