---
name: "Zabbix::API::Macro"
section: "3pm"
platform: "linux"
package: "libzabbix-api-perl"
version: "0.009-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/Zabbix::API::Macro"
---

# Zabbix::API::Macro(3pm)

## NAME

Zabbix::API::Macro -- Zabbix usermacro objects

## SYNOPSIS

```
  use Zabbix::API::Macro;
  # TODO write the rest
```

## DESCRIPTION

Handles CRUD for Zabbix usermacro objects.

Both global and host macro types are represented by this class.  If the `"hosts"` arrayref attribute is undef or empty, then we assume it's a global macro.

This class' methods work transparently around the weird Zabbix macro API, which uses different methods on the same object depending on whether it's a global or host macro... except sometimes, for instance the `"usermacro.get"` method which can be called on both and will return different keys...  And macros don't seem to have an `"exists"` method.  It's kind of a mess.

The various massFoo methods have not been implemented at all because I did not have a use for their "mass" functionality, despite their being the only way to CRUD host macros.

## METHODS

- prefix(\[SUFFIX\])

  This class' `"prefix"` method is **not** a class method.  The prefix returned depends on the type of macro (global or host) which is a characteristic of an instance.

- host(\[HOST\])

  Mutator for the macro's host.  `"HOST"` should be a `"Host"` instance or a hashref with a `"hostid"` key.

- *globalp()*

  Return a true value when the macro is global, a false value otherwise.

## SEE ALSO

TODO links to other pods and documentation

## AUTHOR

Fabrice Gabolde \<fabrice.gabolde@uperto.com\>

## COPYRIGHT AND LICENSE

Copyright (C) 2011 SFR

This library is free software; you can redistribute it and/or modify it under the terms of the GPLv3.
