[ZBX-3134] "maintenance.create" fails to create maintenance Created: 2010 Oct 22  Updated: 2017 May 30  Resolved: 2011 Jun 09

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 1.8.3
Fix Version/s: 1.8.3, 1.8.5

Type: Incident report Priority: Minor
Reporter: Paul Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian Lenny
ZabbixAPI v1.0 php lib


Attachments: File class.cmaintenance.php    

 Description   

"auth":"0000000000000000000000000000","method":"maintenance.create","id":1,"params":{"hosts":[

{"hostid":"10052"}

],"description":"test","active_since":"1286576441","active_till":"1286590656","name":"test","maintenance_type":"0"},"jsonrpc":"2.0"

(with the auth obviously changed)gives an error

[ CMaintenance::create ] At least one host or group should be selected.

10052 definitely exists:

mysql> select hostid,host from hosts where hostid="10052";
-----------------------+

hostid host

-----------------------+

10052 tamarao.tvo.org

-----------------------+
1 row in set (0.00 sec)

Also, I can't seem to specify the maintenance period, is this a feature request or a documentation bug?



 Comments   
Comment by richlv [ 2011 Feb 08 ]

i seem to get the same on trunk
also, example at http://www.zabbix.com/documentation/2.0/manual/appendix/api/maintenance/create shows comma after the only host id - api returns "Invalid JSON. An error occurred on the server while parsing the JSON text." in such a case

Comment by gescheit [ 2011 Apr 25 ]

1.8.5 also affected. Get Error -32500: Application error., [ CMaintenance::create ] At least one host or group should be selected

Comment by gescheit [ 2011 Apr 27 ]

patch for maintenance.create

Comment by Paul [ 2011 Jun 07 ]

I applied the patch, thank you. I tried on both 1.8.3 and 1.8.5 and the maintenance window gets created, but no period is created. I am creating a second issue for this in ZBX-3867.

Comment by Paul [ 2011 Jun 08 ]

I should have specified, this is a blocker. The API call doesn't work at all.

Comment by Alexey Fukalov [ 2011 Jun 09 ]

It seems that api docs had example with error. Correct example is:
"params":[

{ "groupids":[], "hostids":["100100000010229"], "name":"ZABBIX Servers", "maintenance_type":"0", "description":"", "active_since":"1276163035", "active_till":"1307698980" }

]
groups -> groupids, hosts -> hostids, and its not object just arrays of ids.

Comment by Paul [ 2011 Jun 09 ]

I have confirmed this documentation fix applies to 1.8.3 and 1.8.5, I expect it applies to all versions.

ZBX-3867 is still an issue though.

Generated at Sun Aug 03 03:41:05 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.