You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2017-08-01 09:25:17

stephben
Guest
Registered: 2017-07-17
Posts: 8

Webservices > How to access IP adresses ?

Hello,

I would like to read, add and modify IP adresses of my computer through the API
Basically, the goal is to synchronize GLPI with data from Zabbix, which is already broadly installed is our servers.

Using webservice plugin, I manage to get computer info. I can see the MAC adresses, but no IP !
Any ideas on how to get them, and how to add some IP to a new computer ?

Thanks a lot,
Stéphane

API call:

http://{{hostname}}/glpi/plugins/webservices/rest.php?method=glpi.getObject&session={{session}}&itemtype=Computer&id=10&with_infocom=1&with_networkport=1

{
    "name": "my-hostname",
    "id": "10",
    "locations_id": "0",
    "computertypes_id": "2",
    "computermodels_id": "2",
    "states_id": "0",
    "operatingsystems_id": "1",
    "operatingsystemversions_id": "2",
    "operatingsystemservicepacks_id": "0",
    "autoupdatesystems_id": "0",
    "operatingsystemarchitectures_id": "1",
    "uuid": "421A6201-6A65-49F7-E874-C71E3D02833A",
    "os_kernel_version": "3.10.0-229.el7.x86_64",
    "serial": "VMware-42 1a 62 01 6a 65 49 f7-e8 74 c7 1e 3d 02 83 3a",
    "otherserial": "No Asset Tag",
    "contact": "root",
    "users_id": "0",
    "groups_id": "0",
    "date_mod": "2017-07-31 15:51:43",
    "date_creation": "2017-07-31 15:51:43",
    "networks_id": "0",
    "domains_id": "0",
    "manufacturers_id": "11",
    "users_id_tech": "0",
    "groups_id_tech": "0",
    "entities_id": "0",
    "NetworkPort": {
        "8": {
            "name": "lo",
            "id": "8",
            "logical_number": "0",
            "mac": "00:00:00:00:00:00",
            "instantiation_type": "NetworkPortEthernet",
            "itemtype": "Computer",
            "items_id": "10"
        },
        "9": {
            "name": "ens32",
            "id": "9",
            "logical_number": "1",
            "mac": "00:50:56:9a:e8:17",
            "instantiation_type": "NetworkPortEthernet",
            "itemtype": "Computer",
            "items_id": "10"
        }
    }
}

I don't see any IP adresses. However, I have some from the frontend:

Network ports    Characteristics    Internet information
#    Name    Connected to    Ethernet port speed    MAC    IP addresses    IP networks

1    ens32   
Not connected.
Connect    1 Gbit/s    00:50:56:9a:e8:17    10.0.27.113    10.0.0.0 / 255.255.0.0 - 10.0.0.0/255.255.0.0 - 10.0.0.1

0    lo   
Not connected.
Connect    10 Mbit/s    00:00:00:00:00:00    127.0.0.1

Last edited by stephben (2017-08-01 09:25:32)

Offline

#2 2017-10-19 16:03:44

bvilliot
Guest
Registered: 2017-10-19
Posts: 1

Re: Webservices > How to access IP adresses ?

Hello,

I have exactly the same problem. In the following documentation it's said there is an IP key in the array returned : https://forge.glpi-project.org/projects … tworkports.

Did you find another way to get or modify IP ?

Thank you,

Offline

#3 2017-10-19 16:27:58

stephben
Guest
Registered: 2017-07-17
Posts: 8

Re: Webservices > How to access IP adresses ?

Not at all ..
I think in the most recent version it's quite compliquated between IP adresse, IP network and so on ...

I started to dig from the database itself ... however, it's not that simple, plenty of tables.

Offline

Board footer

Powered by FluxBB