Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

performance benchmark testing

Posted on 2010-09-22
8
Medium Priority
?
988 Views
Last Modified: 2013-12-26
Hello Guys,

I didn't know where to ask this question, but I hope someone can help me.

I need to write a script to automate a number of procedures in Sybase IQ. I have been thinking alot about this and am really stuck.

This is what I need to automate:

1.sp_iqstatus (ideally this should be run every 15 mins)
2. IQ Monitor information (summary, cache & debug)

Does someone have a script to collect this sort of information?

Many Thanks!
0
Comment
Question by:SybaseUk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 

Author Comment

by:SybaseUk
ID: 33734938
Any update on this please?

I also need to collect sp_iqtransaction, sp_iqconnection and sp_iqlocks in my script...can somebody please help with this?

Do I need to post in a different zone?
0
 
LVL 24

Expert Comment

by:Joe Woodhouse
ID: 33735099
No, you're in the right zone, there just aren't many of us posting answers to IQ questions. :)

I don't have any canned scripts I can pass on to you, but this is pretty simple, about as simple as scripting gets. All you need here is a simple wrapper that does an isql from the command line (or dbisql if you prefer - there are some tricks to making isql work with IQ but I find it's more flexible) that issues the relevant command(s) and sends them to an appropriately named output file.

You don't need anything fancy at the script level for this, as far as the bash script is concerned it is doing just one thing - calling isql which is redirecting its output to a script-controlled filename (typically with a timestamp in the name).

I suggest you have one script per command you want to run, each directing to its own output directory.

Running the jobs then is just a matter of putting the appropriate calls into crontab. Examining your output is probably also best done at the shell level - identify the KPIs you want and whip up something in Perl or grep/sed/awk to parse out the bits you want.

I don't have scripts for you to reuse for any of this because the scripting is so basic I just whip up a new set whenever I need them. :)

Let us know if you have any specific questions? I can walk you through most of this but I don't want to bury you in detail at this stage.
0
 

Author Comment

by:SybaseUk
ID: 33735949
Hi Joe...

Many thanks for your response....

Can you please whip up a skeleton script for me to collect sp_iqstatus (for an example).....

I have something like this:

vi perf_mon.sh
iqisql -UDBA -Psql -SIQDB << EOF
sp_iqstatus
go

Am I on the right track?
Do I need anything at the end of the file? How do I direct this output to a file?

Also, I need to run some monitoring, e.g.

IQ UTILITIES MAIN INTO dummy_table START MONITOR '-debug -file_suffix debug.txt -interval 5

How can I add the above into a script and have the output re-directed to a file?

Thanks Joe!
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 13

Expert Comment

by:alpmoon
ID: 33741229
You are on the right track. These additios are to re-direct the output to a file. You should add a path as well:

FILENAME='iqstatus.out'

iqisql -UDBA -Psql -SIQDB << EOF > $FILENAME
sp_iqstatus
go
EOF

Remaining is more shell scripting. I guess you can search on the web to find a sample script to add timestamp into filename by using date function and other improvements.

0
 
LVL 24

Expert Comment

by:Joe Woodhouse
ID: 33741705
Something like this is what I usually use:


#!/bin/bash

USER="<user>"
PASS="<password>"
SERVER="<server>"
DIR="<path_to_store_files_in>"

FILE="${DIR}/iqstatus.${SERVER}.$( date +%Y%m%d%H%M )"

iqisql -U${USER} -S${SERVER} << EOF > ${FILE}
${PASS}
sp_iqstatus
go
EOF


You can substitute different commands and filenames for the other commands.
0
 

Author Comment

by:SybaseUk
ID: 33741879
Joe, that's exactly what I was looking for, thank you sir! Just out of curiosity, how would I hide the password in my script?

Also, how can I extract monitoring information to an output file using a script like the one above? By monitoring, I mean the 'IQ UTILITIES....' command....From my understanding, the monitoring stops once the session is terminated. So I need to make sure I keep the session open for a while...

I have something like this: -

#!/bin/bash

USER="<user>"
PASS="<password>"
SERVER="<server>"
DIR="<path_to_store_files_in>"

FILE="${DIR}/iqstatus.${SERVER}.$( date +%Y%m%d%H%M )"

iqisql -U${USER} -S${SERVER} << EOF > ${FILE}
${PASS}

set option public.MONITOR_OUTPUT_DIRECTORY = '/tmp'
go
IQ UTILITIES MAIN INTO iq_dummy START MONITOR '-debug -file_suffix debug.txt -append -interval 5'
go
IQ UTILITIES PRIVATE INTO iq_dummy START MONITOR '-debug -file_suffix debug.txt -append -interval 5'
go
WAITFOR DELAY '23:00:00'
go
EOF

I will then run this in the background, so the session isn't terminated so I keep collecting the monitor information as long as needed?

Will the above work?

Many Thanks!!



0
 
LVL 24

Accepted Solution

by:
Joe Woodhouse earned 2000 total points
ID: 33743803
If you want to hide the password in the script, you can put it in a hidden file which can only be read by the Sybase login.

So say you create a file called /home/sybase/scripts/.password and put the password in it as the only text, then edit your script like this:

PASS=$( cat  /home/sybase/scripts/.password )

With the IQ MONITOR that should work, that would put everything into one file. If that's not what you want, you could monitor for a shorter time and have each script (say) monitor for 10 mins twice an hour or something.
0
 

Author Comment

by:SybaseUk
ID: 33744296
Thanks Joe!
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question