jmeter+influxdb Backend Listener: howto specify password? - jmeter

I use Jmeter Backend Listener url:
influxdbUrl = http://XX.XXX.XX.XXX:8086/write?db=JMeter&u=jusr&p=C-UBBC-"<
I get an error:
java.lang.IllegalStateException: Failed calling setupTest Caused by: java.net.URISyntaxException: Illegal character in query at index 76: http://XX.XXX.XX.XXX:8086/write?db=JMeter&u=jusr&p=C-UBBC-"<
Problem in special characters in password: C-UBBC-"<
How to fix it?

Not every character is allowed in an URL, you can use alphanumeric and few special ones, in particular ; , / ? : # & = + $ - _ . ! ~ * ' ( ) #. Everything else needs to be percent-encoded
Wrap your password into __urlencode() function and it should resolve your issue.
More information on JMeter Functions concept: Apache JMeter Functions - An Introduction

Related

Getting error in accessing Jmeter variables (variable_MarchNr) in yaml in beanshell script

I am trying to bulk edit one entity called issues, I call GetIssues API and via json extractor, get all issueId's in variable "issueIds"
json extractor to extract issueIds
Now I want to pass these Ids in other api bulk edit issues, If I directly use these array in next API, I get below error:
{"details":"Unexpected token $ in JSON at position 19","metadata":{}}
So I used to below code in Beanshell Post processor:
var mylist;
props.put("mylist", new ArrayList());
log.info("Detected " + vars.get("issueIds_matchNr") + " issueIds");
for (int i=1; i<= Integer.parseInt(vars.get("issueIds_matchNr")); i++) {
log.info("IDs # " + i + ": " + vars.get("issueIds_" + i));
props.get("mylist").add('"' + vars.get("issueIds_" + i) + '"' );
}
log.info(props.get("mylist").toString());
var issueIdList;
vars.put("issueIdList", props.get("mylist").toString());
log.info(vars.get("issueIdList"));
In my next api call if I pass issueIdList variable, then this works fine in jmeter.
sample variable values in debug sampler are like:
issueIdList=["555bcfc2", "33974d2c", "e58db1d6"]
issueIds_1=555bcfc2
issueIds_2=33974d2c
issueIds_3=e58db1d6
issueIds_matchNr=3
Problem I am facing if I convert my jmx2yaml and tried to run this file with
bzt issues.yml
then while executing above shell script, these issueIds_matchNr, issueIds_3 are not detected, I get below error;
2022-05-29 08:26:10,785 INFO o.a.j.e.J.JSR223PostProcessor: Detected null issueIds
2022-05-29 08:26:10,795 ERROR o.a.j.e.JSR223PostProcessor: Problem in JSR223 script, JSR223PostProcessor
javax.script.ScriptException: Sourced file: eval stream : Method Invocation Integer.parseInt : at Line: 4 : in file: eval stream : Integer .parseInt ( vars .get ( "issueIds_matchNr" ) )
Target exception: java.lang.NumberFormatException: null
in eval stream at line number 4
at bsh.engine.BshScriptEngine.evalSource(BshScriptEngine.java:87) ~[bsh-2.0b6.jar:2.0b6 2016-02-05 05:16:19]
My Yaml script is:
- extract-jsonpath:
issueIds:
default: NotFound
jsonpath: $..id
follow-redirects: true
jsr223:
- compile-cache: true
execute: after
language: beanshell
parameters: issueIds
script-file: script.bsh
label: Get Issue Id's
method: GET
url: https://${BASE_URL1}/${PROJECT_ID}/issues?limit=5&sortBy=-displayId&filter%5Bvalid%5D=true
You're missing one important bit: setting the Match Nr in your Taurus YAML
The correct definition of the JSON Extractor would be something like:
extract-jsonpath:
issueIds:
jsonpath: $..id
match-no: -1 #this is what you need to add
Also be informed that starting from JMeter 3.1 it's recommended to use Groovy as the scripting language so consider migrating, it will be as simple as removing the first line from your script.bsh

