Practically its very difficult for us to check the log file every time whenever the error messages occured.
This script will search specific messages from the log file and send it to the user whenever it finds specified messages.
-------------------------------------------------------------------------------------
#!/usr/bin/sh
grep -i "" "log file location" > /tmp/disassociate_on_delete_stg_AGG_P
SUBJECT="Error messages from the Log File"
EMAIL_ADDRESS=""
BODY="Error messages Occured"
if [ -s "/tmp/disassociate_on_delete_stg_AGG_P" ]
then
uuencode /tmp/disassociate_on_delete_stg_AGG_P /tmp/disassociate_on_delete_stg_AGG_P.txt; > /tmp/disassociate_on_delete_stg_AGG_P.txt
echo "$BODY" mailx -s "$SUBJECT" "$EMAIL_ADDRESS" < /tmp/disassociate_on_delete_stg_AGG_P.txt
else
echo "we are fine"
fi
--------------------------------------------------------------------------------------
Showing posts with label Technical. Show all posts
Showing posts with label Technical. Show all posts
How to run the script for every second ?
crontab will help us to run/execute the script every minute ,however if we want run/execute the script for every second then below mentioned code is very useful.
-------------------------------------------------------------------
while(true);
do
/usr/bin/perl / appl/netcool/omnibus/utils/SAM_V5.1.pl > /tmp/SAM_V5.1log
sleep 30;
done
----------------------------------------------------------------------------
Note: successfully tested and its working.
-------------------------------------------------------------------
while(true);
do
/usr/bin/perl / appl/netcool/omnibus/utils/SAM_V5.1.pl > /tmp/SAM_V5.1log
sleep 30;
done
----------------------------------------------------------------------------
Note: successfully tested and its working.
remote systems Disk space alert script
Below mentioned code will help us to monitor remote servers disk space.
#!/bin/bash
SUBJECT="Disk Usuage Report"
EMAIL_ADDRESS=""
BODY="Please delete unwanted files ASAP."
SERVERS="list of servers"
for HOST in $SERVERS
do
ssh $HOST df -hk /appl/netcool > /tmp/out;
output=$(cat /tmp/out grep -i '/appl' awk '{ print $5 }' cut -d'%' -f1)
if [ $output -ge 90 ];
then
echo "Running out of space \"/appl/netcool\" on Server" $HOST "Usage:" $output%"$BODY" mailx -s "$SUBJECT" "$EMAIL_ADDRESS"
fi
done
#!/bin/bash
SUBJECT="Disk Usuage Report"
EMAIL_ADDRESS=""
BODY="Please delete unwanted files ASAP."
SERVERS="list of servers"
for HOST in $SERVERS
do
ssh $HOST df -hk /appl/netcool > /tmp/out;
output=$(cat /tmp/out grep -i '/appl' awk '{ print $5 }' cut -d'%' -f1)
if [ $output -ge 90 ];
then
echo "Running out of space \"/appl/netcool\" on Server" $HOST "Usage:" $output%"$BODY" mailx -s "$SUBJECT" "$EMAIL_ADDRESS"
fi
done
This tool can not only create .tar and .tar.gz files on windows , but can do much more.
Downlaod this from
http://www.7-zip.org/
Downlaod this from
http://www.7-zip.org/
MySQL Query Browser
MySQL Query Browser is the easiest visual tool for creating, executing, and optimizing SQL queries for your MySQL Database Server. The MySQL Query Browser gives you a complete set of drag-and-drop tools to visually build, analyze and manage your queries. Plus, the integrated environment provides:
Query Toolbar to easily create and execute queries and navigate query history
Script Editor giving you control to manually create or edit SQL statements
Results Window so you can also easily compare and work with multiple queries
Object Browser enabling you to manage your databases, bookmarks, and history using a Web Browser like interface
Database Explorer where you can select tables and fields to query, as well as create and delete tables
Table Editor allows you easily create, modify and delete tables
Inline Help giving you instant help access to selected objects, parameters, and functions
Downlaod from this link .....
http://dev.mysql.com/downloads/gui-tools/5.0.html
Query Toolbar to easily create and execute queries and navigate query history
Script Editor giving you control to manually create or edit SQL statements
Results Window so you can also easily compare and work with multiple queries
Object Browser enabling you to manage your databases, bookmarks, and history using a Web Browser like interface
Database Explorer where you can select tables and fields to query, as well as create and delete tables
Table Editor allows you easily create, modify and delete tables
Inline Help giving you instant help access to selected objects, parameters, and functions
Downlaod from this link .....
http://dev.mysql.com/downloads/gui-tools/5.0.html
Subscribe to:
Posts (Atom)