tomcat7 monitoring using jmxtrans - java

I am using jmxtrans for remote monitoring of tomcat jvm, my request json query is as below
{
"servers" : [ {
"alias" : "MY_TOMCAT",
"local" : false,
"host" : "myhost",
"port" : "myport",
"queries" : [ {
"obj" : "Catalina:type=GlobalRequestProcessor,name=\"http-nio-*\"",
"attr" : [ "requestCount", "requestProcessingTime" ],
"resultAlias" : "tomcat.global-request-processor.http-nio",
"outputWriters" : [ {
"#class" : "com.googlecode.jmxtrans.model.output.StdOutWriter",
"settings" : {
"debug" : true
}
} ]
} ],
"url" : "service:jmx:rmi:///jndi/rmi://myhost:myport/jmxrmi"
} ]
}
I have successfully configured jmxtrans to monitor ActiveMQ, but for tomcat its not working.
I am using tomcat-7.40 running on jdk7.
Review and let me know, are there any changes required to json request

I got this resolved. There is nothing wrong / missing with request json.
It was a firewall issue, as jmx port was blocked. After fixing firewall issue it started pulling data from the tomcat.

Related

Alternative for spring-roo repository

Any alternative for https://repo.spring.io/spring-roo? apparently today is down:
{
"errors" : [ {
"status" : 404,
"message" : "Not Found"
} ]
}
this alternative its working for Spring-Roo and all dependencys of Spring:
https://spring-roo-repository.springsource.org/

Apereo CAS OAuth2: callbackAuthorize switch Location to HTTP

I have setup a CAS server and I have configured a service for my client-application:
{
"#class" : "org.apereo.cas.support.oauth.services.OAuthRegisteredService",
"clientId": "*********",
"clientSecret": "*****************",
"serviceId" : "^(http|https|imaps)://.*coll.mydomain.org.*",
"name" : "Angular OAuth2 App",
"id" : 10000013,
"supportedGrantTypes": [ "java.util.HashSet", [ "implicit", "refresh_token", "client_credentials" ] ],
"supportedResponseTypes": [ "java.util.HashSet", [ "token" ] ],
"bypassApprovalPrompt" : true,
"jsonFormat" : true,
"attributeReleasePolicy" : {
"#class" : "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
},
"logoutUrl" : "https://sso.coll.mydomain.org/cas/logout"
}
After the user has submitted the login form with is (correct) credentials, the OAuth2 flow goes on and produces this http request
GET https://sso.coll.mydomain.org/cas/oauth2.0/callbackAuthorize?client_id=*************&redirect_uri=https://myclientapp.coll.mydomain.org&response_type=token&client_name=CasOAuthClient&ticket=ST-*********************************************
which gets this (wrong) Location Response Header in which the protocol has switched from HTTPS to HTTP:
location: http://sso.coll.mydomain.org/cas/oauth2.0/authorize?response_type=token&client_id=*************&redirect_uri=https%3A%2F%2Fmyclientapp.coll.mydomain.org
This is a problem because (correctly) interrupts the user-webflow on Chrome with this warning:
"The information you are sending aren't protected"
In the cas.properties:
cas.server.name: https://sso.coll.mydomain.org
cas.server.prefix: https://sso.coll.mydomain.org/cas
Can anyone suggest me what configuration does make CAS to change the protocol in the Response Location Header?
Any suggests will be appreciated.
Thanks to all.
Ok guys, a simple CAS restart resolved the issue. But the reason remains a mistery.

Spring data repositories get unloaded after 5 minutes

