Presently I have a script, which i have set up cron on one of my Jump-boxes,and gives me the output on every hourly basis,fetching the data from the remote machine.Basically it gives me the list of all active users logged and its count once we execute the script.Here the count is mentioned/specified as Total Transaction(column)and users are mentioned as List of users(column).
Currently there are 100 users(different names) and the count is 100
below is the main script details
FILEDATE=`date +%F`
LOGFILE=/home/xyz/scripts/myscript.$FILEDATE.log
find /home/xyz/scripts/myscript.*.log -type f -mtime -3 -delete
touch $LOGFILE
exec 1>$LOGFILE 2>&1
for ip_addr in $(cat /home/xyz/scripts/ip_remote);do
echo "###logged into $ip_addr### "
ssh ${ip_addr} "bash -s" < /home/xyz/scripts/hourly_details
echo "###logged out $ip_addr###"
done
cat /home/xyz/scripts/myscript.$FILEDATE.log | mailx -s "Hourly active users" <ur email id>
the ip_remote consist of the remote ip address its going to login
the hourly_details consist of below
sudo su - abc
sh active.sh
Basically, I am looking to execute the script hourly on my jump-box but to notify me only when any of the users(List of users) are down and as per its count(Total Transactions).
Is there any way around ?
No, basically it has to alert us incase any of the users are down and with the count status.. I dont need to manually log into the jumpbox to check the logs size etc..
As described earlier, i just need to monitor just the Partner_id(column) and the total partners count, and notify me incase the count goes down and any of the users missing from the Partner_id column.
Both the points mentioned by you, is not meeting my goal..Need more inputs as per the points mentioned above.
Please tell us exactly and verbosely WHAT is correct and WHAT is an error. Intercept the result of the remote command and compare it to what you need it to be. If it is OK, don't log it. If it isn't, log it. If, at the end, logs exist, mail them.
I need the logs, but need to highlight it as to which one is down.(as mentioned below in the example)
I am looking to execute the script hourly basis on my jump-box and to notify me with the below mentioned output.
eg:
Below Partner_id is down: <Partner_id> (if the user is down)
All Partner_id is ok (If every thing is fine)
the Total partners: count <as per the latest update, with the total count>