# Plugin ssh inventory

# Introduction

**The purpose of this plugin is to execute ssh commands in switches to return information that can be consulted in PandoraFMS**, such as its configuration or its firmware version.

The plugin connects to the switch, executes the command configured by the user and shows its output in the configured agent inventory.

# Compatibility matrix

<table border="1" id="bkmrk-sistemas-donde-se-ha-1" style="width: 97.1605%;"><tbody><tr><td style="width: 22.0483%;">**Systems where tested**</td><td style="width: 77.9517%;">Rocky linux, Fedora 34</td></tr><tr><td style="width: 22.0483%;">**Systems where it works**</td><td style="width: 77.9517%;">Any linux system</td></tr></tbody></table>

# Pre requisites

- Connectivity from PandoraFMS to the target switch

# Parameters

<table border="1" id="bkmrk-%22address%22-host-o-ip-" style="width: 100%; height: 292.563px;"><colgroup><col style="width: 16.0675%;"></col><col style="width: 83.9325%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">"address"</td><td style="height: 29.7969px;">Host or ip of the switch to which you want to connect.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">"username"</td><td style="height: 29.7969px;">User</td></tr><tr style="height: 80.1875px;"><td style="height: 80.1875px;">"password"</td><td style="height: 80.1875px;">Password. In case you need to enable password, specify separating password and enable with "/" : password/enable.

Example : P4nd0r4/S3uK!

</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">"command"</td><td style="height: 29.7969px;">Command to be executed on the target machine</td></tr><tr style="height: 46.5938px;"><td style="height: 46.5938px;">"extra\_command"</td><td style="height: 46.5938px;">In case paging is required (the output is shown cut off), use this parameter to launch a command to enable paging mode.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">"--debug"</td><td style="height: 29.7969px;">To display extra run information</td></tr></tbody></table>

# Manual execution

The plugin execution format is as follows :

```
./ssh_inventory < host > < user > < password > < command > < command paging > < apply filter : 1 or 0 >
```

In case you need enable password :

```
./ssh_inventory < host > < user > < password / enable password > < command > < command paging > < apply filter : 1 or 0 >
```

Example of execution on **cisco** switch (with enable password):

```
./ssh-plugin 192.168.23.212 admin pandora/en4Bl3 "show running-config" "terminal length 0" 1
```

Example of execution in **mikrotik** switch (without enable password):

```
./ssh_inventory 192.168.87.21 admin pandora "system resource print" "" 1
```

Example of execution on switch **A10** (with enable password):

```
./ssh-plugin 192.168.1.27 admin pandora/pandora "show running-config" "" 1
```

# Configuration in PandoraFMS

Para configurar el plugin en PandoraFMS, se deben seguir los siguientes pasos :

**1.** Upload the plugin to PandoraFMS, for example in the following path:

```
/etc/pandora/plugin
```

**2.** Go to the inventory modules menu and create a new one.

[![image.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-11/scaled-1680-/HaOimage.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-11/HaOimage.png)

**3.** Create a new inventory module

[![imagen.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-12/scaled-1680-/imagen.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-12/imagen.png)

The interpreter must be left empty, in script mode, the path to the plugin must be entered.

**4.** Go to an agent and configure the plugin

[![imagen.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-12/scaled-1680-/9BPimagen.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-12/9BPimagen.png)

The custom fields option must be checked, add the target and an interval, the following custom fields must be added:

- **user**: user
- **password**: the password (if there is enable it should be specified in this field separated from the password with "/" as in the example),
- **command**: The command to launch
- **extra command**: if required, otherwise leave blank.

Once these steps are done, the plugin should be added and the result of the command execution will be shown in the agent inventory view:

[![imagen.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-11/scaled-1680-/lhGimagen.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-11/lhGimagen.png)