I'm debugging a spring application, which "loses" it's Entities/Repositories after ~5 Minutes.
application.properties:
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.jpa.database=SYBASE
spring.datasource.driver-class-name=com.sybase.jdbc4.jdbc.SybDriver
spring.datasource.url=jdbc:sybase:Tds:database-host:2638/R4Sybase
spring.datasource.username=user
spring.datasource.password=pass
spring.datasource.maxLifeTime=60000
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=DEBUG
spring.jpa.open-in-view=true
spring.jpa.show-sql=false
Example repository:
public interface EstateRepository extends CrudRepository<Estate, Integer> {
/* ... nothing special ... */
}
After startup/initialization, available entities are listed under /:
{
"_links" : {
"estates" : {
"href" : "http://localhost:8080/choices/estates"
},
/* ... more entities ... */
"profile" : {
"href" : "http://localhost:8080/choices/profile"
}
}
However, after ~5 Minutes, the response for /changes to
{
"_links" : {
"profile" : {
"href" : "http://localhost:8080/choices/profile"
}
}
}
It seems like all entities/repos are unloaded, there aren't any exceptions in the catalina log, no timeouts, no database errors at all. Reloading the app in tomcat fixes things for another 5 minutes.
I've tried fiddling with connection pool settings, switching to a Tomcat connection pool but to no avail.
Is there some kind of keep-alive setting? Is this a garbage collection issue?

How to deploy asynchronously an application using REST in weblogic 12C?

I have been deploying a weblogic application using the REST api with the following snippet
curl --insecure -X POST --user ${userpass} -F\"deployment=#${appFileName}\" -F\"model={name: '${appName}', deploymentOptions: { retireGracefully: 'false', timeout: '0' } , ${appType} ${appPlanVersion} targets: [ ${appTargets} ]}\" ${wlhost}/management/wls/latest/deployments/application "
I have to wait until this curl ends , but sometimes the request times out because of server configuration.
so, I thought it would be better to do this operation asynchronously, I have read in the documentation that I can use header
-X Prefer:respond-async
but is not clear how to use it, I was not able to find an useful example, once I have added the header, the request is going to return a task URL like
BODY:
{
"links": [{
"rel": "job",
"href": "http:\//localhost:7001/management/weblogic/latest/domainRuntime/deploymentManager/deploymentProgressObjects/fairShare"
}],
"operationType": 5,
"state": "STATE_RUNNING",
"applicationName": "fairShare",
"progress": "processing",
"completed": false
}
how do I poll that job URL to know that the application was deployed and is active ?
If you'll execute:
curl --insecure -X GET --user ${userpass} ${wlhost}/management/tenant-monitoring/applications/${appName}
when application ${appName} is not deployed, you should get 404 Not Found.
when it's deployed, you should get a JSON similar to this:
{
"body": {
"item": {
"name": "${appName}",
"type": "ear",
"state": "STATE_ACTIVE",
"health": "HEALTH_WARN",
"targetStates": [
{
"target": "wls",
"state": "STATE_ACTIVE"
}
],
"dataSources": [],
"workManagers": [
{
"pendingRequests": 0,
"completedRequests": 125,
"name": "default",
"server": "wls"
}
],
"minThreadsConstraints": [],
"maxThreadsConstraints": [],
"requestClasses": []
}
},
"messages": []
}
Tested (in Postman) on WebLogic 12.2.1.4
The answer is to use the request parameter _detached= true
in the post URL,
This will start the deployment asynchronously
for an example , refer to this document.
https://docs.oracle.com/middleware/1213/wls/WLRMR/management_wls_version_deployments_application.htm#WLRMR290

in graphite server - actuator/metrics/http.server.requests count not updating

I have a spring boot project up and running. I have also configured dependency for micrometer-registry-graphite in pom file. And I have installed graphite using docker (downloaded latest version - 1.1.6) and it is running in localhost:80
When I hit the below url it properly shows the hit count.
http://localhost:5080/api/v1/actuator/metrics/http.server.requests?tag=uri:/queue/{queueId}&tag=status:200
Below is the response,
{
"name": "http.server.requests",
"description": null,
"baseUnit": "milliseconds",
"measurements": [
{
"statistic": "COUNT",
"value": 29.0
},
{
"statistic": "TOTAL_TIME",
"value": 942.520949
},
{
"statistic": "MAX",
"value": 0.0
}
],
"availableTags": [
{
"tag": "exception",
"values": [
"None"
]
},
{
"tag": "method",
"values": [
"GET"
]
},
{
"tag": "outcome",
"values": [
"SUCCESS"
]
}
]
}
When I navigate to Graphite Browser, I'm not able to get the count value which I got previously using actuator/metrics url. [We can see the service's url queue/queueId is transformed to some hierarchy form].
And I can see different hierarchical structure (attached the image), why it is showing under exception, None and other unrelated hierarchy. Can someone please explain this and I'm in need of solution to get the hit count in graphite server.
Spring boot version: 2.2.4 RELEASE and
micrometer-registry-graphite version: 1.3.2
I have wrongly pointing my graphite server with port-80 in bootstrap.yml. But port-80 listening fo nginx, where it should point to port-2004 which is listening for carbon receiver. After this change in bootstrap.yml I'm able to resolve this issue.

Categories