[Kea-users] Kea lease4-get-all via kea-ctrl-agent

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Kea-users] Kea lease4-get-all via kea-ctrl-agent

peters
Hello,

I have the paid hooks. I'm using MySQL as a backend and it's working fine. Now I am trying to get the kea-ctrl agent to behave using curl. I've started the daemon, which I think is ok. This works:

# curl -X POST -H "Content-Type: application/json" -d '{ "command": "list-commands"}' http://127.0.0.1:8080  | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   449  100   420  100    29   389k  27566 --:--:-- --:--:-- --:--:--  410k
[
  {
    "arguments": [
      "build-report",
      "config-get",
      "config-test",
      "config-write",
      "lease4-add",
      "lease4-del",
      "lease4-get",
      "lease4-get-all",
      "lease4-get-page",
      "lease4-update",
      "lease4-wipe",
      "lease6-add",
      "lease6-del",
      "lease6-get",
      "lease6-get-all",
      "lease6-get-page",
      "lease6-update",
      "lease6-wipe",
      "list-commands",
      "reservation-add",
      "reservation-del",
      "reservation-get",
      "shutdown",
      "version-get"
    ],
    "result": 0
  }
]

This does not though:

# curl -X POST -H "Content-Type: application/json" -d '{ "command": "lease4-get-all"}' http://127.0.0.1:8080  | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    98  100    68  100    30   5691   2511 --:--:-- --:--:-- --:--:--  6181
[
  {
    "result": 1,
    "text": "no current lease manager is available"
  }
]

I have 1.5.0 of kea and hooks, and I think according to this page, I should be able to get all leases if I don't specify any arguements:


I see this error in the kea-ctrl-agent log:

2020-03-03 01:22:32.053 ERROR [kea-ctrl-agent.callouts/26800] HOOKS_CALLOUT_ERROR error returned by callout on hook 1 registered by library with index
$lease4_get_all (callout address 0x7f172e322b40) (callout duration 0.059 ms)

Any help much appreciated!  Thanks for helping create such a great service!

All the best,
Pete


_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Kea lease4-get-all via kea-ctrl-agent

TroYy
It seems that you must include "service" which you want to be asked

So

curl -X POST -H "Content-Type: application/json" -d '{ "command":
"lease4-get-all", "service": [ "dhcp4" ] }' http://127.0.0.1:8080  | jq

should work



--
Sent from: http://kea-users.7364.n8.nabble.com/
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Kea lease4-get-all via kea-ctrl-agent

peters
Hello,

Thanks for the suggestion, unfortunately it doesn't seem to work either :(

 curl -X POST -H "Content-Type: application/json" -d '{ "command": "lease4-get-all", "service": [ "dhcp4" ]}' http://127.0.0.1:8080  | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   122  100    68  100    54  53042  42121 --:--:-- --:--:-- --:--:-- 68000
[
  {
    "result": 1,
    "text": "no current lease manager is available"
  }
]

2020-03-03 09:23:09.258 ERROR [kea-ctrl-agent.callouts/26800] HOOKS_CALLOUT_ERROR error returned by callout on hook 1 registered by library with index
$lease4_get_all (callout address 0x7f172e322b40) (callout duration 0.086 ms)

On Tue, 3 Mar 2020 at 08:16, TroYy <[hidden email]> wrote:
It seems that you must include "service" which you want to be asked

So

curl -X POST -H "Content-Type: application/json" -d '{ "command":
"lease4-get-all", "service": [ "dhcp4" ] }' http://127.0.0.1:8080  | jq

should work



--
Sent from: http://kea-users.7364.n8.nabble.com/
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Kea lease4-get-all via kea-ctrl-agent

Marcin Siodelski
Peter,

Apparently you configured your Kea Control Agent rather than DHCP server
to load the hooks libraries. Can you please confirm?

The lease-cmds hooks library must be loaded from within the Kea DHCP
server configuration, i.e. kea-dhcp4.conf rather than
kea-ctrl-agent.conf. The "service" parameter must be present in all
commands sent to the DHCP servers.

Marcin Siodelski
Sr. Software Engineer
ISC

On 03/03/2020 09:24, Peter Simm wrote:

> Hello,
>
> Thanks for the suggestion, unfortunately it doesn't seem to work either :(
>
>  curl -X POST -H "Content-Type: application/json" -d '{ "command":
> "lease4-get-all", "service": [ "dhcp4" ]}' http://127.0.0.1:8080  | jq
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time
>  Current
>                                  Dload  Upload   Total   Spent    Left
>  Speed
> 100   122  100    68  100    54  53042  42121 --:--:-- --:--:-- --:--:--
> 68000
> [
>   {
>     "result": 1,
>     "text": "no current lease manager is available"
>   }
> ]
>
> 2020-03-03 09:23:09.258 ERROR [kea-ctrl-agent.callouts/26800]
> HOOKS_CALLOUT_ERROR error returned by callout on hook 1 registered by
> library with index
> $lease4_get_all (callout address 0x7f172e322b40) (callout duration 0.086 ms)
>
> On Tue, 3 Mar 2020 at 08:16, TroYy <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     It seems that you must include "service" which you want to be asked
>
>     So
>
>     curl -X POST -H "Content-Type: application/json" -d '{ "command":
>     "lease4-get-all", "service": [ "dhcp4" ] }' http://127.0.0.1:8080  | jq
>
>     should work
>
>
>
>     --
>     Sent from: http://kea-users.7364.n8.nabble.com/
>     _______________________________________________
>     Kea-users mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://lists.isc.org/mailman/listinfo/kea-users
>
>
> _______________________________________________
> Kea-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/kea-users
>

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Kea lease4-get-all via kea-ctrl-agent

peters
In reply to this post by peters
Thanks Marcin (and indeed everybody)! That was exactly the issue.

I really appreciate your help and patience with what was basically user error!

# curl -X POST -H "Content-Type: application/json" -d '{ "command": "lease4-get-all", "service": [ "dhcp4" ]}' http://127.0.0.1:8080 2>/dev/null  | jq 2>&1 | grep text
    "text": "1243 IPv4 lease(s) found."

All the best,
Pete!

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users