Skip to content

Commit

Permalink
adding other problem.get params
Browse files Browse the repository at this point in the history
Signed-off-by: Anastas Dancha <[email protected]>
  • Loading branch information
anapsix committed Jan 30, 2021
1 parent 2e620c9 commit 78820e8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
17 changes: 17 additions & 0 deletions examples/Problems.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,31 @@ filtered by `name`, and/or one of the following:
given applications. Applies only if object is trigger or item.
- `tags`: Return only problems with given tags. Exact match by tag and
case-insensitive search by value and operator.
- `eventid_from`: Return only problems with IDs greater or equal to the given
ID.
- `eventid_till`: Return only problems with IDs less or equal to the given ID.
- `time_from`: Return only problems that have been created after or at the given
time.
- `time_till`: Return only problems that have been created before or at the
given time.

See Zabbix API documentation for more details.

```ruby
# selecting by name (which is not unique)
zbx.problems.dump_by_id(
name: "Zabbix agent is not available (for 3m)"
)

# selecting by source eventids
zbx.problems.get(eventids: "86")

# selecting by source objectids
zbx.problems.get(objectids: "17884")

# selecting by timestamp
zbx.problems.get(time_from: 1611928989)
zbx.problems.get(time_till: 1611928989)
```

## Get all Problems
Expand Down
13 changes: 9 additions & 4 deletions lib/zabbixapi/classes/problems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ def get_full_data(data)
objectids: data[:objectids] || nil,
applicationids: data[:applicationids] || nil,
tags: data[:tags] || nil,
time_from: data[:time_from] || nil,
time_till: data[:time_till] || nil,
eventid_from: data[:eventid_from] || nil,
eventid_till: data[:eventid_till] || nil,
recent: data[:recent] || false,
sortfield: data[:sortfield] || ['eventid'],
sortorder: data[:sortorder] || 'DESC',
countOutput: data[:countOutput] || nil,
output: 'extend',
selectAcknowledges: 'extend',
selectTags: 'extend',
selectSuppressionData: 'extend',
recent: 'true',
sortfield: ['eventid'],
sortorder: 'DESC'
selectSuppressionData: 'extend'
}
)
end
Expand Down

0 comments on commit 78820e8

Please sign in to comment.