# ONES Telemetry Agent Installation

## ONES Agent v2.0 support Agent Auto discovery

1. ONESv2.0 Agent support auto-discovery feature
2. ONESv2.0 Agent support to send telemetry on multiple controllers (Max 2)
3. Restrict IP feature can be enabled/disabled
4. Using this feature agent will discover the ONES Controller and will update the entry on ONES App with all the feature metrics
5. Need to add a few inputs while installing agent
   1. Controller IP //To restrict the telemetry streaming
   2. Device Credentials
   3. Layer&#x20;
   4. Region
   5. azid
   6. brickid
   7. rackid

## Installation

On the Application machine, go to ONES-2.0/ones\_t\_agent folder

<mark style="color:blue;">`root@ones-application:~$ cd /ONES-2.0/ones_t_agent`</mark>

### Installation (Agent Install on multiple switches at the same time)&#x20;

* Enter device details (Management IP, Username and Password ) in device\_info.csv

<mark style="color:blue;">`root@ones-application/ONES-2.0/ones_t_agent:~$ vi device_info.csv`</mark>

{% hint style="info" %}
The user needs to add all the required details in the CSV file, This CSV file will be used to push this information to agent.conf(/etc/sonic/agent.conf) file to every switch and ones-agent on the switch will pick the details from agent.conf file and will register itself to ONES controller with all the given parameters\
this helps a NetOps engineer to directly add a CSV file containing all the details, The Engineer needs not to add one by one devices on the controller which actually is time-consuming
{% endhint %}

```log
ip,user,passwd,layer,region,azid,brickid,rackid
10.4.4.61,admin,YourPaSsWoRd,Spine,SanJose,1,1,1
10.4.4.62,admin,YourPaSsWoRd,Leaf,SanJose,1,1,1
...
...
...
```

* Save the File&#x20;

**Executing the installation script can be used for installing a telemetry agent on one or more devices in the data centre.**

{% hint style="info" %}
The installer file automatically detects & will process fresh installation or upgrade to the new version
{% endhint %}

{% hint style="info" %}
While upgrading, all the previous files will automatically get deleted on the Switch
{% endhint %}

{% hint style="info" %}
If users want to use the certificate for GNMI & Auto-Registration, so users need to put the certificate in directory gnmi-certs(for GNMI) & auto-reg-certs(for Agent Auto Registration)
{% endhint %}

<mark style="color:blue;">`root@ones-application/ONES-2.0/ones_t_agent:~$ ./ones_agent_parallel_installer.sh`</mark>

1. Users can use ONES-Agent as an integrated service in SONiC OS or can use it as an independent third-party container.

```log
Does the ONES-agent is integrated with SONiC NOS? (yes/no): no
```

2. &#x20;Scripts asks to put the Controller IP to use auto-discovery feature

```log
Enter the ip address of collectors to auto-discover. Do not enter more than 2. Eg - 10.1.1.10, 10.2.2.5 : 10.4.4.11
```

{% hint style="info" %}
User can only add 2 Controller IP to restrict the telemetry streaming
{% endhint %}

3. User can choose the restriction to send telemetry to collector IP only

```log
Do you want to restrict access only to provided collector ip?
Note: Providing Yes will restrict access to agent only with the provided collector IP Address
Enter Yes/No : Yes
```

{% hint style="danger" %}
It's important to restrict collector IP as NO in case the running network has NAT translation from private to public IP for ONES server access from the device.
{% endhint %}

### Installation Begin

{% code fullWidth="false" %}
```log
root@ones-application/ONES-2.0/ones_t_agent:~$./ones_agent_parallel_installer.sh
Does the ONES-agent is integrated with SONiC NOS? (yes/no): no

Enter the ip address of collectors to auto-discover. Do not enter more than 2. E.g. - 10.1.1.10, 10.2.2.5 : 10.4.4.11
Do you want to restrict access only to provided collector ip?
Note: Providing Yes will restrict access to agent only with the provided collector IP Address
Enter Yes/No : Yes
[{'ip': '10.4.4.61', 'user': 'admin', 'passwd': 'YourPaSsWoRd', 'layer': 'Spine', 'region': 'Sanjose', 'azid': '1', 'brickid': '1', 'rackid': '1', 'installation_instance': 1, 'agentip': '10.4.4.61', 'collectorip': '10.4.4.11', 'restrict_collector_ip': 'Yes'}, {'ip': '10.4.4.62', 'user': 'admin', 'passwd': 'YourPaSsWoRd', 'layer': 'Leaf', 'region': 'Sanjose', 'azid': '1', 'brickid': '1', 'rackid': '1', 'installation_instance': 1, 'agentip': '10.4.4.62', 'collectorip': '10.4.4.11', 'restrict_collector_ip': 'Yes'}]
###############Connecting to switch###############
###############Connecting to switch###############
Connection to switch 10.4.4.61 successful.....................
Looking for previous installation........................
avizdock/ones-agent:devu
Connection to switch 10.4.4.62 successful.....................
Looking for previous installation........................
avizdock/ones-agent:latest


...
...
...
...
ones-agent.service file copied successfully on the device 10.4.4.61........
##################################################################
ones-agent.service file copied successfully on the device 10.4.4.62........
##################################################################
Deployment of ones-agent to switch 10.4.4.61 is successful
Deployment of ones-agent to switch 10.4.4.62 is successful
```
{% endcode %}

{% hint style="info" %}
Now Agent will only stream the metrics to the given controller & will autoregister on the ONES-App
{% endhint %}

{% hint style="warning" %}
The user needs to make sure, The devices have a unique name, otherwise, there will issue while plotting the full topology view(Topology Page).
{% endhint %}

<figure><img src="https://content.gitbook.com/content/LacTh6x78oAd4VRzALXL/blobs/nv9c89n8NjCPgy1FE9Ro/Screenshot%202023-11-18%20at%202.16.33%E2%80%AFPM.png" alt=""><figcaption></figcaption></figure>
