Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to process_mon.sh and ubuntu_updates_check.sh #161

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

tcaddy
Copy link
Contributor

@tcaddy tcaddy commented Aug 3, 2018

Updates to process_mon.sh

Add an additional metric process_age to the process_mon.sh script. This will allow you to raise an alarm if a process has been running for too long.

Updates to ubuntu_update_check.sh

  • /usr/lib/update-notifier/apt-check was not returning a count of upgradeable packages on various machines even though you could see packages available for update via apt-get upgrade
  • Replace with apt list --upgradeable and parse out the count of upgradeable security and non-security package updates available

process_mon.sh Outdated
@@ -64,4 +68,12 @@ if [ -z "$1" ]; then
fi

process_check=`ps ax | grep -v grep | grep -v process_mon | grep -c "$1"`
if (( $process_check > 0 )); then
process_age=`ps -o etimes= -p "$process_check"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since $process_check will contain either 0 or 1 from the grep -c this doesn't seem to grab the etimes from the intended pid.

@tcaddy
Copy link
Contributor Author

tcaddy commented Aug 3, 2018

Oops thought it was getting a PID. Let me try again

@tcaddy tcaddy changed the title Get process age metric Updates to process_mon.sh and ubuntu_updates_check.sh Mar 20, 2019
PENDING_OTHER=$(echo "${OUTPUT}" | cut -d ";" -f 1)
PENDING_SECURITY=$(echo "${OUTPUT}" | cut -d ";" -f 2)
PENDING_OTHER=$(echo "${OUTPUT}" | grep -v "Listing..." | grep -v "/$(lsb_release -cs)-security" | wc -l)
PENDING_SECURITY=$(echo "${OUTPUT}" | grep -v "Listing..." | grep "/$(lsb_release -cs)-security" | wc -l)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick test and noticed that some packages on my system are available via both channels, so the pattern here needs to match a leading slash or comma in order to match:

ruby1.9.1-dev/trusty-updates,trusty-security 1.9.3.484-2ubuntu1.13 amd64 [upgradable from: 1.9.3.484-2ubuntu1.7]

 * /usr/lib/update-notifier/apt-check was not returning a count of
   upgradeable packages on various machines even though you could
   see packages available for update via `apt-get update`
 * Replace with `apt list --upgradeable` and parse out the count
   of upgradeable security and non-security package updates available
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.

2 participants