Version : v0.5.2
Release Date : 25-Mar-23
mTracker is small script to track user Activities on linux system. We can monitor all user what commands they are executing on linux system.
it will send you Notification for following activity.
- Track user command activity.
- Track SSH login Activity
- Realtime Monitor system CPU,Memory,Disk usage.
- Get All Notification on your favourite slack channel.
you need slack token to configure mTracker. so first follow below link to create your slack token.
We can install this script on any of linux system.
# Download mtracker
sudo curl -sL https://github.com/HarryTheDevOpsGuy/mTracker/raw/master/x86_64/mtracker -o /usr/bin/mtracker
sudo chmod +x /usr/bin/mtracker && sudo mtracker && mtracker -v
# To send notification using slack token and slack channel.
mtracker -c '#mcloud-alerts' -t 'xoxb-slack_token'
if you want want to pass slack token runtime you can set/export below variables.
export SLACK_CHANNEL="#devops"
export SLACK_CLI_TOKEN="xoxb-your-slack-token****"
mtracker
it allow you to monitor user activity and notify you on slack channel.
2.1 - To get users command history logs on your slack channel. You need to uncomment below lines and update your slack token and channel in /etc/profile.d/mTracker.sh
file.
export SLACK_CLI_TOKEN='xoxb-your-slack-token'
export SLACK_CHANNEL="#devops"
2.2 - Now logout and login again to test. if you configured above configs properly. you will get alert as below.
![Alt text](https://github.com/HarryTheDevOpsGuy/mTracker/raw/master/src/Alert-sample.png)
2.3 - Done!! if any user will login and run any linux command it will notify you on slack channel.
We can monitor realtime disk,CPU and memory Utilization. it will notify you on slack channel only. You need to create mwatcher config file and set cron accordingly.
-
Create config file vim /etc/watcher.sh
export SLACK_CLI_TOKEN='xoxb-xxxxxxxxxxx-xxxxxxxxx-xxxxxxxxxxxxxxxxx' export SLACK_CHANNEL="#devops" export REPEAT_ALERTS=120 # 2 hours export DATAPOINT_COUNT=5 # 1 datapoint in 2 sec. MEMORY_ALARM+=( [WARNING]=10 [CRITICAL]=90 ) CPU_ALARM+=( [WARNING]=5 [CRITICAL]=90 ) DISK_ALARM+=( [WARNING]=15 [CRITICAL]=90 )
-
Configure crontab to run every 5 min internal.
# crontab -e # run cron to check every 5 min. */5 * * * * mtracker -m mwatcher -f /etc/watcher.sh
Note : If you like this tool Please support us and share this with your friends/others.
- Utility Name : mTracker
- Developed by : Harry
- Email : HarryTheDevOpsGuy@gmail.com
- Connect with us : Please join above WhatsApp group or Telegram channel