Commit graph

342 commits

Author SHA1 Message Date
Cyril Levis
75f14fa895
feat: add QEMU support 2022-03-12 10:40:34 +01:00
Christophe Simon
bb08813700
Merge pull request #209 from Solvik/fix/chriss/raid_cmd_returncod_hp_jbod
Fixed HP raid parser when disks are in JBOD
2022-03-11 17:05:38 +01:00
Christophe Simon
ad951b9288 Fixed HP raid parser when disks are in JBOD
The function parsing the RAID logical volumes in the HP module did not
manage the case where disks were set in JBOD mode, thus having no RAID
array set.

This patch fixes this by checking if arrays are defined on pdisks before
parsing the logical disks.

Also added returncode read when executing the RAID related commands to
raise a more precise error.
2022-03-11 15:55:07 +01:00
Christophe Simon
b53dfa9b59
Merge pull request #208 from Solvik/fix/chriss/virtual_network_nic_mac_addr
Fixed virtual network cards creation
2022-03-08 17:31:26 +01:00
Christophe Simon
3b8917aaf3 Fixed virtual network cards creation
This patch fixes a mismatch between the way network interfaces are
looked for from network cards, and the way they are created:

- If a network card has a NAC address, it used in the search criteria to
  find the network interface
- When creating virtual interfaces, the MAC address is not specified in
  the creation parameters

This raises an exception when a virtual card has a MAC address:

- The virtual interface has been created without MAC address
- But the network card has one, so the interface is looked for using it
- The network interface is not found, so it's created
- An error is risen because an interface with the same name already
  exists

This patch sets the MAC address on the interface if it exists, no matter if
it is virtual or not.
2022-03-08 17:27:06 +01:00
Cyril Levis
18773a2dff
Merge pull request #204 from Solvik/fix/chriss/unnamed_network_interfaces
Unnamed network interfaces.
2022-03-08 10:56:21 +01:00
Christophe Simon
84a9aca141 Unnamed network interfaces.
Some interfaces do not have device (logical) name (eth0, for instance), such
as not connected network mezzanine cards in blade servers.

In such situations, the card will be named `unknown[0-9]`.
2022-03-07 17:18:35 +01:00
Christophe Simon
a7c6ae68e2
Merge pull request #177 from Solvik/176-netbox-2.9
support netbox >=2.9
2022-03-07 16:03:05 +01:00
Christophe Simon
0f210e16f2
Merge pull request #202 from Solvik/feature/chriss/disk_extended_information
Added disks extended attributes
2022-03-07 15:57:50 +01:00
Christophe Simon
e789619b34 Added disks extended attributes
This patch brings some of the physical and virtual drive attributes as
`custom_fields` to the disks inventory.

The goal is to have this information present to ease disks maintenance
when a drive becomes unavailable and its attributes can't be read anymore
from the RAID controller.

It also helps to standardize the extended disk attributes across the
different manufacturers.

As the disk physical identifers were not available under the correct
format (hexadecimal format using the `xml` output as opposed as `X:Y:Z` format
using the default `list` format), the command line parser has been
refactored to read the `list` format, rather than `xml` one in the
`omreport` raid controller parser.

As the custom fields have to be created prior being able to register
the disks extended attributes, this feature is only activated using the
`--process-virtual-drives` command line parameter, or by setting
`process_virtual_drives` to `true` in the configuration file.

The custom fields to create as `DCIM > inventory item` `Text` are described
below.

    NAME            LABEL                      DESCRIPTION
    mount_point     Mount point                Device mount point(s)
    pd_identifier   Physical disk identifier   Physical disk identifier in the RAID controller
    vd_array        Virtual drive array        Virtual drive array the disk is member of
    vd_consistency  Virtual drive consistency  Virtual disk array consistency
    vd_device       Virtual drive device       Virtual drive system device
    vd_raid_type    Virtual drive RAID         Virtual drive array RAID type
    vd_size         Virtual drive size         Virtual drive array size

In the current implementation, the disks attributes ore not updated: if
a disk with the correct serial number is found, it's sufficient to
consider it as up to date.

To force the reprocessing of the disks extended attributes, the
`--force-disk-refresh` command line option can be used: it removes all
existing disks to before populating them with the correct parsing.
Unless this option is specified, the extended attributes won't be
modified unless a disk is replaced.

