Hello dear Observium Team,
I'm trying to add a device using the API and get an error 500 message instead of the expected notice that the device is not respondig to snmp.
curl -u korten:secret https://observium.domain.net/api/v0/devices/ -X
POST -d '{"hostname":"pe-lab02.domain.net", "snmp_community":"test", "ping_skip":"on"}'
<h1>500 Internal Server Error</h1><h3>flight\Engine::_json(): Argument #2 ($code) must be of type int, string given, called in /opt/observium/libs/flight3/core/Dispatcher.php on line 86 (0)</h3><pre>#0 /opt/observium/libs/flight3/core/Dispatcher.php(86): flight\Engine->_json() #1 /opt/observium/libs/flight3/core/Dispatcher.php(50): flight\core\Dispatcher->runEvent() #2 /opt/observium/libs/flight3/Engine.php(113): flight\core\Dispatcher->run() #3 [internal function]: flight\Engine->__call() #4 /opt/observium/libs/flight3/core/Dispatcher.php(287): call_user_func_array() #5 /opt/observium/libs/flight3/Flight.php(143): flight\core\Dispatcher::invokeMethod() #6 /opt/observium/html/api/v0/includes/devices.inc.php(133): Flight::__callStatic() #7 [internal function]: api_add_device() #8 /opt/observium/libs/flight3/core/Dispatcher.php(250): call_user_func_array() #9 /opt/observium/libs/flight3/core/Dispatcher.php(237): flight\core\Dispatcher::callFunction() #10 /opt/observium/libs/flight3/Engine.php(508): flight\core\Dispatcher::execute() #11 /opt/observium/libs/flight3/core/Dispatcher.php(86): flight\Engine->_start() #12 /opt/observium/libs/flight3/core/Dispatcher.php(50): flight\core\Dispatcher->runEvent() #13 /opt/observium/libs/flight3/Engine.php(113): flight\core\Dispatcher->run() #14 [internal function]: flight\Engine->__call() #15 /opt/observium/libs/flight3/core/Dispatcher.php(287): call_user_func_array() #16 /opt/observium/libs/flight3/Flight.php(143): flight\core\Dispatcher::invokeMethod() #17 /opt/observium/html/api/v0/index.php(66): Flight::__callStatic() #18 {main}</pre>
As far as I can see, the error is in:
api/v0/includes/devices.inc.php at line 133:
Flight::json($json, '400');
should be: Flight::json($json, 400);
Agree?
Thank you and have a nice day,
Nico
it looks like this is a php8 issue, we need to change all the places the codes are in quotes to being integer.
adam.
Nicolas Korten via observium wrote on 2024-06-24 13:33:
Hello dear Observium Team,
I'm trying to add a device using the API and get an error 500 message instead of the expected notice that the device is not respondig to snmp.
curl -u korten:secret https://observium.domain.net/api/v0/devices/
-X POST -d '{"hostname":"pe-lab02.domain.net", "snmp_community":"test", "ping_skip":"on"}'
<h1>500 Internal Server Error</h1><h3>flight\Engine::_json(): Argument #2 ($code) must be of type int, string given, called in /opt/observium/libs/flight3/core/Dispatcher.php on line 86 (0)</h3><pre>#0 /opt/observium/libs/flight3/core/Dispatcher.php(86): flight\Engine->_json() #1 /opt/observium/libs/flight3/core/Dispatcher.php(50): flight\core\Dispatcher->runEvent() #2 /opt/observium/libs/flight3/Engine.php(113): flight\core\Dispatcher->run() #3 [internal function]: flight\Engine->__call() #4 /opt/observium/libs/flight3/core/Dispatcher.php(287): call_user_func_array() #5 /opt/observium/libs/flight3/Flight.php(143): flight\core\Dispatcher::invokeMethod() #6 /opt/observium/html/api/v0/includes/devices.inc.php(133): Flight::__callStatic() #7 [internal function]: api_add_device() #8 /opt/observium/libs/flight3/core/Dispatcher.php(250): call_user_func_array() #9 /opt/observium/libs/flight3/core/Dispatcher.php(237): flight\core\Dispatcher::callFunction() #10 /opt/observium/libs/flight3/Engine.php(508): flight\core\Dispatcher::execute() #11 /opt/observium/libs/flight3/core/Dispatcher.php(86): flight\Engine->_start() #12 /opt/observium/libs/flight3/core/Dispatcher.php(50): flight\core\Dispatcher->runEvent() #13 /opt/observium/libs/flight3/Engine.php(113): flight\core\Dispatcher->run() #14 [internal function]: flight\Engine->__call() #15 /opt/observium/libs/flight3/core/Dispatcher.php(287): call_user_func_array() #16 /opt/observium/libs/flight3/Flight.php(143): flight\core\Dispatcher::invokeMethod() #17 /opt/observium/html/api/v0/index.php(66): Flight::__callStatic() #18 {main}</pre>
As far as I can see, the error is in:
api/v0/includes/devices.inc.php at line 133:
Flight::json($json, '400');
should be: Flight::json($json, 400);
Agree?
Thank you and have a nice day,
Nico
observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
Hi, thanks for replying!
it looks like this is a php8 issue, we need to change all the places the codes are in quotes to being integer.
Is it planned to support php8 do or do you recomend using an older php version?
Kind regards,
Nicolas
It's already fixed in SVN.
Thanks, adam.
Nicolas Korten via observium wrote on 2024-06-27 13:28:
Hi, thanks for replying!
it looks like this is a php8 issue, we need to change all the places the codes are in quotes to being integer.
Is it planned to support php8 do or do you recomend using an older php version?
Kind regards,
Nicolas
observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
Incredible! Thank you Adam.
Kind regards,
Nicolas
https://changelog.observium.org/2024/
It was done 2 days ago or so. I guess I forgot to reply originally.
:D
Nicolas Korten via observium wrote on 2024-06-27 13:46:
Incredible! Thank you Adam.
Kind regards,
Nicolas
observium mailing list -- observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org
Hi Adam
Please make sure Bill is copied in on these threads
Thanks
Ben
From: Adam Armstrong via observium (observium@lists.observium.org) observium@lists.observium.org Sent: 27 June 2024 16:20 To: Nicolas Korten via observium observium@lists.observium.org Cc: Adam Armstrong adama@observium.org Subject: [Observium] Re: API Error 500
https://changelog.observium.org/2024/
It was done 2 days ago or so. I guess I forgot to reply originally.
:D
Nicolas Korten via observium wrote on 2024-06-27 13:46:
Incredible! Thank you Adam.
Kind regards,
Nicolas
_______________________________________________ observium mailing list -- observium@lists.observium.org mailto:observium@lists.observium.org To unsubscribe send an email to observium-leave@lists.observium.org mailto:observium-leave@lists.observium.org
You sent it to me by mistake.
[cid:image001.png@01DB09CC.7E6813D0] בר רוסו | מערכות מידע מייל: barr@mgrp.co.ilmailto:barr@mgrp.co.il קבוצת Mgroup | אריאל שרון 8, אור יהודה www.mgrp.co.ilhttp://www.mgrp.co.il/
מאת: Ben.Kittow --- via observium observium@lists.observium.org נשלח: Wednesday, 18 September 2024 13:12 אל: 'Observium' observium@lists.observium.org; 'Bill Manthorp' bill.manthorp@thestreamingcompany.com עותק: 'Adam Armstrong' adama@observium.org; Ben.Kittow @thestreamingcompany.com Ben.kittow@thestreamingcompany.com נושא: [Observium] Re: API Error 500
Hi Adam
Please make sure Bill is copied in on these threads
Thanks
Ben
From: Adam Armstrong via observium (observium@lists.observium.orgmailto:observium@lists.observium.org) <observium@lists.observium.orgmailto:observium@lists.observium.org> Sent: 27 June 2024 16:20 To: Nicolas Korten via observium <observium@lists.observium.orgmailto:observium@lists.observium.org> Cc: Adam Armstrong <adama@observium.orgmailto:adama@observium.org> Subject: [Observium] Re: API Error 500
https://changelog.observium.org/2024/
It was done 2 days ago or so. I guess I forgot to reply originally.
:D
Nicolas Korten via observium wrote on 2024-06-27 13:46: Incredible! Thank you Adam.
Kind regards,
Nicolas
_______________________________________________
observium mailing list -- observium@lists.observium.orgmailto:observium@lists.observium.org
To unsubscribe send an email to observium-leave@lists.observium.orgmailto:observium-leave@lists.observium.org
participants (4)
-
Adam Armstrong
-
Bar Russo
-
Ben.Kittow @thestreamingcompany.com
-
Nicolas Korten