0

Is there any doc for managing landscape using the command line? For example, how can I test a ping from my client machine?

1
  • is there anyone who can answer? or no one uses landscape as CM tool? – zainsyed Oct 6 '18 at 0:20
1

I believe that what you are asking for is how to manage Landscape server via CLI. Therefore I would like to point you to User Guide located here https://landscape.canonical.com/static/doc/user-guide/ This will be a good start.

With regards to CLI tools you would need to pick which one do you feel most comfortable with/ your preference: https://landscape.canonical.com/static/doc/api/

And just to get you started there are 3 ways of using this API:

command-line client: easy to use, shell-script friendly

Python module: more powerful, recommended if you want to drive the API via Python

low-level HTTP requests: in the case you want to know what is going on, or write a client for some other language

My personal favourite is the command line client. Once you install landscape-api and source your keys ( you can find, generate and refresh them from Landscape server GUI, just click on your name when you are logged in) as per https://landscape.canonical.com/static/doc/api/api-client-package.html you can get all the information from your Landscape server and attached machines:

example:

$ landscape-api get-computers | grep host
  u'hostname': u'xxx.eu-west-2.compute.amazonaws.com',
  u'hostname': u'xxx.eu-west-2.compute.internal',
  u'hostname': u'laptop',

$ landscape-api get-computers | grep ping
  u'last_ping_time': u'2018-12-05T16:45:39Z',
  u'last_ping_time': u'2018-12-05T16:45:39Z',
  u'last_ping_time': u'2018-12-05T15:24:20Z',

I am grepping here just to show you example as full output for even 3 machines is quite big especially if you run it with additional switches:

$ landscape-api get-computers --with-hardware

or

$ landscape-api get-computers --with-hardware --json

Then you can additionally parse that with jq for additional text manipulation

Hope this will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.