jmxtrans and kafka not working - jmx

I am trying to get the Kafka metrics (version 0.8.2) to my grafana server. Unfortunately I can only get java.lang metrics, but no kafka metrics. Connecting with jmxtrans and jconsoel is now problem and I can see the MBeans of Kafka.
Configuration of jmxtrans:
{
"servers" : [ {
"port" : "9393",
"host" : "localhost",
"queries" : [ {
"obj" : "kafka.network:type=RequestMetrics,name=LocalTimeMs,request=ConsumerMetadata",
"attr" : [ "Count" ],
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.GraphiteWriter",
"settings" : {
"port" : 2003,
"host" : "localhost"
}
} ]
}, {
"obj" : "kafka.network:type=RequestMetrics,name=RequestQueueTimeMs,request=FetchConsumer",
"attr" : [ "Count" ],
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.GraphiteWriter",
"settings" : {
"port" : 2003,
"host" : "localhost"
}
} ]
}, {
"obj" : "kafka.network:type=RequestMetrics,name=TotalTimeMs,request=OffsetFetch",
"attr" : [ "Count" ],
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.GraphiteWriter",
"settings" : {
"port" : 2003,
"host" : "localhost"
}
} ]
}, {
"obj" : "kafka.network:type=RequestMetrics,name=TotalTimeMs,request=Offsets",
"attr" : [ "Count" ],
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.GraphiteWriter",
"settings" : {
"port" : 2003,
"host" : "localhost"
}
} ]
}
],
"numQueryThreads" : 2
} ]
}
Log of jmxtrans:
15:52:11.564 [ServerScheduler_Worker-10] DEBUG org.quartz.core.JobRunShell - Calling execute on job ServerJob.localhost:9393-1443714611563-0428747962
15:52:11.564 [ServerScheduler_Worker-10] DEBUG c.googlecode.jmxtrans.jobs.ServerJob - +++++ Started server job: Server [host=localhost, port=9393, url=null, cronExpression=null, numQueryThreads=2]
15:52:11.569 [ServerScheduler_Worker-10] DEBUG com.googlecode.jmxtrans.jmx.JmxUtils - ----- Creating 4 query threads
15:52:11.638 [pool-60-thread-2] DEBUG c.g.jmxtrans.jmx.JmxQueryProcessor - Executing queryName [kafka.network:name=RequestQueueTimeMs,request=FetchConsumer,type=RequestMetrics] from query [Query [obj=kafka.network:type=RequestMetrics,name=RequestQueueTimeMs,request=FetchConsumer, useObjDomainAsKey:false, resultAlias=null, attr=[Count]]]
15:52:11.638 [pool-60-thread-2] DEBUG c.g.jmxtrans.jmx.JmxQueryProcessor - Finished running outputWriters for query: Query [obj=kafka.network:type=RequestMetrics,name=RequestQueueTimeMs,request=FetchConsumer, useObjDomainAsKey:false, resultAlias=null, attr=[Count]]
15:52:11.640 [pool-60-thread-2] DEBUG c.g.jmxtrans.jmx.JmxQueryProcessor - Executing queryName [kafka.network:name=TotalTimeMs,request=OffsetFetch,type=RequestMetrics] from query [Query [obj=kafka.network:type=RequestMetrics,name=TotalTimeMs,request=OffsetFetch, useObjDomainAsKey:false, resultAlias=null, attr=[Count]]]
15:52:11.640 [pool-60-thread-2] DEBUG c.g.jmxtrans.jmx.JmxQueryProcessor - Finished running outputWriters for query: Query [obj=kafka.network:type=RequestMetrics,name=TotalTimeMs,request=OffsetFetch, useObjDomainAsKey:false, resultAlias=null, attr=[Count]]
15:52:11.641 [pool-60-thread-2] DEBUG c.g.jmxtrans.jmx.JmxQueryProcessor - Executing queryName [kafka.network:name=TotalTimeMs,request=Offsets,type=RequestMetrics] from query [Query [obj=kafka.network:type=RequestMetrics,name=TotalTimeMs,request=Offsets, useObjDomainAsKey:false, resultAlias=null, attr=[Count]]]
15:52:11.641 [pool-60-thread-2] DEBUG c.g.jmxtrans.jmx.JmxQueryProcessor - Finished running outputWriters for query: Query [obj=kafka.network:type=RequestMetrics,name=TotalTimeMs,request=Offsets, useObjDomainAsKey:false, resultAlias=null, attr=[Count]]
15:52:11.642 [pool-60-thread-1] DEBUG c.g.jmxtrans.jmx.JmxQueryProcessor - Executing queryName [kafka.network:name=LocalTimeMs,request=ConsumerMetadata,type=RequestMetrics] from query [Query [obj=kafka.network:type=RequestMetrics,name=LocalTimeMs,request=ConsumerMetadata, useObjDomainAsKey:false, resultAlias=null, attr=[Count]]]
15:52:11.642 [pool-60-thread-1] DEBUG c.g.jmxtrans.jmx.JmxQueryProcessor - Finished running outputWriters for query: Query [obj=kafka.network:type=RequestMetrics,name=LocalTimeMs,request=ConsumerMetadata, useObjDomainAsKey:false, resultAlias=null, attr=[Count]]
15:52:11.643 [ServerScheduler_Worker-10] DEBUG c.googlecode.jmxtrans.jobs.ServerJob - +++++ Finished server job: Server [host=localhost, port=9393, url=null, cronExpression=null, numQueryThreads=2]
For me it looks like that jmxtrans can connect without problem and tries to get the data, but does not get any data at all from the kafka metrics.
JMX Options of Kafka:
-Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9393 -Djava.rmi.server.hostname=example.com -Dcom.sun.management.jmxremote.rmi.port=9011
Any idea why the Kafka metrics are not available?
Thanks.

