Tuesday, August 18, 2009

run a command in solaris from winodw and output will save in window through batch file

Hi All,

some time we need to run some command in solaris or Unix machine and need to collect output in window.
This all can be automated and directly we can invoke a shell scrpit in solaris from windows. You need putty to do this. Your shell script should be in windows machine.

CODE:

Create a batch file (suppose putty is saved in d: drive of windows and your shell script that you want to run is saved in d: drive).shell script name is "shellscript.sh"


D:\putty -ssh username@servername -pw mypassword -m "D:\shellscript.sh"
ftp -i -s:"D:\ftp.txt"



now create a ftp.txt file in D: drive as follows

OPEN servername
username
password
get filename
BYE




Thanks
Shashank

Thursday, July 9, 2009

Write a parameter to a text file in loadrunner script

char *filename = "c:\\myfilename.txt";
long file_stream;
vuser_init()
{

if ((file_stream = fopen(filename, "a+")) == NULL) //open file in append mode
{
lr_error_message ("Cannot open %s", filename);
return -1;
}


fprintf (file_stream, "%s\n", lr_eval_string("THE PARAMETER IS :{Parameter}")); //Parameter is parameter name to be written in a file

Return 0;

}

vuser_end()
{
fclose(file_stream);//dont forget to close file_stream in vuser_end scetion
return 0;
}

Thursday, July 2, 2009

monitor cpu and memory utilization of an individual process in windows

Sometime it is required to measure cpu utilization of a process instead to cpu utilization of whole machine in windows.
This is very much possible with PerfMon tool in windows
Steps to follow
1: Launch perfmon
2:Click Performance Logs and Alerts tree on left most window
3:Select Counter Logs from tree structure
4: Right click Counter Logs and select "New Log setting"
5: Give any name for new logs.
6: Click on Add objects tab.
7:Select Process from the list then click on Add then close.
8:Click "Log Files" tab at the top.
9:Select Log File Type as csv or tsv,as per your requirement
10: You are all set to go by default log file will be saved in c:\perfLogs folder

Tuesday, June 9, 2009

Code for puttting custome Pacing in script

Action()
{
merc_timer_handle_t timer;
double duration;
double pacing_time;

// Read desired pacing timer from a text file.
pacing_time = (double)jds_read_pacing_time("C:\\TEMP\\vugen_pacing.txt");

// Start the timer.
timer = lr_start_timer();

//Your Action Code

// Stop the timer
duration = lr_end_timer(timer);

// Wait for the necessary number of seconds to elapse
if (duration < pacing_time) {
lr_think_time(pacing_time - duration);
} else {
lr_error_message("Pacing time exceeded. Target: %G seconds. Actual: %g seconds", pacing_time, duration);
}

return 0;
}








// Read pacing time from a file. Returns time in seconds (whole seconds only).
// Note that file can be on a shared network drive.
int jds_read_pacing_time(char* file_name) {
long fs; // file stream
int number_from_file;

// Open the file for reading
fs = fopen(file_name, "r+");
if (fs == NULL) {
lr_error_message("Error opening file: %s", file_name);
return -1;
}

// Read number from file.
if (fscanf(fs, "%d", &number_from_file) != 1) {
lr_error_message("Error reading number from file: %s", file_name);
return -1;
}

fclose(fs);

return number_from_file;
}

URL vs HTML recording mode

HTML based mode, records script for every user action that is
performed during recording, while URL based mode records each and
every browser request to the server and resources received from the
server.

IN HTML recording mode the execution will be fast..as all
the server responses will not be captured in the script.
In URL all the server responses will be captured in the
script and hence the execution will be slow

how to monitor tomcat 6.0.16 with jconsole

go to tomcat bin folder
click on tomcat6w.exe
go to java tab
go to java options
type :
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8090
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
you are all set to go
now you can monitor your tomcat through jconsole and give port as 8090

back or referesh error with siebel protocol in loadrunner

hi this is a very common problem everyone facing while working on
siebel protocol of loadrunner.
this problem is coming from 2nd iteration .

solution is very simple

run the script and see in which web_url or web_submit, this problem is
coming soo just change mode to http from html and resources from 0
to 1.

I hope this will surely help you