R
R
ramazan2017-05-26 15:05:16
PHP
ramazan, 2017-05-26 15:05:16

How to properly filter such an element?

I use the PhpZabbixApi library
In the API methods have a filter parameter .

Return only results that exactly match the specified filter.
Accepts an array where keys are property names and values, either a single value or an array of match values.
Doesn't work with text fields.

For some reason it doesn't work for me in all cases.
For example, this works as expected:
$maps = $api->mapGet(array(
            'output' => array('sysmapid', 'name'),
            'selectSelements' => array('elementid'),
            'filter' => array('sysmapid' => '2')));
echo (serialize($maps));

I receive
array (
  0 => 
  stdClass::__set_state(array(
     'sysmapid' => '2',
     'name' => 'Local network',
     'selements' => 
    array (
      0 => 
      stdClass::__set_state(array(
         'elementid' => '10017',
      )),
      1 => 
      stdClass::__set_state(array(
         'elementid' => '0',
      )),
    ),
  )),
)

And when I try to filter by elementid in the same way, the filter is ignored: $maps =
$api->mapGet(array(
            'output' => array('sysmapid', 'name'),
            'selectSelements' => array('elementid'),
            'filter' => array('elementid' => '10017')));

How to filter by elementid?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question