Some versions of Kafka had quoted JMX elements (you could see the attributes having quotes in the jconsole). This has/is changing for future versions of Kafka. Check out the this post (How to monitor Kafka broker using jmxtrans?) for details, but if you use quoted strings it should work (see example below:)
"obj": "\"kafka.server\":type=\"BrokerTopicMetrics\",name \"AllTopicsLogBytesAppendedPerSec\"", "attr": [ "Count" ]
Note that the "obj" value requires additional quotes. When I tried this, JMXTRANS provided valid output after putting the correct (quoted) values in the obj string...

Related

Not able to run test cases in nightwatch framework on ec2 amazon linux instance through jenkins

While running the testcases through jenkins on ec2 instance,I am getting error message.
Here's my nightwatch configuration:
{
"src_folders" : ["test"],
"globals_path": "globals.js",
"output_folder" : "reports",
"custom_commands_path" : "./commands",
"custom_assertions_path" : "./assertions",
"page_objects_path":"./pages",
"test_workers" : {
"enabled" : false,
"workers" : "auto"
},
"selenium" : {
"start_process" : true,
"server_path" : "./bin/selenium-server-standalone-4.0.0.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./bin/chromedriver_linux"
}
},
"test_settings" : {
"default" : {
"request_timeout_options": {
"timeout": 100000
},
"videos": {
"enabled": false,
"delete_on_pass": false,
"path": "reports/videos",
"format": "mp4",
"resolution": "1280x720",
"fps": 15,
"display": ":",
"pixel_format": "yuv420p",
"inputFormat": "mjpeg"
},
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"screenshots" : {
"enabled" : false,
"on_failure" : true,
"on_error" : true,
"path" : "./screenshots"
},
"end_session_on_fail" : true,
"skip_testcases_on_fail" : false,
"use_xpath" : true,
"globals" : {
"url" : "http://ec30-3-100-2-16.us-north-10.compute.amazonws.com:1000/login"
},
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"w3c": false,
"args" : ["headless","no-sandbox"]
},
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
getting below error message in the console :
Login Test Test Suite
==========================
- Connecting to localhost on port 4444...
Connected to localhost on port 4444 (31794ms).
Using: chrome (81.0.4044.129) on Linux platform.
Running: Verify user is able to login
POST /wd/hub/session/2a3ca3b508f6dda4d0933225c41824a4/url - ECONNRESET
Error: socket hang up
at connResetException (internal/errors.js:604:14)
at Socket.socketCloseListener (_http_client.js:400:25)
Error while running .navigateTo() protocol action: An unknown error has occurred.
POST /wd/hub/session/2a3ca3b508f6dda4d0933225c41824a4/elements - ECONNRESET
Error: socket hang up
at connResetException (internal/errors.js:604:14)
at Socket.socketCloseListener (_http_client.js:400:25)
Error while running .locateMultipleElements() protocol action: An unknown error has occurred.
I have installed the chrome browser(81.0.4044.129) in ec2 instance and their respective chrome linux driver
selenium server : selenium-server-standalone-4.0.0.jar
Note:
I configured the Jenkins in my local machine(MAC OS) and its working fine.
Please let me know if you need more information.
I believe you security group attached to the EC2 server doesn't have ICMP IPV4 inbound rules accessible to your server running this nightwatch script. Try adding your nightwatch server IP address in the ICMP IPV4 inbound rules of the ec2 server you provided in the URL or you can even make it publicly accessible. I hope this resolves your issue.

How do I set microsoft Edge browser binary file for Selenium Remote Webdriver

I am trying to execute remote webdriver tests using Selenium Grid, My node is a Windows 8 system, and I have insider version of edge installed on it. Now when I try to execute my tests, the node starts the driver service but it is not able to find the microsoft edge binary on the node.
Machine : Windows 8
Edge Version : 77.0.235.9
binary Path : C:\Program Files (x86)\Microsoft\Edge Beta\Application\msedge.exe
Selenium Version : 3.141.59
I tried to append the path to the edge executable "msedge.exe" on the node's Path variable -> did not work
I tried to mention the edge_binary bath in the nodeconfig.json as well, but still the executable was not found.
else if (browsername.equalsIgnoreCase("edge")) {
EdgeOptions options = new EdgeOptions();
driver = new RemoteWebDriver(new URL("http://192.168.1.107:8889/wd/hub"), options);
return driver;
}
nodeconfig.json :
{
"capabilities":
[
{
"browserName" : "chrome",
"maxInstances" : 5,
"seleniumProtocol" : "WebDriver"
},
{
"browserName" : "firefox",
"maxInstances" : 5,
"firefox_binary" : "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
"seleniumProtocol" : "WebDriver",
"acceptInsecureCerts": true,
"acceptSslCerts": true
},
{
"browserName" : "internet explorer",
"version" : "11",
"maxInstances" : 5,
"seleniumProtocol" : "WebDriver"
} ,
{
"browserName" : "MicrosoftEdge",
"platform" : "WINDOWS",
"edge_binary" : "C:\\Program Files (x86)\\Microsoft\\Edge Beta\\Application\\msedge.exe",
"version" : "77.0.235.9",
"maxInstances" : 5,
"seleniumProtocol" : "WebDriver"
}
],
"proxy" : "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession" : 10,
"port" : 5555,
"register" : true,
"registerCycle" : 5000,
"hub" : "http://192.168.1.107:8889",
"nodeStatusCheckTimeout" : 5000,
"nodePolling" : 5000,
"role" : "node",
"unregisterIfStillDownAfter" : 1000,
"downPollingLimit" : 2,
"debug" : false,
"servlets" : [],
"withoutServlets" : [],
"custom": {
"webdriver.ie.driver" : "drivers/ie/win/IEDriverServer.exe",
"webdriver.gecko.driver" : "drivers/firefox/win/geckodriver.exe",
"webdriver.chrome.driver" : "drivers/chrome/win/chromedriver.exe",
"webdriver.edge.driver" : "drivers/edge/win/msedgedriver.exe"
}
}
How can I make the executable visible to the client trying to automate it,
EdgeOptions does not allow to set a binary path as well.

Parse-Dashboard: Server Not Reachable: unable to connect server Error

I have parse-server and parse-dashboard installed with pm2 in docker container in my synology nas as below:
+------+ +-------------+
| +NIC1 (192.168.1.100) <--> Router <--> (192.168.1.2) NIC1 + |
| PC | | DSM |
| +NIC2 (10.10.0.100) <--Peer-2-Peer---> (10.10.0.2) NIC2 + |
+------+ | [DOCKER] |
|(172.17.0.2) |
+-------------+
for reference: for pm2 setup, i'm following: this tutorial
here is my parse-server and parse-dashboard pm2 ecosystem (defined in pm2's ecosystem.json):
{
"apps" : [{
"name" : "parse-wrapper",
"script" : "/usr/bin/parse-server",
"watch" : true,
"merge_logs" : true,
"cwd" : "/home/parse",
"args" : "--serverURL http://localhost:1337/parse",
"env": {
"PARSE_SERVER_CLOUD_CODE_MAIN": "/home/parse/cloud/main.js",
"PARSE_SERVER_DATABASE_URI": "mongodb://localhost/test",
"PARSE_SERVER_APPLICATION_ID": "aeb932b93a9125c19df2fcaf3fd69fcb",
"PARSE_SERVER_MASTER_KEY": "358898112f354f8db593ea004ee88fed",
}
},{
"name" : "parse-dashboard-wrapper",
"script" : "/usr/bin/parse-dashboard",
"watch" : true,
"merge_logs" : true,
"cwd" : "/home/parse/parse-dashboard",
"args" : "--config /home/parse/parse-dashboard/config.json --allowInsecureHTTP=1"
}]
}
here is my parse-dashboard config: /home/parse/parse-dashboard/config.json
{
"apps": [{
"serverURL": "http://172.17.0.2:1337/parse",
"appId": "aeb932b93a9125c19df2fcaf3fd69fcb",
"masterKey": "358898112f354f8db593ea004ee88fed",
"appName": "Parse Server",
"iconName": "",
"primaryBackgroundColor": "",
"secondaryBackgroundColor": ""
}],
"users": [{
"user": "user",
"pass": "1234"
}],
"iconsFolder": "icons"
}
once you run: pm2 start ecosystem.json
here is parse-server log: pm2 logs 0
masterKey: ***REDACTED***
serverURL: http://localhost:1337/parse
masterKeyIps: []
logsFolder: ./logs
databaseURI: mongodb://localhost/test
userSensitiveFields: ["email"]
enableAnonymousUsers: true
allowClientClassCreation: true
maxUploadSize: 20mb
customPages: {}
sessionLength: 31536000
expireInactiveSessions: true
revokeSessionOnPasswordReset: true
schemaCacheTTL: 5000
cacheTTL: 5000
cacheMaxSize: 10000
objectIdSize: 10
port: 1337
host: 0.0.0.0
mountPath: /parse
scheduledPush: false
collectionPrefix:
verifyUserEmails: false
preventLoginWithUnverifiedEmail: false
enableSingleSchemaCache: false
jsonLogs: false
verbose: false
level: undefined
[1269] parse-server running on http://localhost:1337/parse
here is parse-dashboard log: pm2 logs 1
The dashboard is now available at http://0.0.0.0:4040/
once it's run, i can access 192.168.1.2:1337/parse (which will return {"error":"unauthorized"})
and i can access 192.168.1.2:4040
but it return:
Server not reachable: unable to connect to server
i see a lot of this issue can be solve by changing parse-dashboard config "serverURL": "http://localhost:1337/parse" to "serverURL": "http://172.17.0.2:1337/parse"
but to me, it's still no luck...
any idea what i've been missing here?
so apparently, my /home/parse/parse-dashboard/config.json:
"serverURL": "http://172.17.0.2:1337/parse"
should point to my DSM machine which is:
"serverURL": "http://192.168.1.2:1337/parse"

Creating Selenium node

I am getting this error while i am trying to attach my real Android device as a Selenium node to hub?
Couldn't register this node: The hub is down or not responding: Connect to x.x.x.x:4445 [/x.x.x.x] failed: Network is unreachable
Any suggestions would be appreciated.
config.json file :
{ "capabilities":
[ {
"browserName": "Android",
"version":"4.4.2",
"maxInstances": 3,
"platform":"ANDROID",
"deviceName":"emulator-5554" } ],
"configuration":
{ "nodeTimeout":120,
"port":4728,
"hubPort":4444,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"127.0.0.1:4728/wd/hub",
"hub": "127.0.0.1:4444/grid/register",
"hubHost":"127.0.0.1",
"nodePolling":2000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":2000,
"timeout":30000, "maxSession":1 }
}
Giving config.json file which is working fine for me on selenium grid for android device as well as emulators. Give it a try.
{
"capabilities":
[
{
"browserName": "",
"version":"",
"maxInstances": 1,
"platform":"ANDROID"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4720/wd/hub",
"host":"192.168.1.163",
"port": 4723,
"maxSession": 1,
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "192.168.1.163"
}
}
I am getting below error message.
error: `
uncaughtException: Cannot read property 'url' of undefined date=Fri
Oct 30 2015 10:31:30 GMT+0530 (IST), pid=2850, uid=1020000013,
gid=1020000013,
cwd=/home/sandeepreddy/.npm-packages/lib/node_modules/appium,
execPath=/usr/bin/nodejs, version=v0.10.37, argv=[node,
/usr/bin/appium, --nodeconfi**
`

How to monitor Kafka broker using jmxtrans?

Kafka 0.8.1.1 (kafka_2.8.0-0.8.1.1.tgz)
I am using jmxtrans to do JMX monitoring of a Kafka instance (which is running in docker). Unfortunately, kafka metrics are not being returned.
I have tried a few things to debug this and know that kafka is running correctly (I can produce/consume messages successfully) have concluded that jmxtrans does return JMX metrics (for example, java.lang:type=Memory, attribute=HeapMemoryUsage returns correct data) so the general kafka and JMX capability seems to be working. Also, I can access the metrics when I use jconsole -- the metrics seem to be captured with data in all relevant fields.
When I try jmxtrans using the following configuration, unfortunately, I do not get any information back (no data at all in fact). I believe the metrics are supposed to be captured based upon the kafka documentation ("kafka.server:type=BrokerTopicMetrics", attribute="MessagesInPerSec")
The following is the jmxtrans configuration that I used:
{
"servers" : [ {
"port" : "9999",
"host" : "10.0.1.201",
"queries" : [ {
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
"settings" : {
}
} ],
"obj" : "kafka.server:type=BrokerTopicMetrics",
"attr" : [ "MessagesInPerSec" ]
} ],
"numQueryThreads" : 2
} ]
}
I am not sure why data is not returned. Maybe I setup an invalid jmxtrans configuration or perhaps I am specifying the metric improperly.
Any help is appreciated.
After a lot of experimentation, I have now resolved the question. For completeness, below is how I resolved the problem.
It appears that I specified the "obj" value incorrectly.
The CORRECT obj value (an example) is as follows:
"obj": "\"kafka.server\":type=\"BrokerTopicMetrics\",name \"AllTopicsLogBytesAppendedPerSec\"",
"attr": [ "Count" ]
Note that the "obj" value requires additional quotes. This seems unusual and different than the normal pattern I have seen (no quotes) for other JMX obj values.
JMXTRANS provided valid output after putting the correct (quoted) values in the obj string...
As I could've found out in ./bin/jmxtrans.sh, by default the stdout/log file is /dev/null.
LOG_FILE=${LOG_FILE:-"/dev/null"}
That's why it's important to set the env var to something you can use to see the output:
LOG_FILE=log.txt ./bin/jmxtrans.sh start kafka.json
I'm using the following kafka.json configuration file:
{
"servers" : [ {
"port" : "10101",
"host" : "localhost",
"queries" : [ {
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
"settings" : {
}
} ],
"obj" : "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=testowo",
"attr" : [ "Count" ]
} ],
"numQueryThreads" : 2
} ]
}
When you start jmxtrans it will query the broker with JMX on localhost:10101 about Count attribute for testowo topic. It will print the result out to the file LOG_FILE every 60 secs (you can change it using SECONDS_BETWEEN_RUNS env var), e.g.
LOG_FILE=log.txt SECONDS_BETWEEN_RUNS=5 ./bin/jmxtrans.sh start kafka.json
You may want to use other writers of jmxtrans so the output is not intermingled, e.g.
{
"servers" : [ {
"port" : "10101",
"host" : "localhost",
"queries" : [ {
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.KeyOutWriter",
"settings" : {
"outputFile" : "testowo-counts.txt",
"maxLogFileSize" : "10MB",
"maxLogBackupFiles" : 200,
"delimiter" : "\t",
"debug" : true
}
} ],
"obj" : "kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=testowo",
"attr" : [ "Count" ]
} ],
"numQueryThreads" : 2
} ]
}
And the last but not least, to set the JMX port to a known value use JMX_PORT env var when starting a Kafka broker using ./bin/kafka-server-start.sh, i.e.
JMX_PORT=10101 ./bin/kafka-server-start.sh config/server.properties

Resources