Shell Script for Linux Server Monitoring

1486
shell-script-for-linux-server-monitoring

Using Shell Scripts to track Linux and Unix computers using ActiveXperts Network Monitor

Introduction

ActiveXperts Network Monitor ships with a group of shell scripts to automatically track distant Linux- based and Unix computers. There are two varieties of tests for this: an RSH test along with also an SSH check.

SSH enables secure network services over an insecure network, like the world wide web. Using SSH, ActiveXperts Network Monitor may log in on a remote machine running the SSH daemon, also implement a shell or command script. RSH is just another IP-based protocol to do programs on a distant Linux/Unix pc, but it’s less popular since it isn’t secure. Thus, SSH is advised for assessing distant Linux- based and Unix computers.

ActiveXperts Network Monitor needs the output (i.e., StdOut) to be ordered by the following syntax:

[ SUCCESS | ERROR | UNCERTAIN]: { <explanation> } { DATA:<value>}

The is going to be displayed from the last Response’ column at the Manager program. The field is going to be displayed from the data column at the Manager program.

Also See:  How to Take a Screenshot by Tapping the Back of Your iPhone

The shell script has to live on the Linux system, i.e., that you can’t use a script that resides on the Windows observation server. The shell script should possess the execute approval flag collection.

Following is a sample shell script that operates together using Network Monitor. The script checks the size of a directory:

#!/bin/bash
# Validate number of arguments
if [ $# -ne 2 ] ; then
  echo "UNCERTAIN: Invalid number of arguments - Usage: directory-size sDirectory nMaxSizeMB"
  exit 1
fi

# Validate numeric parameter nMaxSizeMB
regExpNumber='^[0-9]+$'
if ! [[ $2 =~ $regExpNumber ]] ; then
  echo "UNCERTAIN: Invalid argument: nMaxSizeMB (number expected)"
  exit 1
fi

# Check the size of the directory specified
if [ ! -d "$1" ]; then
  echo "UNCERTAIN: Directory [$1] does not exist"
  exit 0
fi

nSizeKB=`du -s "$1" | awk '{ print $1; }'`
nSizeMB=$( echo "$nSizeKB / 1024" | bc )

# Round a float to an integer value
nRoundSizeMB=$( echo "$nSizeMB / 1" | bc )

# Round a float to an integer value
nRoundMaxMB=$( echo "$2 / 1" | bc )

if [ $nRoundSizeMB -le $nRoundMaxMB ] ; then
  echo "SUCCESS: Size=[$nRoundSizeMB MB], max. allowed=[$nRoundMaxMB MB] DATA:$nRoundSizeMB"
else
  echo "ERROR: Size=[$nRoundSizeMB MB], max. allowed=[$nRoundMaxMB MB] DATA:$nRoundSizeMB"
fi

exit 0

Network Monitor Shell Script assesses

ActiveXperts Network Monitor ships with a choice of shell scripts. These scripts operate from the box. The scripts are in the \Scripts\Monitor (Linux) (e.g., C:\Software Files\ActiveXperts\Network Monitor\Scripts\Monitor (Linux). You have to copy the script into the Linux machine to conduct the script.

Also See:  No Sound After AVG Install on Windows 10 Computers

Samples

CPU usage test

Click here to get a CPU monitoring script.

Directory size test

Click here to get a directory size test.

Disk Existence test

Click here to get a disc presence check.

Disk Free Space test

Click here to get a disc-free space test.

Disk Used Space test.

Click here to get a disc used space test.

Disk Used Space reverse check.

Click here to get a disc used space percent test.

E-mail POP3 check

Click here to get an emaiemail3 check.

E-mail SMTP check

Click here to get an emaiemailP check.

Document content check

Click here to get a record content test.

File existence check

Click here to get a file presence check.

Also See:  Analysts says no OLED iPad Air next year

Memory use test

Click here to get a memory tracking script.

Ping check

Click here to get a ping test.

Procedure check

Click here to get a procedure check.

User Exists

Click here to get a Linux User Existence test.