Search special characters in kibana

I have ELK 6.8.1 version for log analysis. Now I need to search some strings via the Kibana search bar.
I need to find the logs include "] ERROR (". I tried:
message: "\] \ERROR \("
But nothing worked. Can anyone have experience help me with it? Thanks!
= && || > < ! ( ) { } [ ] ^ " ~ * ? : \ / + - are all reserved characters.
These need to be escaped.
Try escaping them twice.
message: "\\] ERROR \\("

How do I escape a password ending with a dollar sign icinga2?

I have dozens of devices I need to login to using an API script. One set of devices has a password ending in $. I've tried a bunch of things but I can't seem to escape that $ char. Here is the error I'm seeing.
critical/config: Error: Validation failed for object 'gelt-uk4-gp!HTTP/80: Status Check ' of type 'Service'; Attribute 'vars' -> 'gspass': Closing $ not found in macro format string 'n0t-real#$'.
Location: in /etc/icinga2/zones.d/global-templates/global-services.conf: 55:5-55:31
/etc/icinga2/zones.d/global-templates/global-services.conf(53): if ( host.vars.company == "gelt-emea" ) {
/etc/icinga2/zones.d/global-templates/global-services.conf(54): vars.gsuser = "admin"
/etc/icinga2/zones.d/global-templates/global-services.conf(55): vars.gspass = "n0t-real#$"
^^^^^^^^^^^^^^^^^^^^^^^^^^^
You add an extra $ right beside the literal dollar sign.
So if the password is word54s$ you type:
vars.geltpass = "word54s$$"

How to extract data from a get request with Ruby Grape

I'm experimenting with grape and Ruby by trying to make a Yo API callback function.
I can get simple examples up and running like this . . .
resource :loc do
get ':loc' do
params.to_yaml
end
end
How would I go about extracting username and x and y coordinates into separate ruby variable given a callback with the following format?
http://yourcallbackurl.com/yourendpoint?username=THEYOER&location=42.360091;-71.094159
When the location data is screwed up . . .
--- !ruby/hash:Hashie::Mash
username: sfsdfsdf
location: '42.360091'
"-71.094159":
route_info: !ruby/object:Grape::Route
options:
:prefix:
:version: v1
:namespace: "/loc"
:method: GET
:path: "/:version/loc/:loc(.:format)"
:params:
loc: ''
:compiled: !ruby/regexp /\A\/(?<version>v1)\/loc\/(?<loc>[^\/.?]+)(?:\.(?<format>[^\/.?]+))?\Z/
version: v1
loc: toto
format: txt
This is how Rack::Utils works. Default params separators are "&" and ";" (its totally legal according to HTTP standard). So you have to parse query string by yourself here.
location = Rack::Utils.parse_nested_query(env['QUERY_STRING'], '&')['location']
coordinates = location.split(';')
UPD: typo with hash key fixed.

Ruby Net::FTP throws error when directory contains one or more spaces

I am attempting to crawl through my FTP site with ftp.list(parent_path)
Whenever the parent_path variable contains a space, I get the following error
Ftp LIST exception: Net::FTPPermError detail: 550 /Download/Dimension: The system cannot find the file specified.
Ftp LIST exception: the parent_path (if present) was : /Download/Dimension Data
Here is my code snippet
begin
#logger.error("on #{ip} : " + ftp.system())
entry_list = parent_path ? ftp.list("#{parent_path}") : ftp.list
rescue => detail
retries_count += 1
#logger.error("on #{ip} : Ftp LIST exception: " + detail.class.to_s + " detail: " + detail.to_s)
#logger.error("on #{ip} : Ftp LIST exception: the parent_path (if present) was : " + parent_path)
I have tried escaping the spaces with a \ and I tried using %20, not sure what else to try...
Any ideas, thoughts, suggestions, etc, on how to get ftp.list to honor or escape the spaces is greatly appreciated!
Are you using Windows? This problem comes up when the ftp site's OS is Windows. I turned all of my spaces to underscore. I wish there was a better solution.

Resources