Reply
Highlighted
Accepted Solution

Retrieve DHCP History Via WAPI

bradm
Techie
Posts: 4
6532     0

Is there a way to retrieve either the last 5 IP addresses assigned to a specific remoteid or mac address, or a list of the IP addresses assigned to a specific remoteid or mac address over the past 30 days?  Ideally I would like to use the WAPI so that I could easily mimic the other WAPI calls I currently use. 

Re: Retrieve DHCP History Via WAPI

Authority
Posts: 25
6533     0

I don't see anything in WAPI that would help you.

Re: Retrieve DHCP History Via WAPI

Moderator BRampling
Moderator
Posts: 69
6533     0

We don't provide a general API to access Lease History data. You can download the lease history through the PAPI like this:

 

$session->export_data(
     type   => "lease_history",
     path   => "/tmp/infoblox/lease_history.gz",
     start_time  => "2005/09/01 00:00:00",
     end_time    => "2005/09/01 11:59:59" );

You can then parse the lease history file on the client side. I don't believe the same thing is accessible through the WAPI. 

Re: Retrieve DHCP History Via WAPI

bradm
Techie
Posts: 4
6533     0

Thank you. We may give that a try. It would be very helpful to be able to pull that via the WAPI to display that history.

Re: Retrieve DHCP History Via WAPI

JBarisa
Techie
Posts: 1
6533     0

What about page 379 of WAPI 2.7 as one of the fileops

 

(download) getleasehistoryfiles

 

couldn't you compose a curl command to pull the results directly down?

Re: Retrieve DHCP History Via WAPI

[ Edited ]
spai
Techie
Posts: 1
6533     0

Hope this helps

 

Please note to use epoch time in start_time and end_time

 

curl -k -u username:password -H 'content-type: application/json' -X POST "https://x.x.x.x/wapi/v2.6/fileop?_function=getleasehistoryfiles" -d '{"member":"infoblo.member.com", "start_time": 1543775400, "end_time": 1543948200}'

 

Output

 

{

    "token": "eJytUbFuwyAQ3fmRdAk2tnFMt1Ru1EpRIiWVOp5swA6SDRRwlPTrC5XatUsH0HHv3r27B+fG3sHJ\nEcWLG+2DW3gwDlmCHrjSg+knc8NGy3TC3UqP2i50cJIDsgXiAP2ipqA0ABKKB2RL9CBshc4rebPK\n3SGoWa6QpWhHaFUyRmvaYMbqhpYE+fNqcVOE60i4hGD9Y5aRHDclJjUu8izlQKg4XIBBTRKUyZz8\nACXW7fH9sD9u2zUpcprXVU4bxsqqrDJx4XYvOy9flI/L3DH3Vzx+RplNUlQiRk0U/KtRLGOJIOLG\nMSZ55GSpYzfKLMz2v6cj5EcNpOZGKD2mbBFln14PKSx/C2Yjkq0kOd1u37Zwet6lN0U+nCyp0y+Q\nTQQHJSfhIRjgZrad+2Y16JCM6DsLStslwFU6r4xOGItYj78AL/qnKg==\n",

    "url": "https://x.x.x.x/http_direct_file_io/req_id-DOWNLOAD-1205064058993434/dhcpLeaseHistory.csv.gz"

}%    

 

Use the above url from token to download the file. 

 

curl -k -u admin:infoblox -H "Content-type:application/force-download" -O https://x.x.x.x/http_direct_file_io/req_id-DOWNLOAD-1205064058993434/dhcpLeaseHistory.csv.gz

 

output

 

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   902  100   902    0     0    799      0  0:00:01  0:00:01 --:--:--   800

Showing results for 
Search instead for 
Do you mean 

Recommended for You