I created a Jenkins job where it run some JMeter scripts and return .jtl files. Now, I want to upload this files to Blazemeter Sense to see the performance test, downloads pdf reports, etc.
I've searched a lot of information, where I find that to upload some file, I can use this command thats running from Windows CMD:
curl -v https://sense.blazemeter.com/api/files -H "Authorization: Token 'cat ~/.loadosophia.token'" -F "projectKey=Project_name" -F "jtl_file=#jtl.gz"
REFERENCE: https://sense.blazemeter.com/wiki/help:uploads/
The only values that I change are
cat ~/.loadosophia.token, where I replaced for my Upload Token (finded in Blazemeter Sense -> Options -> Settings -> Your Upload Token)
projectKey where I replaced by my project name (test_taurus)
jtl_file where I replaced by the file directory generated by Jmeter test (.jtl)
The final command is:
curl -v https://sense.blazemeter.com/api/files -H "Authorization: Token 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYLaa'" -F "projectKey=test_taurus" -F "jtl_file=/path/of/file/file.jtl"
I missed some? What is my wrong? Existe another posibility to make it?
Thanks everyone
U P D A T E:
I did what Dmitri T said. Thats works. But when I run the command, the output is the following:
What could be the issue?
You need to remove quotation marks around the token
You need to add an "at" symbol before the .jtl file path
Fixed command would be something like:
curl -v https://sense.blazemeter.com/api/files -H "Authorization: Token XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYLaa" -F "projectKey=test_taurus" -F "jtl_file=#/path/of/file/file.jtl"
More information: Upload files with CURL
You might find BM.Sense Uploader plugin more convenient to use, the plugin can be installed using JMeter Plugins Manager:
Related
This question was closed for lack of clarity in a previous post and i was given the option to either edit or re-post the question. I decided to repost the question so others that may had seen it before could see it again but with better clarity. Thanks
i have a folder (e.g. FOLDERX) in a Sharepoint Online Document Library where i use microsoft graph API to GET files by their FILENAME
MS Graph API: https://graph.microsoft.com/v1.0/drives/{drive-id}/root:/filename.txt:/content
Note: these API can only GET files by their filename. The files were the same generic filename each day so i knew what filename to expect hence, i could easily just use the filename in the API call
i run a cron job that GET these file using cURL once a day
so for example, if the file being PUT in the folder each day is "FileA.csv", the API call my in script will look like this which then outputs the file into the remote ubuntu server where the script runs
#!/bin/bash
TOKEN=$(<curl command to retrieve the token needed for the api call>)
#api call that from sharepoint online that outputs to a csv file on remote server
curl -L -X GET "https://graph.microsoft.com/v1.0/drives/<driveID>/root:/FOLDERX/FileA.csv:/content" -H "Authorization: Bearer ${TOKEN}" > FileA.csv
Now, that generic filename isn't generic anymore. the filename is now either "FileA.csv" or "FileB.csv". it's either one each day and i can't keep manually editing the filename on my API call each day.
So i was trying to write an IF statement to first check what filename is available on the Sharepoint Online folder (FOLDERX) each day so when the script is run, the API curl knows which filename to GET using the API curl
Below is where i'm at after trying different IF statement scenarios for over a week now. The API calls are working perfectly. Pls, i just need help writing an IF statement that checks the remote Sharepoint Online folder to see what filename is present and then cURL it using the API call.
#!/bin/bash
TOKEN=$(<curl command to retrieve the token needed for the api call>)
if [ <not sure what to put in here> ];
then
curl -L -X GET "https://graph.microsoft.com/v1.0/drives/<driveID>/root:/FOLDERX/FileA.csv:/content" -H "Authorization: Bearer ${TOKEN}" > FileA.csv
else
curl -L -X GET "https://graph.microsoft.com/v1.0/drives/<driveID>/root:/FOLDERX/FileB.csv:/content" -H "Authorization: Bearer ${TOKEN}" > FileA.csv
fi
EDIT : I do not know how to write the IF statement, that's why i brought it on here.
Just try both, using --fail to make curl let the shell know when it got a 404, 503, or similar.
curl --fail -L -X GET "https://graph.microsoft.com/v1.0/drives/<driveID>/root:/FOLDERX/FileA.csv:/content" -H "Authorization: Bearer ${TOKEN}" >File.csv \
|| curl --fail -L -X GET "https://graph.microsoft.com/v1.0/drives/<driveID>/root:/FOLDERX/FileB.csv:/content" -H "Authorization: Bearer ${TOKEN}" >File.csv \
|| { echo "ERROR: Could not retrieve either FileA or FileB" >&2; exit 1; }
I am trying to test the Sumo Logic API by updating the information of my collector. The second curl command is the one that is causing the issue 'curl: (55) Failed sending PUT request'. It works in my terminal but not in the bash script.
#!/bin/bash
readonly etag=$(curl -u '<accessId>:<accessKey>' -I -X GET https://api.sumologic.com/api/v1/collectors/<id> | grep -Fi etag | awk '{print $2}' | tr -d \''"\')
echo ${etag}
curl -vvv -u '<accessId>:<accessKey>' -X PUT -H "Content-Type: application/json" -H "If-Match: \"${etag}\"" -T updated_collector.json https://api.sumologic.com/api/v1/collectors/<id>
set -x
The first curl command is assigned to the variable called 'etag' which stores the necessary etag. The etag is used in the second curl command to make a request to update the information stored in the 'updated_collector.json'. The updated_collector.json file is not the issue as I have successfully updated the information via the terminal with it. I suspect the content-type is not being sent in the header because someone ran the script on their end and it was not showing that information with the -vvv tag.
Here you can find the Sumo Logic Collector API Methods and Examples from which I got the curl commands to test the API: https://help.sumologic.com/APIs/Collector-Management-API/Collector-API-Methods-and-Examples
Update: I retieved the etag and then ran the second command in a bash script. I manually inserted the etag into the ${etag} portion of the second curl command. I then ran the script and it worked. Therefore, the etag variable isn't correctly formatted inside the second curl command. I do not know how to fix this.
The issue was partially the syntax but after fixing that, I was still getting an error. "If-Match: \"${etag}\" in my command should be "If-Match: ${etag}" instead. I had to add the --http1.1 flag for it to work. I'm sure this is a sumo logic issue. I am able to execute GET requests no problem using http2.0.
I am using Jmeter(5.1.1) in Non-GUI mode and unable to execute it. It still runs fine in GUI mode but fails in Non-GUI with "Error: Malformed option -". I removed the listeners from the JMX file but it still has some HTTP Request which are disabled will that be the problem here.?
I am currently using this command in my Windows 7 machine with Java 8.
Commands:
jmeter -n -t (location: C:\Users\File.jmx) -l (location: C:\Users\Results.csv)
Its not showing results neither updating the results.csv file, after each run its just showing "
Error: Malformed option -
" in command window. Can someone tell me what i am missing or what should i follow.?
Please use it like the below:-
jmeter -n -t D:\TestScripts\script.jmx -l D:\TestScripts\scriptresults.jtl
Hope this helps.
First you have to go to Jmeter/bin path where your Jmeter jar is located.
(For Example, C:\apache-jmeter-5.0\bin)
Now after going to that path using cmd, use below command given that your abc.jmx file is at the above mentioned location only and once execution starts it will automatically create def.jtl at that location, hope this have given you clarity:
jmeter -n -t abc.jmx -l def.jtl
Ok, so here what i was doing wrong. Dont know if this is stupid but might help others.
Since we use JMeter at work locations, my drive was linked with the cloud folder where none of the commands get execute i believe, so when i copy the installed JMeter folder and my JMX file to a Local location, say
before:
> C:\UsersABC\OneDrive-UserABC\JMETER\apache-jmeter-5.1.1\bin
Now:
> C:\JMET\apache-jmeter-5.1.1\bin
That OneDrive causing all the trouble. But thanks to all of you guys, you helped me figured this out. Thanks alot again :)
I got the same issue while trying with "jmeter -n -t D:\load test 01\test.jmx -l D:\TestScripts\scriptresults.jtl" command.
Then I changed it to "jmeter -n -t D:\load_test_01\test.jmx -l D:\TestScripts\scriptresults.jtl" and it worked fine, in my case the issue was whitespaces in the folder name.
I've searched all over the web but couldn't find anything useful for this. Using CURL, I want to append content to a file which is already existing and named as test.pls. Can anyone please tell me how can I do it using curl. The commands I've tried are
curl http://192.99.8.170:8098/stream --output test.pls
curl -K --output test.pls http://192.99.8.170:8098/stream
curl -a --output test.pls http://192.99.8.170:8098/stream
But all of above starts creating files from scratch.They don't keep the initial content of file Can anyone please help me!
Use the shell's appending output redirection (>>) rather than curl's --output option.
curl http://192.99.8.170:8098/stream >> test.pls
A much easier and cleaner way is as follows:
curl -sS https://address.to.file.txt >> file-name.txt
Alright, here's what I'm trying to do. I'm attempting to write a quick build script in bash that will check out a private repository from GitHub on a remote server. To do this a "hands off" as possible, I want to generate a local RSA key set on the remote server and add the public key as a Deploy Key for that particular repository. I know how to do this using GitHub's API, but I'm having trouble building the JSON payload using Bash.
So far, I have this particular process included below:
#!/bin/bash
ssh-keygen -t rsa -N '' -f ~/.ssh/keyname -q
public_key=`cat ~/.ssh/keyname.pub`
curl -u 'username:password' -d '{"title":"Test Deploy Key", "key":"'$public_key'"}' -i https://api.github.com/repos/username/repository/keys
It's just not properly building the payload. I'm not an expert when it comes to string manipulation in Bash, so I could seriously use some assistance. Thanks!
It's not certain, but it may help to quote where you use public_key, i.e.
curl -u 'username:password' \
-d '{"title":"Test Deploy Key", "key":"'"$public_key"'"}' \
-i https://api.github.com/repos/username/repository/keys
Otherwise it will be much easier to debug if you use the shell's debugging options set -vx near the top of your bash script.
You'll see each line of code (or block (for, while, etc) as it is in your file. Then you see each line of code with the variables expanded to their values.
If you're still stuck, edit your post to show the expanded values of variables for the problem line in your script. What you have looks reasonable at first glance.