個人的な趣味による Nutanix Community Edition 日記。Japanese のみですみません。

Linux で Nutanix CE の ncli を実行してみる。

Linux(Oracle Linux 7)で ncli を実行してみます。
今回の Nutanix CE のバージョンは ce-2018.01.31-stable です。

Linux です。

[root@vm01 ~]# cat /etc/oracle-release
Oracle Linux Server release 7.4

Java Runtime Environment をインストールしておきます。
ちなみに、JRE 1.9 ではエラーになりました。

[root@vm01 ~]# yum install -y java-1.8.0-openjdk
[root@vm01 ~]# java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

unzip がインストールされていない場合は、インストールしておきます。

[root@vm01 ~]# yum install -y unzip

ncli をダウンロードします。

[root@vm01 ~]# curl -ks https://ntnx-n10.go-lab.jp:9440/console/downloads/ncli.zip -o ncli.zip
[root@vm01 ~]# ls -l ncli.zip
-rw-r--r--. 1 root root 66865528 Mar 13 07:45 ncli.zip


[root@vm01 ~]# unzip ncli.zip -d ncli
Archive:  ncli.zip
  inflating: ncli/ncli
  inflating: ncli/ncli.cmd
  inflating: ncli/README
   creating: ncli/lib/
  inflating: ncli/lib/aopalliance.jar
  inflating: ncli/lib/annotations.jar
  inflating: ncli/lib/jsr305.jar
  inflating: ncli/lib/gson.jar
  inflating: ncli/lib/guava.jar
  inflating: ncli/lib/guice.jar
  inflating: ncli/lib/protobuf-java.jar
  inflating: ncli/lib/gettext-commons.jar
  inflating: ncli/lib/json-simple.jar
  inflating: ncli/lib/protobuf-java-format.jar
  inflating: ncli/lib/ProtoDependencies.jar
  inflating: ncli/lib/cli-common-lib.jar
  inflating: ncli/lib/nutanix_about.jar
  inflating: ncli/lib/nutanix_util.jar
  inflating: ncli/lib/prism_sdk_rest.jar
  inflating: ncli/lib/prism_services_java.jar
  inflating: ncli/lib/jaxb-impl.jar
  inflating: ncli/lib/commons-codec.jar
  inflating: ncli/lib/commons-lang.jar
  inflating: ncli/lib/commons-logging.jar
  inflating: ncli/lib/netty.jar
  inflating: ncli/lib/javax.inject.jar
  inflating: ncli/lib/javax.ws.rs-api.jar
  inflating: ncli/lib/jline.jar
  inflating: ncli/lib/junit.jar
  inflating: ncli/lib/log4j.jar
  inflating: ncli/lib/jcip-annotations.jar
  inflating: ncli/lib/jopt-simple.jar
  inflating: ncli/lib/cxf-api.jar
  inflating: ncli/lib/cxf-rt-bindings-xml.jar
  inflating: ncli/lib/cxf-rt-core.jar
  inflating: ncli/lib/cxf-rt-frontend-jaxrs.jar
  inflating: ncli/lib/cxf-rt-rs-extension-search.jar
  inflating: ncli/lib/cxf-rt-transports-http.jar
  inflating: ncli/lib/geronimo-javamail_1.4_spec.jar
  inflating: ncli/lib/httpcore.jar
  inflating: ncli/lib/httpcore-nio.jar
  inflating: ncli/lib/xmlschema-core.jar
  inflating: ncli/lib/zookeeper.jar
  inflating: ncli/lib/jackson-core-asl.jar
  inflating: ncli/lib/jackson-jaxrs.jar
  inflating: ncli/lib/jackson-mapper-asl.jar
  inflating: ncli/lib/stax2-api.jar
  inflating: ncli/lib/woodstox-core-asl.jar
  inflating: ncli/lib/hamcrest-core.jar
  inflating: ncli/lib/javassist.jar
  inflating: ncli/lib/mockito-all.jar
  inflating: ncli/lib/lombok.jar
  inflating: ncli/lib/reflections.jar
  inflating: ncli/lib/slf4j-api.jar
  inflating: ncli/lib/slf4j-log4j12.jar
  inflating: ncli/lib/spring-beans.jar
  inflating: ncli/lib/spring-core.jar
  inflating: ncli/lib/wsdl4j.jar
  inflating: ncli/prism_cli.jar
[root@vm01 ~]#

ncli の README です。

[root@vm01 ~]# cd ncli/
[root@vm01 ncli]# cat README
Instructions to execute the Nutanix Commad-Line Interface (CLI):

1. Download and unzip ncli.zip to a location of your choice
2. Add the above directory location to your system path
3. Install the Java Runtime Environment (JRE) version 5.0 or higher
4. Add the 'bin' directory of the JRE install to your system path
5. Open a new terminal window, at the command prompt, start the nCLI:
    ncli -s management_ip_addr -u 'username' [-p 'user_password']

    - Replace ncli_dir with the directory where the nCLI is installed.
    - Replace management_ip_addr with the IP address of any Nutanix Controller VM in the cluster.
    - Replace username with the name of the user (if not specified, the default is admin).
    - (Optional) Replace user_password with the password of the user.

6. Command format
    ncli> entity action parameter1=value parameter2=value ...

    - Entity can be replaced by any Nutanix entity, such as cluster or disk.
    - Action can be replaced by any valid action for the preceding entity.
      ncli> storagepool list
    - Some actions require parameters at the end of the command.
      ncli> datastore create name="NTNX-NFS" ctr-name="nfs-ctr"

7. Execute 'ncli help' at the prompt for more information
[root@vm01 ncli]#

ncli のバージョンです。

[root@vm01 ncli]# ./ncli -v

    ncli Version              : ce-2018.01.31-stable
    Changeset ID              : c3b996
    Changeset Date            : 2017-12-18 12:25:53 -0800
[root@vm01 ncli]#

クラスタに接続してみます。ntnx-n10.go-lab.jp は自宅の Nutanix クラスタの VIP アドレスです。パスワード指定をしないとエラーになるので、コマンドラインで指定してしまっています。

[root@vm01 ncli]# ./ncli -s ntnx-n10.go-lab.jp -u gowatana
Error: Please provide the password (Use -p option)
[root@vm01 ncli]# ./ncli -s ntnx-n10.go-lab.jp -u gowatana -p 'パスワード'

Welcome, Go
You're now connected to 0005668e-e3e8-b860-5a82-0050568af9d2 (ce-ntnx-n10) at ntnx-n10.go-lab.jp

ncli> cluster
ncli> cluster version

    Cluster Version           : ce-2018.01.31-stable
    Changeset ID              : c3b996
    Changeset Date            : 2017-12-18 12:25:53 -0800

    ncli Version              : ce-2018.01.31-stable
    Changeset ID              : c3b996
    Changeset Date            : 2017-12-18 12:25:53 -0800