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

#4 2018-02-09 00:17:49

acdmail
Guest
Registered: 2018-02-09
Posts: 1

Re: Webservices > How to access IP adresses ?

hi,
Same question here using GLPI 9.1.7 and web services 1.7.1 despite the fact that in the documentation it is mentioned that it should return ip address no ip address is returned could you advise please how to return the ip address?

Thanks
Oleg

Offline

#5 2018-02-22 18:31:15

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 14,314

Re: Webservices > How to access IP adresses ?

this part Inventory was abandoned by the developer.
I must review all to check the problem


CentOS 6.5 - CentOS 7
PHP 5.6 - PHP 7 - MySQL 5.6  + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#6 2018-03-14 20:02:32

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 14,314

Re: Webservices > How to access IP adresses ?

Ticket opened on the forge: https://forge.glpi-project.org/issues/5556


CentOS 6.5 - CentOS 7
PHP 5.6 - PHP 7 - MySQL 5.6  + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#7 2018-03-14 20:08:24

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 14,314

Re: Webservices > How to access IP adresses ?

Corrected. You will have this correction tomorrow in the tarball: https://forge.glpi-project.org/tarballs-plugins/

If OK for you i will make a release rapidly.


CentOS 6.5 - CentOS 7
PHP 5.6 - PHP 7 - MySQL 5.6  + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#8 2018-03-16 17:52:28

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 14,314

Re: Webservices > How to access IP adresses ?

Version 1.7.1 release today


CentOS 6.5 - CentOS 7
PHP 5.6 - PHP 7 - MySQL 5.6  + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

Board footer

Powered by FluxBB