README.md in splunk-client-0.7.0 vs README.md in splunk-client-0.8.0
- old
+ new
@@ -4,10 +4,11 @@
## Features
* Session based authentication to Splunk REST interface
* Create and check on the status of Splunk Jobs
+* Retrieve Splunk alerts
* Natural Ruby methods for interacting with search results (no need to parse XML or JSON or use Ruby Hashes)
## Installation
gem install splunk-client
@@ -34,10 +35,33 @@
# Use ruby methods for dealing with results:
search.parsedResults.each do |result|
puts result.host + " : " + result.time
end
+Working with Splunk alerts:
+
+ # Create the client
+ splunk = SplunkClient.new("username", "password", "hostname")
+
+ # Fetch all the open alerts
+ alertEntries = splunk.get_alarm_list.entries
+
+ # What's the name of this alert?
+ alertEntries[1].alert.title
+
+ # What time did a particular alert trigger?
+ alertEntries[1].alert.trigger_time_rendered
+
+ # How many times has a particular alert fired?
+ alertEntries[1].alert.triggered_alerts
+
+ # Fetch the raw XML results of the alert
+ alertEntries[1].alert.results
+
+ # Work with the results as a Ruby object
+ alertEntries[1].alert.parsedResults
+
## Tips
* Want to spawn multiple jobs without blocking on each? Use `search.complete?` to poll for job status.
* Looking for more or less results? Use `search.results(maxResults)` to control how much is returned. (A value of 0 returns all results (this is the default.))
@@ -47,9 +71,15 @@
`result = search.parsedResults`
`puts result[0].fieldName`
## Revision History
+
+#### 0.8
+
+* Added preliminary GET support for alarms within the Splunk REST API
+
+TODO: Write test-cases for alerts methods.
#### 0.7
* Added alias support for raw field
* Added test cases for all Splunk meta fields
\ No newline at end of file