Monitor NFX250 with Contrail Insights Agent
This topic describes how to install Contrail Insights Agent on the Juniper Networks NFX250 Network Services Platform.
In the Contrail Insights architecture, an adapter is used to discover and correlate virtual machines and containers in cloud environments, and configure elements in the Contrail Insights Platform.
Contrail Insights is typically installed using Ansible. Currently, Ansible is not able to gather facts when connecting to a NFX host.
Contrail Insights Agent currently supports
systemd
andupstart
scripts to manage the daemon. In the following installation instructions, Agent is started manually.
Prerequisites
Contrail Insights Platform running OpenStack Adapter for identity and authentication.
In the following instructions, commands executed on the Contrail Insights Platform use the prefix
appformix1$
.To install Contrail Insights Platform, see Contrail Insights Installation and Configuration for OpenStack.
NFX250
NFX250 has multiple IP addresses and shells that can be accessed, such as the host and Junos Device Manager (JDM).
Commands executed on JDM shell use prefix
root@nfx1-jdm#
.Commands executed on host (Linux KVM hypervisor) shell use
root@nfx1-host#
.
Time must be correct on NFX250. Use Network Time Protocol (NTP) to synchronize Junos device time. Verify the result of
show system uptime
command is the same as the time of AppFormix-VM.
Install Contrail Insights Agent on NFX250
To install Contrail Insights Agent on NFX250:
Download and extract the Contrail Insights installation package from software downloads.
contrail-insights-<version>.tar.gz $ tar -xvf contrail-insights-<version>.tar.gz
Copy the installer script to the NFX250:
$ scp appformix-<version>/appformix_installer_wrl-7.0_<version>.sh root@nfx1:/tmp/
Log in to the NFX250 and execute the script. When prompted, provide the log in credentials for
appformix_controller
to enable a secure tunnel connection betweenappformix_platform_host
and NFX250.$ssh root@nfx1 root@nfx1-jdm:~# chmod +x /tmp/appformix_installer_wrl-7.0_<version>.sh root@nfx1-jdm:~# /tmp/appformix_installer_wrl-7.0_<version>.sh <appformix_platform_host_ip_address> <appformix_platform_host_user> [ssh_key_path port:default=9000 agent_port:default=42595]
Verify Installation of Contrail Insights Agent on NFX250
Run the following commands to verify Contrail Insights Agent is installed on the NFX250.
On Contrail Insights Platform node:
appformix1$ curl http://<nfx-ip>:42595/appformix/v1.0/status
On the NFX Hypervisor:
appformix1$ curl http://<appformix-ip>:9000/appformix/controller/v2.0/status
Configure Contrail Insights Manually for NFX250
Currently, there is not an adapter to discover the NFX250 and the virtual machines that execute on the device. See the following workflow and procedures to configure Contrail Insights manually.
Get an Authentication Token
To get an authentication token:
-
Substitute the values in the example file in Step 2 for an OpenStack user (
UserName
), project (ProjectName
), and password (Password
). Set
APPFORMIX_PLATFORM_HOST
to the hostname or IP address of the Contrail Insights Platform host.$ APPFORMIX_PLATFORM_HOST=myhost1 $ curl -sS -H "Content-type: application/json" -d@- http://${APPFORMIX_PLATFORM_HOST}:9000/appformix/controller/v2.0/auth_credentials <<EOF { "UserName": "user1", "ProjectName": "project1", "UserDomainName": "Default", "Password": "password", "AuthType": "openstack", "ProjectDomainName": "Default" } EOF
Output will look similar to the following:
{ "Token": { "expiresAt": "2017-04-13T00:05:05.000000Z", "isAdmin": true, "isConfigAdmin": true, "issuedAt": "2017-04-12T23:05:05.000000Z", "tokenId": "gAAAAABY7rKh7PUbI3HUczxlP097qtO5R3IsLBFlqztz4YPRMoXepYZGUKFWrChx9frjhixjafoMzphughHuQfz4 EurAKGasAuI0e-Za01tDAWmBTbyNvBVxVipNAQGpJsFIE1inl5Zux3oCs0KEHI2nyYWMrgI-m27BoxnUCG_ZnLWAVEvVDAM" } }
Set
TOKEN
environment variable for subsequent commands:$ TOKEN="gAAAAABY7rKh7PUbI3HUczxlP097qtO5R3IsLBFlqztz4YPRMoXepYZGUKFWrChx9frjhixjafoMzphughHuQfz4Eur AKGasAuI0e-Za01tDAWmBTbyNvBVxVipNAQGpJsFIE1inl5Zux3oCs0KEHI2nyYWMrgI-m27BoxnUCG_ZnLWAVEvVDAM"
Add NFX250 as a Host
To add the NFX250 as a host:
-
Enter the following values as shown in the example file in Step 2 of Add NFX250 as a Host section to add NFX250 as a host:
-
Name—Name is displayed in the Dashboard and is the user-facing identifier.
-
HostName—Hostname or IP address used to reach NFX250 host address.
-
ServerId—Unique identifier for your NFX250 server.
-
Source—Enter "bare-metal" as Source value to indicate this host was not configured by an adapter that discovered the host from a cloud management system (such as OpenStack or Kubernetes).
-
POST your file to
/appformix/controller/v2.0/hosts
.$ curl -sS -H "Content-type: application/json" -H "X-Auth-Token: ${TOKEN}" -H "X-Auth-Type: openstack" -d@- http://${APPFORMIX_PLATFORM_HOST}:9000/appformix/controller/v2.0/hosts <<EOF { "Name": "nfx1", "HostName": "nfx1", "HostType": "kvm", "LinkCapacity": "10G", "Source": "bare-metal", "ServerId": "nfx1", "AgentBaseUrl": "http://nfx-ip:42595" } EOF
Enter the following values in the example file to add NFX250 as a host:
Add a Project for VNFs on the NFX250
All instances in Contrail Insights must belong to a project. To create a project in which VNF VMs are added, see the following steps:
-
Enter "bare-metal" as
Source
value as shown in Step 2 of Add a Project for VNFs on the NFX250 section to indicate this project was not configured by an adapter that discovered the host from a cloud management system (such as OpenStack or Kubernetes). POST to /appformix/controller/v2.0/projects.
$ curl -sS -H "Content-type: application/json" -H "X-Auth-Type: openstack" -H "X-Auth-Token: ${TOKEN}" -d@- http://${APPFORMIX_PLATFORM_HOST}:9000/appformix/controller/v2.0/projects <<EOF { "ProjectId": "nfx", "VirtualMachines": [], "Name": "nfx", "ProjectDomain": "default", "Source": "user" } EOF
Add a VM on the NFX250
The virtual machine (VM) has to be added manually if the automatic_kvm_instance_discovery
flag is not set in
Ansible during playbook installation.
To add a VM on the NFX250:
Run
virsh list
to determine the list of VMs on the NFX250. For example:root@nfx1-host:~# virsh list Id Name State ---------------------------------------------------- 3 vjunos0 running 5 vsrx running 6 riverbed running
Configure the VM (instance) in Contrail Insights using the following values:
InternalName
Name
VirtualMachineId
ProjectId
POST /appformix/controller/v2.0/instances
Example:
$ curl -sS -H "Content-type: application/json" -H "X-Auth-Type: openstack" -H "X-Auth-Token: ${TOKEN}" -d@- http://${APPFORMIX_PLATFORM_HOST}:9000/appformix/controller/v2.0/instances < { "InternalName": "vjunos0", "Name": "vjunos0", "VirtualMachineId": "vjunos0", "ProjectId": "nfx", "ServerId": "nfx1", "InstanceType": "kvm", "MetaData": { "VolumeList": [], "FlavorId": "" } }