It is possible to dump the physical/virtual disks map on the filesystem under
the JSON notation to ease or automate disks management. The file path has to
be provided using the `--dump-disks-map` command line parameter.
2022-03-02 15:53:38 +01:00
Christophe Simon
af9df9ab4b Fixed PSU power consumption calculation
When PSUs were found, the voltage value was never set, raising an
exception when trying to multiply current * voltage (float * None).

This patch reads per PSU voltage (with 230V as default) and define power
consumption from it.
2022-02-23 16:06:32 +01:00
Cyril LEVIS
b092079820
chore: add rpmenv config for rpm packaging as a virtualenv
https://github.com/kevinconway/rpmvenv
2022-02-23 14:50:45 +01:00
Cyril LEVIS
021c5db7d3
fix: add MANIFEST.in for packaging 2022-02-23 11:27:35 +01:00
Christophe Simon
1fc0aee929 Bumped version number
Those changes deserve a major release :)
2022-02-22 17:58:01 +01:00
Cyril Levis
7cfcd685f3
Merge pull request #201 from dailymotion/feat/cle/upstream_add_custom_fields_support
feat: add custom_fields support
2022-02-22 17:48:05 +01:00
Cyril LEVIS
d1ee380ffb
feat: add custom_fields suppport
```bash
$ netbox_agent -du --device.custom_fields="last_run=$(date),last_run_ts=$(date +'%s')"
```

obviously, custom_fields need to be create manually in netbox admin
2022-02-22 17:45:25 +01:00
Christophe Simon
305d4d41ec Various changes
- Added an option to specify an SSL CA certificates file to talk to the
  Netbox API
- Enhanced GPU expansion bays inventory: internal GPU (VGA) goes into
  the blade, external GPU (3D) goes into the expansion bay
- Unified the way expansion bays are managed (GPU and drive exansion
  bays)
- Started to refactor `network` module to make it more readable
- Dependencies in `setup.py` now reads its requirements from
  `requirements.txt` to avoid double maintenance
2022-02-22 14:51:58 +01:00
Christophe Simon
34c1619ce8 Merge remote-tracking branch 'origin/master' into 176-netbox-2.9 2022-02-21 18:09:25 +01:00
Christophe Simon
fcb038f4b6
Merge pull request #199 from dailymotion/fix/chriss/purge_remaining_devices
Added option to purge remaining devices
2022-02-21 11:36:39 +01:00
Christophe Simon
5d9602402b
Merge branch 'master' into fix/chriss/purge_remaining_devices 2022-02-15 10:34:50 +01:00
Christophe Simon
71c603620b
Merge pull request #2 from dailymotion/feature/chriss/external_drive_bay
Manage blade expansions as independent devices
2022-02-15 10:33:56 +01:00
Christophe Simon
2f09cf8d42 Manage blade expansions as independent devices
This patch adds the ability to detect and manage GPU and Disk expansion
bays, and either add their internal components into the device
corresponding to the blade server, or into a dedicated device.

It takes advantage of the work made by @cyrinux on GPU bays management, and
applies the same principle to the external disk bays, but harmonize the
inventory management:

- If no argument is specified on the command line, the GPU cards, RAID
  controllers and their attached disks are added in the blade device,
  and the device corresponding to an expansion device is deleted.
- If the `--expansion-as-device` option is specified on the command
  line, a dedicated device corresponding to the expansion bay is
  created, and the GPUs, RAID card and attached disks are removed from
  the blade device and added to the expansion device.
2022-02-14 14:37:02 +01:00
Christophe Simon
58775c0950 Added option to purge remaining devices
This patch adds an option to clear remaining devices in the context of a
new device replacing an old one with the same name but with a different
hardware.

The serial leading to the bug is described below:

- A first server is registered under name `A` with serial `X`
- A second server is registered under name `B` with serial `Y`
- The server with serial `X` is decomissionned, but not removed
- The server with serial `Y` is reinstalled with name `A`

In this case, a device with serial `X` is well found, and netbox agent
tries to update its name. But this raises an error because of the unique
constraint on name, as another device already holds this name.

The proposed solution to handle this situation is to delete any device
with same `name` but different `serial` before handling a device.

