Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote monitor multiple Linux servers on LAN (isolated)

Status
Not open for further replies.

darkcodec

Technical User
Sep 27, 2019
1
JO

Inside my isolated local LAN I have one Linux box working as a deployment host (Orchestrator) Monitoring multiple Linux boxes Box1, Box2....Boxn. On the deployment Linux box, i have installed smstools to send me sms.
I want to build a script placed on the deployment host to monitor specific process on each linux box, and give me on daily basis SMS messages which kind on process running.

========//script.sh//==============
#!/bin/bash
for host in $(cat /home/operator/shellscripts/host.txt)
do
echo -n > /home/operator/shellscripts/$host.txt
for process in $(cat /home/operator/shellscripts/process.txt)
do
ssh $host "ps ax | grep $process | grep -v grep" > /home/operator/shellscripts/$host.txt
if [[ -s /home/operator/$host.txt ]] ; then
echo $process is running in $host
sendsms
else
echo $process is not running in $host
sendsms
fi ;
done
done



in the host, file stated all hosts IP's I need to monitor
=========//host.txt//========
X.X.X.X
Y.Y.Y.Y
Z.Z.Z.Z
...

in the process.txt stated all process i need to monitor on each box (for example i have to look if NTP and HTTP working on the fist host X.X.X.X) and so on

==========//process.txt//===========
ntp http
mysql
oracle cluster
https http
...

in the phonelist.txt stated all numbers of whitelisted operators, they should be notified about all hosts
==========//phonelist.txt//===============
009XXXXXXXXXXXX #op1
009yyyyyyyyyyyy #op2
009zzzzzzzzzzzz #op3


in the authen.txt stated the username/password of the operator to login via ssh on each server, each server has its own authentication credential.
===========//authen.txt//==============
operator1 password1 #box1
operator2 password2 #box2



The output should be like this inside the SMS
named, http running in x.x.x.x (OK)
https not runnning in x.x.x.x
mysql running in y.y.y.y (OK)
...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top