[ZBX-3419] API 1.8.4 usermacro:massAdd fails with Wrong macro Created: 2011 Jan 14 Updated: 2017 May 30 Resolved: 2012 Aug 24 |
|
| Status: | Closed |
| Project: | ZABBIX BUGS AND ISSUES |
| Component/s: | API (A) |
| Affects Version/s: | 1.8.4 |
| Fix Version/s: | None |
| Type: | Incident report | Priority: | Major |
| Reporter: | Alain Ganuchaud (Inactive) | Assignee: | Unassigned |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | api, macros | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Debian GNU/Linux 5.0.6 - Zabbix 1.8.4 - ZabbixAPI.class.php V1 |
||
| Description |
|
Hello, I updated zabbix with 1.8.4, I am using php scripts to do various things through APIs using zabbix-1-8-api-php-class-v1-0 from Andrew Farley. I can't get working one of them which creates macros at host level. API complains that macro begins with { ?? Thanks for help – Below is the php code ........... ZabbixAPI::query('usermacro','massAdd',array('host s'=>array('hostid'=>"$hid"),'macros'=>array('macro '=>"{\$ALERTLOGPATH}",'value'=>"/usr/lib/oracle/xe/app/oracle/admin/XE/bdump/alert_XE.log"))) Below is the Debug Output ............. CURL URL: https://server/api_jsonrpc.php [10036] => POST ,"macros":{"macro":"{$ALERTLOGPATH} ","value":"eeeeeeeee"}},"jsonrpc":"2.0"} ,"id":1}) [id] => 1 |
| Comments |
| Comment by hamid sfandiari [ 2011 Apr 24 ] |
|
i'm trying with the following : 'macros'=>array( 'hosts'=>array('hostid'=>'10558') but i've got : ,"id":1}) same as Alain any body have any idea? |
| Comment by richlv [ 2011 Apr 24 ] |
|
you could try doublequoting the actual macro; alain seems to have an extra trailing space in the macro : "{$ALERTLOGPATH} " |
| Comment by Joe Black [ 2012 Aug 03 ] |
|
Stuck with this for a few hours... you have to pass an array of macros: |
| Comment by Alexey Fukalov [ 2012 Aug 24 ] |
|
In 2.0 version massAdd method was removed. |