As this is not necessarily the expected behavior, it can be enabled by
using the `--purge-old-devices` to avoid breaking existing inventory.
2022-02-08 18:46:30 +01:00
Cyrinux
8a46af19b8
Fix a crash when missing rack id (#172) 2021-07-20 21:55:47 +02:00
ramnes
bdc450ef6a Make flake8 and isort happy 2021-07-09 11:10:43 +02:00
Cyril Levis
794f9787f0 NVME inventory fix.
The inventory crash with default nvme-cli version 1.8.1 on Centos7.
2021-07-09 11:00:41 +02:00
Solvik Blum
86527af1c0 lint 2021-05-18 13:59:04 +02:00
Solvik Blum
b738f4bfef fix last few bugs due to pynetbox 6 upgrade 2021-05-14 10:00:50 +02:00
Solvik Blum
aaea0a2477 fix ipv6 cleanup on interface with only one ipv6 and not ipv4 2021-05-12 20:11:20 +02:00
Solvik Blum
9eafcbf215 this MR will drop compatibility with versions < 2.9 2021-05-12 19:41:35 +02:00
Solvik Blum
95d7f98389 add new dependencies 2021-05-12 19:41:35 +02:00
Solvik Blum
576eb07dd7 make inventory compatible 2021-05-12 19:41:01 +02:00
Solvik Blum
337e272eea fix ipv6 deletion with regex 2021-05-12 19:41:01 +02:00
Solvik Blum
a1af028df6 last commit is based on pynetbox >= 6.1 2021-05-12 19:41:01 +02:00
Solvik Blum
58c18fc2da add more compatibility, now to netbox 2.10 2021-05-12 19:41:01 +02:00
Solvik Blum
3639662961 ignore tag update for Netbox version >= 2.8 2021-05-12 19:41:01 +02:00
Solvik Blum
1d98d3c8e9 fix ip association 2021-05-12 19:41:01 +02:00
Solvik Blum
dc582b5de6 change .interface foreignkey with .assigned_object 2021-05-12 19:41:01 +02:00
renovate[bot]
51efa8edba
Update dependency jsonargparse to v3 (#179)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-05-12 15:50:28 +02:00
Solvik
c4eb8f34ac
add 25G compatibility (#185) 2021-05-12 15:50:16 +02:00
renovate[bot]
7147670255
Update dependency pyyaml to v5.4.1 (#181)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-03-26 16:00:40 +01:00
Mark David
9e934af835
Remove an invalid character (#182)
Invalid character that causes some errors to throw if you're copying and pasting the config
2021-02-15 10:54:47 +01:00
Laurent Marchaud
2a1196b52d
Add support for Supermicro TwinPro devices (#180) 2020-12-18 17:23:37 +01:00
Solvik
77a84b365f
fix ugly supermicro blade support (#178) 2020-12-15 11:32:11 +01:00
Cyrinux
0f2cb531ae
Fix inventory crash on nvme binary too old or absent (#170)
* When nvme binary absent or too old and no json output, this crash the inventory, i prefer just pass nvme inventory and continue

* log if nvme-cli is not installed
2020-10-14 12:40:19 +02:00
Cyrinux
00653628c6
Truncate GPU product name to 50 characteres. (#169)
Example: Hi1710 [iBMC Intelligent Management system chip w/VGA support]
This product is too long, the api want max_length = 50 ...
2020-10-14 12:39:57 +02:00
Cyrinux
7999244096
Check if lldpctl present, and log debug if no lldpctl output. (#171) 2020-10-14 12:39:40 +02:00
Cyrinux
137728be1f
Add "ProLiant BL460c Gen10 Graphics Exp" support and GPU expansion bay (#165)
* Add "ProLiant BL460c Gen10 Graphics Exp"

* Add GPU expansion support for HP_ProLiant_BL460c_Gen10_Graphics_Exp

* Add ProLiant BL460c Graphics Expansion Blade support in README

* Dont crash if vendor other than HP

* Typo
2020-09-18 12:29:17 +02:00
Cyrinux
0fe17c9687
Add GPU inventory support (#164)
* Add GPU support

* Some update in the doc
2020-09-18 12:29:05 +02:00
Anton A. Grishin
28955612be
fix allocated_draw for inactive PSU (#168)
Co-authored-by: Anton Grishyn <grishin@maxpay.com>
2020-09-07 14:20:32 +02:00