I am trying to modify/add some OpenStack code to implement such functionality: after users click one button, some command will be executed on the specified host (e.g. one compute node).
One user scenario is, enable KSM kernel feature on one specified host. All need to do is to run "echo 1 > /sys/kernel/mm/ksm/run". Now I can get the IP of the host (some compute node), but how to execute the above command via OpenStack code?
(I checked all the Nova APIs. It seems there is no such Nova API to execute a command on a host. Also, I checked all the Ironic APIs. The same result.)
Related
I would like to communicate with AWS Batch jobs from a local R process in the same way that Davis Vaughn demonstrated for EC2 at https://gist.github.com/DavisVaughan/865d95cf0101c24df27b37f4047dd2e5. The AWS Batch documentation describes how to set up a key pair and security group for batch jobs. However, I could not find detailed instructions about how to find the IP address of a job's instance or what user name I need. The IP address in particular is not available in the console when I run the job, and aws batch describe-jobs --jobs prints out an empty "jobs": [] JSON string. Where do I find the information I need to ssh into a job's instance? (In my use case, I would prefer the IP address instead of the host name.)
Posting here in case this helps someone. The instance should show up under "Running instances" in your ec2 console. You should be able to use the public ip address specified there. Make sure you configured your batch job to use your ec2 key pair and the correct user name (ec2-user for amazon linux 2). eg. ssh -i "your_keypair.pem" ec2-user#XX.XXX.XX.XXX.
Connect to instance: i-38942195
To connect to your instance, be sure security group my-test-security-group has TCP port 22 open to inbound traffic and then perform the following steps (these instructions do not apply if you did not select a key pair when you launched this instance):
Open an SSH terminal window.
Change your directory to the one where you stored your key file my-test-keypair.pem
Run the following command to set the correct permissions for your key file:
chmod 400 my-test-keypair.pem
Connect to your instance via its public IP address by running the following command:
ssh -i my-test-keypair.pem root#192.168.0.29
Eucalyptus no longer supports VMware, but to generally troubleshoot instance connectivity you would first check that you are using a known good image such as those available via:
# python <(curl -Ls https://eucalyptus.cloud/images)
and ensure that the instance booted correctly:
# euca-get-console-output i-38942195
if that looks good (check for instance meta-data access for the SSH key) then check that the security group rules are correct, and that the instance is running using the expected security group and SSH key.
VMWare deprecation notice from version 4.1:
Support for VMWare features in Eucalyptus has been deprecated and will be removed in a future release.
http://docs.eucalyptus.cloud/eucalyptus/4.4.5/index.html#release-notes/4.1.0/4.1.0_rn_features.html
Euca2ools command:
http://docs.eucalyptus.cloud/eucalyptus/4.4.5/index.html#euca2ools-guide/euca-get-console-output.html
I am new to Google Cloud (and unix) and have been using ml-engine to train a neural net using Tensorflow.
Here it says that you can monitor the app using tensorboard. How can I access the tensorboard panel? When I run it (from the Cloud Shell Access console) it says it's running at http://0.0.0.0:6006
I don't know the IP of the Cloud Shell console, how can I access the tensorboard panel?
The command I run (and output):
tensorboard --logdir=gs://model_output
Starting TensorBoard 47 at http://0.0.0.0:6006
Thanks!
The easiest is to adjust your command to:
tensorboard --logdir=gs://model_output --port=8080
E.g. adding --port=8080 to your command, which allows you to just use the default Web Preview option of Cloud Shell
I want to give some other suggestions. The solution from #Fematich is very helpful. The small glitch here is that 8080 is the default port, and usually we may run jupyterlab on this port. So, my suggestion is that you need to ssh to two sessions; one on port 8080 and one on port 6006. Then run tensorboard in the session on port 8080, and open web-preview in the second session with changing the port from default 8080 to 6006. So you can update your model in one session freely and observe the graph in another session. I found it pretty helpful.
I have a pressure sensor plugged into my computer, and the only way to collect the data is through a localhost API endpoint, meaning right now only that machine can collect data. Is there any way to receive data from the localhost API on a different machine? I also need to ping the API 20-40 times a second if that matters.
There are couple of ways I can think of, I am assuming both the machines are on same network
Use localhost API to collect the data in database and create a GET endpoint inside same application for fetching the data according your parameters. You can access GET endpoint from different machine by hitting network ip address of your local machine. Which you can check using ifconfig command in your terminal, check en0 type where you will find something like 192.168.X.X. From other machine you can hit http://192.168.X.X:<port>/getData, where <port> is the localhost port.
If you don't want to use database, then you can use publish subscribe mechanism which is real time. see http://autobahn.ws/python/
How publish subscribe works ?
You will have to make your localhost machine a publisher (server) which will publish events or sensor data in your case (real time). The other machine will be subscriber (client ) which will listen to the events from your server and do necessary processing.
Its uses WAMP (Web application messaging protocol) for communication. The sample code for basic publisher and subsriber can be found here.
Follow steps:
1 : Download ngrok,
2 : Go to the path where ngrok.exe file present and open that path in cmd.
3 : Connect your account.
paste : ngrok authtoken1pA6advIt950uA4y2Rixgc8rdx9_23MSDokKjWhbPUW3NSrZK
4 : Replace your port no including bracket.
paste : ngrok http {9003} -host-header="localhost:{9003}".
5 : copy forward line and paste in other system to check.
Forwarding http://d1c0bc16ff7b.ngrok.io
How can I access the console of a Google Compute Engine VM instance?
To see the console output (read-only), you can use any of the following methods:
Web UI via Developers Console – on the instance detail page, scroll to the bottom of the page and expand the console output view
CLI via gcloud compute instances get-serial-port-output
API via getSerialPortOutput
To get read/write (interactive) access, follow instructions on this page:
gcloud compute instances add-metadata [INSTANCE_NAME] \
--metadata=serial-port-enable=1
and then, per the same page, either connect via Google Cloud Console:
Go to the VM instances page.
Go to the GCE VM instances page
Click the instance you want to connect to.
Scroll to the bottom of the page and look for the Serial port section.
If you want to connect to a serial port other than the default serial port 1, click the down arrow next to the Connect to serial port button and change the port number accordingly.
Click the Connect to serial port button to connect to port 1 by default. For Windows instances, pull down the dropdown menu next to the button and connect to Port 2 to access the serial console.
or, connect via gcloud:
Use the gcloud compute connect-to-serial-port subcommand to connect using the gcloud command-line tool. For example:
gcloud compute connect-to-serial-port [INSTANCE_NAME]
where [INSTANCE_NAME] is the name of the instance for which you want to access the serial console.
By default, the connect-to-serial-port command connects to port 1 of the serial console. If you are connecting to a Windows VM instance, connect to port 2 instead:
gcloud compute connect-to-serial-port [INSTANCE_NAME] --port 2
To connect to any other port, provide a different port number using the --port flag. You can provide a port number from 1 through 4, inclusively. To learn more about port numbers, see Understanding serial port numbering.
While this doesn't answer your direct question, if the reason you need physical console access is to troubleshoot why a system is inaccessible (i.e. it no longer boots or, because of a bad firewall configuration, you can no longer access it over SSH), your best bet is to:
Update the disk configuration so it is not deleted when the instance is destroyed
Delete the instance so the disk is no longer attached to a running instance
Attach the disk to another instance which boots correctly
Mount the disk to a temporary location within that instance, so you can read logs, view/edit configuration files, etc.