call jmx operation on a local running process - jmx

I have a java process on a linux server, which runs with this option: -Dcom.sun.management.jmxremote
So I cannot just connect to this process via jconsole running on my local pc (because neither port nor -Dcom.sun.management.jmxremote.ssl=false options are set up).
But still, how can I connect to the application and run some operations over some of its MBeans? It this possible? I have a ssh access to the server and would be able to run it "locally" on the server (but not changing the options unfortunately)

According to JMX documentation the -Dcom.sun.management.jmxremote option
Enables the JMX remote agent and local monitoring via JMX connector published on a private
interface used by jconsole. The jconsole tool can use this connector if it is executed by
the same user ID as the user ID that started the agent. No password or access files are
checked for requests coming via this connector.
The naming is a bit unfortunate because it in fact enables the local monitoring only.
Since you can not change the options but can access the server via SSH the only option is to use X server forwarding (ssh -X ...) and run jconsole (or better yet jvisualvm which has specific optimisations for running remotely).

Related

Apache Artemis queue monitoring with Zabbix

I'd like to keep track of data that might be stuck in Apache Artemis queues and I'd like to leverage its JMX management abilities together with our Zabbix instance.
What steps do I need to take in order to successfully connect Zabbix to Artemis via JMX? The ones mentioned in https://activemq.apache.org/artemis/docs/latest/management.html are not quite clear to me.
I had to disable the internal connector and go the other way around by adding this to the artemis.profile file:
JAVA_ARGS="$JAVA_ARGS -Dcom.sun.management.jmxremote"
JAVA_ARGS="$JAVA_ARGS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_ARGS="$JAVA_ARGS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_ARGS="$JAVA_ARGS -Dcom.sun.management.jmxremote.port=1099"
JAVA_ARGS="$JAVA_ARGS -Dcom.sun.management.jmxremote.rmi.port=1098"
JAVA_ARGS="$JAVA_ARGS -Djava.rmi.server.hostname=edimq-broker-master-az1.dc01.clouedi.local"
However, this way it's anything but secure, I know.
As the documentation states, you need to add this to your management.xml:
<connector connector-port="1099"/>
This will expose a JMX connector on localhost so if you want to be able to access it remotely from another machine on your network (i.e. your Zabbix instance) then you should do something like:
<connector connector-port="1099" connector-host="myhost" />
Also, if you have multiple IP addresses on the machine hosting the broker you'll want to set this system property in the JAVA_ARGS variable in artemis.profile:
-Djava.rmi.server.hostname=myhost
Then point your Zabbix instance at the broker using a url like:
service:jmx:rmi:///jndi/rmi://myhost:1099/jmxrmi
You can see this in action by running the jmx example shipped with Artemis in the examples/features/standard/ directory. Just navigate into that directory and run mvn verify. Running the example will create a broker instance, start the broker instance, and run the client all automatically. After the example runs you can go to into the target/server0 directory and look at all the configuration files to compare them to your own. You can also start broker independently of the example if you wish (by running ./artemis run from the target/server0/bin directory). Once the broker is running you should be able to connect to it with JConsole no problem using a JMX url like this:
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

Possible to Change Jenkins URL? : http://localhost:8080

Possible to Change Jenkins URL? : http://localhost:8080
Currently I have jenkins setup on a virtual machine.
Is it possible to setup Jenkins on a URL which is more is accessible for other users?
For example I dont want other users to access test results by connecting to the Virtual machine instead I want them to access a URL from their own device in turn enabling them to login and see test results via jenkins.
thanks for you help
Let's say IP of your virtual machine is 192.168.x.x.
Open the Port 8080 via firewall and then change the URL of jenkins from
"Manage Jenkins >>Config Sys >> Jenkins Location>" to "http://192.168.x.x:8080"
Now you can access it from other machine on same network domain.Just have to hit the url http://192.168.x.x:8080
You can now create different users with different privileges for the same.
You can find it under Manage Jenkins >> Manage Users >> Create Users.
It is related to networking. The machines should be on the same network, so they can talk to each other (unless you have public IP).
The ONLY rule to give access is, that machines can talk to each other (of course, in their language, 0's & 1's).
I suggest following things to do to share the URL:
Ask the users to connect to the same network that your machine is in.
Verify whether they are able to PING your machine IP (get it from ipconfig command for windows - router assigns IP for your machine, that starts with 192.168 or 10.10). command example: ping 10.10.1.10
If any issues in Ping, it might be Windows Firewall or Anti-virus which might be blocking, so allow the IPs in your firewall so they can access your machine.
Then ask them to access Jenkins using the following URL http://[IP of your machine:8080]
We want the Jenkins web interface to be accessible from anywhere (not
just on the local machine), so we’re going to open up the config file:
sudo nano /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist
Find this line:
<string>--httpListenAddress=127.0.0.1</string>
And change it to:
<string>--httpListenAddress=0.0.0.0</string>
RF : Installing Jenkins on macOS

Issues with Jenkins 1.67 URL set up

I am trying to set a new Jenkins instance (version 1.67) on to a Windows Server 2012 r2.
I am trying to configure a custom URL instead of using
localhost:8080
etc..
I have set Jenkins URL as
NewServer.domainname.com
But I cannot access it via that url, I get presented with a message "Remote Web Access is turned off" it only allows me to connect when I follow the URL with the port number;
NewServer.domainname.com:8080
I am sure that Remote web access is completely different from what my goal is.
By default, Jenkins launches its own built-in webserver, listening on port 8080.
Changing the URL in the Jenkins configuration does not change the port that the running webserver listens on, but rather the URL that is shown within the UI, or in emails sent to users etc.
In order to access Jenkins at just NewServer.domainname.com (i.e. running on port 80), you would first have to disable Windows Remote Web Access, which is currently occupying port 80.
You would then need to stop Jenkins and start it again with the flag --httpPort=80; these options are documented on the Jenkins wiki.
If Jenkins was started as a Windows Service, you can edit the jenkins.xml file as shown in these answers.
Just wanted to say, after setting Jenkins.xml to run on port 80, and then via the Jenkins web interface using
'install as service'
I found that this process seemed to create a new jenkins.xml along with the default httpPort which is stored within the Jenkins.war.
I get around this I installed as a service, ensured that the service was not set to start on start up. Rebooted the machine
On start up I re-edited the jenkins.xml httpPort value back to 80. Started the service and now running very happy!

Running an Ant script to prepare a Database in Bluemix

I have an Ant script that I use to populate/prepare a database. All I need is to set the host, port and credentials for the database. It works fine for MySQL and DB2, the DB just need to be reachable from were the script is executed.
The DB service in Bluemix gives me a DB with an IP (75.x.x.x) that is only reachable from the internal network of Bluemix, it is not accessible externally.
My understanding is that my ant script needs to be executed from inside the Bluemix network/servers.
How can I do that?
What would be the alternatives?
I'm considering to create a NodeJS script to trigger that ant internally, but I'm not sure if it will work properly.
dashDB always had the ability for local clients (outside of Bluemix) to connect to the cloud database, and SQL Database later added the feature as well. So you should be able to populate a database as long as you have the correct driver client installed on your local machine.
Can you provide more details on how you tested that the IP is not reachable? Is there a firewall put in place between your local machine and Bluemix? Note that ping is not a good test because the port is blocked for security reasons. You may try the JDBC port indicated on the connection page from the console.
See link for instructions on how to make a connection:
https://www.ng.bluemix.net/docs/#services/SQLDB/index.html#connecting-to-sqldb
You might be able to use a simple custom buildpack. You can start with a sample like this one:
https://github.com/dmikusa-pivotal/cf-test-buildpack
fork it and modify the bin/compile script to run your ant task instead. Then put your ant script (and probably executable as I expect it is not installed in the Bluemix environment) in a directory and run
cf push <appname> -b <your forked git url>
To push it to Bluemix and run it. If you're just using it once you can probably get away with hard-coding the address and credentials, or else you can bind to the same service instance and get the info from VCAP_SERVICES.

TITAN server monitoring via JMX

Is it possible to monitor TITAN cassandra server with rexster remotely via JMX using something like VisualVM?
I have titan installed on the cloud and want to monitor it from my dev box. Is this possible.
I have read this
https://github.com/tinkerpop/rexster/wiki/Monitoring
but it seems that JMX MBeans are only available locally however I could be wrong
You can monitor Rexster JMX remotely with VisualVM, but it takes a bit of configuration and changes to rexster.sh as you need to include these environment variables:
-Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
You can read some more about how to do remote setup on the VisualVM site.
You mentioned that you are trying to monitor an instance in the cloud. You didn't mention the cloud provider, but I've had trouble doing this with EC2 in the past. Perhaps this post will help you out. While I've had issues with VisualVM remoting to EC2, I have successfully connected to Rexster via VisualVM from another EC2 instance without trouble so if all else fails that could be your workaround.

Resources