Skip to content

Update linux_disk_usage.sh#159

Merged
silversword411 merged 9 commits intoamidaware:mainfrom
SpookOz:main
Jun 14, 2023
Merged

Update linux_disk_usage.sh#159
silversword411 merged 9 commits intoamidaware:mainfrom
SpookOz:main

Conversation

@SpookOz
Copy link
Copy Markdown
Contributor

@SpookOz SpookOz commented Jun 7, 2023

This is a cool script! I just made a few changes that I think may improve it:

  1. Added a $WARNINGVALUE (which can be lower than the $ERRORVALUE. If the disk is only at warning stage, it will exit with error code 2 instead of 1. In TRMM, you can set code 2 to be a warning (in automation) so you have time to fix the issue before it gets critical.

  2. Added the option to change the warning and error value with ENV VARs so you don't need to change the code if they don't suit you, or you can customise it for different servers.

  3. Rather than incrementing, I just set $ERROROUTCODE and $WARNINGOUTCODE to 1. I figure as long as there is at least one disk, it doesn't matter how many - it will still give an error or warning.

This is a cool script! I just made a few changes that I think may improve it:

1. Added a $WARNINGVALUE (which can be lower than the $ERRORVALUE. If the disk is only at warning stage, it will exit with error code 2 instead of 1. In TRMM, you can set code 2 to be a warning (in automation) so you have time to fix the issue before it gets critical.

2. Added the option to change the warning and error value with ENV VARs so you don't need to change the code if they don't suit you, or you can customise it for different servers.

3. Rather than incrementing, I just set $ERROROUTCODE and $WARNINGOUTCODE to 1. I figure as long as there is at least one disk, it doesn't matter how many - it will still give an error or warning.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 7, 2023

CLA assistant check
All committers have signed the CLA.

SpookOz added 2 commits June 7, 2023 16:33
This script checks for a number of defined services to make sure they are running. If the service doesn't exist, it skips over it. I created this, because I wanted to be notified urgently if critical services that my servers depend on are down (rather than less important services).
This script will check if a number of defined Linux processes are running and give an error if they are not. The processes are defined by an ENV VAR using format PROCESSES=process1 process2 process3.

I found this useful for monitoring critical processes on my Linux servers.
@SpookOz
Copy link
Copy Markdown
Contributor Author

SpookOz commented Jun 7, 2023

I've added two more scripts. One to check a number of specified services, and another to check a number of specified processes.

SpookOz added 3 commits June 7, 2023 16:51
This shell script gets the load average of a Linux machine and checks it against a specified threshold (default is 1, but the user can specify a different threshold in the ENV VAR). It checks 1m, 5m and 15m load averages and gives warnings if they are outside the threshold.
This shell script is only for Linux machines running docker. It downloads an image and runs a small Docker container that pulses the run commands of every container in Docker. I find this useful for keeping track of the containers I am running in case I need to run them again.
This script is an extension on the current Linux memory check script. I have modified it to include physical and swap. It also has 3 thresholds: OK, low and critically low.

It checks the free physical mem first. If the physical memory is less than min, the script will check swap.
If swap is more than ok amount, the script gives a warning.
If swap is less than ok amount, the script gives a warning.
If swap is also lower than min, the script gives an error.

The script allows the user to specify the threshold using ENV VARs, but if they don't, it uses defaults.
@SpookOz
Copy link
Copy Markdown
Contributor Author

SpookOz commented Jun 7, 2023

Sorry - added a couple more scripts!

@silversword411
Copy link
Copy Markdown
Contributor

You've got 2 files in the root, they should be in the wip folder :)

@silversword411
Copy link
Copy Markdown
Contributor

Persistence is an attribute of the successful!

Thank you for the PR!

@silversword411 silversword411 merged commit 1541bb1 into amidaware:main Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants