Sponsored Content
Full Discussion: Monitoring script issue
Top Forums Shell Programming and Scripting Monitoring script issue Post 302485795 by paventhan on Thursday 6th of January 2011 08:17:42 AM
Old 01-06-2011
Data Monitoring script issue

I written following script to monitor two log files. First piece of code working fine, but piece is failing with followin error.

$ sh Log_Monitoring.sh
Database failed to written
4
Database failed to written
expr: syntax error

=================

clear
sh=`date | awk '{print $4}' | cut -d ":" -f1`
sm=`date | awk '{print $4}' | cut -d ":" -f2`
lh=`ls -l /opt/Heartbeat.log | awk '{print $8}' | cut -d ":" -f1`
lm=`ls -l /opt/Heartbeat.log | awk '{print $8}' | cut -d ":" -f2`
if [ x = 0 ]
then
if [ -f "/export/home/paven/interval_core.dat" ]; then
echo "0" > /export/home/paven/interval_core.dat
fi
else
x=`cat /export/home/paven/interval_core.dat`
if [ "$sh" = "$lh" ]
then
if [ "$sm" = "$lm" ]
then
echo "Database writting properly"
echo "0" > /export/home/paven/interval_core.dat
else
echo "Database failed to written"
x=`expr $x + 1`
echo "$x" > /export/home/paven/interval_core.dat
echo $x
if [ "$x" = "2" ]
then
#mailx -s "Data base failed to write in Core Environment - Need to retrieve missing data" -c "xyz@abc.com"<<EOF
echo Data base failed to write in Core Environment - Need to retrieve missing data
fi
fi
fi
fi

sleep 10

sh1=`date | awk '{print $4}' | cut -d ":" -f1`
sm1=`date | awk '{print $4}' | cut -d ":" -f2`
lh1=`ls -l /opt/NH_Heartbeat.log | awk '{print $8}' | cut -d ":" -f1`
lm1=`ls -l /opt/NH_Heartbeat.log | awk '{print $8}' | cut -d ":" -f2`
if [ y = 0 ]
then
if [ -f "/export/home/paven/interval_NH.dat" ]; then
echo "0" > /export/home/paven/interval_NH.dat
fi
else
y=`cat /export/home/paven/interval_NH.dat`
if [ "$sh1" = "$lh1" ]
then
if [ "$sm1" = "$lm1" ]
then
echo "Database writting properly"
echo "0" > /export/home/paven/interval_NH.dat
else
echo "Database failed to written"
y=`expr $y + 1`
echo "$y" > /export/home/paven/interval_NH.dat
echo $y
if [ "$y" = "2" ]
then
#mailx -s "Data base failed to write in NHS Environment - Need to retrieve missing data" -c "xyz@abc.com"<<EOF
echo Data base failed to write - Need to retrieve missing data
fi
fi
fi
fi
================Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

monitoring script

hi can someone help me to write a script to monitor the growth of the directory running at 5 hours interval and then pipe it to a file :(? i only know the manual command "du -sk" and the worst i dun know anything about script. (3 Replies)
Discussion started by: legato
3 Replies

2. UNIX for Advanced & Expert Users

monitoring script

i have a unix batch written in c, dealing with really time-consuming database operations i want to write a ksh script to monitor its performance. which items i should monitor? do you have any suggestions? 1)cputime 2)swap area 3)pmem 4) 5) what else? (1 Reply)
Discussion started by: gfhgfnhhn
1 Replies

3. Shell Programming and Scripting

Help with Monitoring script

Hi Gurus, Currently I am learning UNIX through online forums and unix blogs. I have the below requirement. I need to write a script to monitor server processes. For example, there are 3 processes currently running on the server.(java, pmrepagent, pmserver). If any of the process goes down,... (2 Replies)
Discussion started by: svajhala
2 Replies

4. Shell Programming and Scripting

Snmp Process Monitoring Issue

Can someone please explain to me how come snmpwalk doesn't always find a running process that's on a remote server? I prefer to use snmp to monitor processes remotely because this doesn't require me to put a script on that remote box. but the problem is, there are times that my snmp command... (2 Replies)
Discussion started by: SkySmart
2 Replies

5. Red Hat

monitoring script

Hi, I ned to monitor the memory for the red-hat machine,when its reaches a threshold value like 2GB then a mail should be sent as soon as it finds the the value is met can you suggest me which is the best way to do this? (2 Replies)
Discussion started by: sriniv666
2 Replies

6. Solaris

Monitoring issue

can any one help me in this issue iscsiadm: ISCSI_AUTH_GET failed, errno: 5 Monitored File: /var/adm/messages (1 Reply)
Discussion started by: saripudi1985
1 Replies

7. UNIX for Advanced & Expert Users

ldapsearch in monitoring script without bind password written in script

Hi I do a very simple monitoring of our OpenLDAP (runs in cronjob and generate alerts if unsuccessfull) $ ldapsearch -h hostname.domain -D "cn=monitor_user,ou=People,dc=organisation" -w "password" -b "dc=organisation" -x "(&(cn=monitor_user)(ou=People))" dn | grep -v version dn:... (4 Replies)
Discussion started by: slashdotweenie
4 Replies

8. Shell Programming and Scripting

Help with a monitoring script

I currently have a shellscript to check the size of a filesystem and email me if the size is over a certain percentage (80%). I have this script on crontab and executes the shell every 10 mins. I have the above in place on 8 servers. It so happens that a file system on one of the servers is... (1 Reply)
Discussion started by: goddevil
1 Replies

9. Linux

Check_esx_host_vmfs plugin issue while monitoring ESXi DS

Hello, I setup a check_esx_host_vmfs plugin for monitoring datastore status on ESXi server. But on configuring this plugin, this is working fine but it displays "WARNING" status on UI of Nagios every time. Currently my datastore size is 926.50 GB and right now free space available is 570.60 GB... (2 Replies)
Discussion started by: sunnysthakur
2 Replies

10. Web Development

Website RTO. What monitoring can I setup and how to track issue?

Hello, I have installed a WordPress theme on Cantos and brought up a website on AWS. I have added that website on Cloudflare. While I was working on webpage development, I noticed that sometimes website is unreachable. In 8 hours, I noticed it 2-3 times and after few seconds, it would come back... (1 Reply)
Discussion started by: solaris_1977
1 Replies
PRDB_CHECK(8)						       AFS Command Reference						     PRDB_CHECK(8)

NAME
prdb_check - Checks the integrity of the Protection Database SYNOPSIS
prdb_check -database <ptdb file> [-uheader] [-pheader] [-entries] [-verbose] [-help] prdb_check -d <ptdb file> [-u] [-p] [-e] [-v] [-h] DESCRIPTION
The prdb_check command checks the integrity of the Protection Database, reporting any errors or corruption it finds. If there are problems, do not issue any pts commands until the database is repaired. CAUTIONS
The results can be unpredictable if the Protection Server makes changes to the Protection Database while this command is running. Use the bos shutdown command to shutdown the local ptserver process before running this command, or before creating a second copy of the prdb.DB0 file (with a different name) on which to run the command. OPTIONS
-database <ptdb file> Names the Protection Database (copy of the prdb.DB0 file) to check. If the current working directory is not the location of the file, provide a pathname, either full or relative to the current working directory. -uheader Displays information which Ubik maintains in the database's header. -pheader Displays information which the Protection Server maintains in the database's header. -entries Outputs every entry in the database. Some of the information is similar to that returned by the pts examine command. -verbose Reports additional information about the database, including the number of entries in the database and a trace of the internal database structures the command is verifying. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
If there are errors in the database, the output always reports them on the standard error stream. If any options other than -database or -help are provided, the output written to the standard output stream includes additional information as described for each option in OPTIONS. The output is intended for debugging purposes and is meaningful to someone familiar with the internal structure of the Protection Database. PRIVILEGE REQUIRED
The issuer must be logged in as the local superuser "root". SEE ALSO
prdb.DB0(5), bos_shutdown(8), pts_examine(1), ptserver(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 PRDB_CHECK(8)
All times are GMT -4. The time now is 02:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy