An object to allow repetitive search against a string, searchme, without having to repeatedly recreate the regex.
Parameters: | timestring – An strftime pattern |
---|
Return the epoch timestamp extracted from the timestring appearing in searchme.
Parameters: | searchme – A string to be searched for a date pattern that matches timestring |
---|---|
Return type: | int |
Return a formatted string indicating the size in bytes, with the proper unit, e.g. KB, MB, GB, TB, etc.
Parameters: |
|
---|---|
Return type: | float |
Some of the curator methods should not operate against multiple indices at once. This method can be used to check if a list or csv has been sent.
Parameters: | value – The value to test, if list or csv string |
---|---|
Return type: | bool |
Check if connected client is the elected master node of the cluster. If not, cleanly exit with a log message.
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | None |
Verify version is within acceptable range. Raise an exception if it is not.
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | None |
This utility chunks very large index lists into 3KB chunks It measures the size as a csv string, then converts back into a list for the return value.
Parameters: | indices – A list of indices to act on. |
---|---|
Return type: | list |
Build the ‘body’ portion for use in creating a repository.
Parameters: |
|
---|---|
Returns: | A dictionary suitable for creating a repository from the provided arguments. |
Return type: | dict |
Create repository with repository and body settings
Parameters: |
|
---|---|
Returns: | A boolean value indicating success or failure. |
Return type: | bool |
Create the request body for creating a snapshot from the provided arguments.
Parameters: |
|
---|---|
Return type: | dict |
Get the epoch start time and end time of a range of unit``s, reckoning the start of the week (if that's the selected unit) based on ``week_starts_on, which can be either sunday or monday.
Parameters: |
|
---|---|
Return type: | tuple |
Return a list, even if indices is a single value
Parameters: | indices – A list of indices to act upon |
---|---|
Return type: | list |
Check if there is snapshot activity in the Tasks API. Return True if activity is found, or False
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | bool |
Fix value of epoch to be epoch, which should be 10 or fewer digits long.
Parameters: | epoch – An epoch timestamp, in epoch + milliseconds, or microsecond, or even nanoseconds. |
---|---|
Return type: | int |
NOTE: AWS IAM parameters aws_key, aws_secret_key, and aws_region are provided for future compatibility, should AWS ES support the /_cluster/state/metadata endpoint. So long as this endpoint does not function in AWS ES, the client will not be able to use curator.indexlist.IndexList, which is the backbone of Curator 4
Return an elasticsearch.Elasticsearch client object using the provided parameters. Any of the keyword arguments the elasticsearch.Elasticsearch client object can receive are valid, such as:
Parameters: |
|
---|---|
Return type: | elasticsearch.Elasticsearch |
Return a regex string based on a provided strftime timestring.
Parameters: | timestring – An strftime pattern |
---|---|
Return type: | str |
Return the datetime extracted from the index name, which is the index creation time.
Parameters: |
|
---|---|
Return type: | datetime.datetime |
Get the current list of indices from the cluster.
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | list |
Get a point-of-reference timestamp in epoch + milliseconds by deriving from a unit and a count, and an optional reference timestamp, epoch
Parameters: |
|
---|---|
Return type: | int |
Return configuration information for the indicated repository.
Parameters: |
|
---|---|
Return type: | dict |
Return information about a snapshot (or a comma-separated list of snapshots) If no snapshot specified, it will return all snapshots. If none exist, an empty dictionary will be returned.
Parameters: |
|
---|---|
Return type: | dict |
Get _all snapshots from repository and return a list.
Parameters: |
|
---|---|
Return type: | list |
Return the ES version number as a tuple. Omits trailing tags like -dev, or Beta
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | tuple |
Read the file identified by path and import its YAML contents.
Parameters: | path – The path to a YAML configuration file. |
---|---|
Return type: | dict |
This function calls client.cluster.health and, based on the args provided, will return True or False depending on whether that particular keyword appears in the output, and has the expected value. If multiple keys are provided, all must match for a True response.
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|
Return True if the connected client node is the elected master node in the Elasticsearch cluster, otherwise return False.
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | bool |
Return the node_id of the node identified by name
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | str |
Return the name of the node identified by node_id
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | str |
Return the list of roles assigned to the node identified by node_id
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | list |
Scan and parse name for time.strftime() strings, replacing them with the associated value when found, but otherwise returning lowercase values, as uppercase snapshot names are not allowed. It will detect if the first character is a <, which would indicate name is going to be using Elasticsearch date math syntax, and skip accordingly.
The time.strftime() identifiers that Curator currently recognizes as acceptable include:
Parameters: | name – A name, which can contain time.strftime() strings |
---|
Remove keys from mydict whose values are None
Parameters: | mydict – The dictionary to act on |
---|---|
Return type: | dict |
Read a file and return the resulting data.
Parameters: | myfile – A file to read. |
---|---|
Return type: | str |
Raise a FailedExecution exception and include the original error message.
Parameters: | exception – The upstream exception. |
---|---|
Return type: | None |
Verify the existence of a repository
Parameters: |
|
---|---|
Return type: | bool |
This function calls client.indices.recovery with the list of indices to check for complete recovery. It will return True if recovery of those indices is complete, and False otherwise. It is designed to fail fast: if a single shard is encountered that is still recovering (not in DONE stage), it will immediately return False, rather than complete iterating over the rest of the response.
Parameters: |
|
---|
Ensure that alias is an alias, and points to an index that can use the _rollover API.
Parameters: |
|
---|
Ensure there are no snapshots in progress. Pause and retry accordingly
Parameters: |
|
---|---|
Return type: | bool |
Log dry run output with the action which would have been executed.
Parameters: |
|
---|
In order for a shrink to work, it should be on a single filesystem, as shards cannot span filesystems. Return True if the node has a single filesystem, and False otherwise.
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | bool |
This function calls client.snapshot.get and tests to see whether the snapshot is complete, and if so, with what status. It will log errors according to the result. If the snapshot is still IN_PROGRESS, it will return False. SUCCESS will be an INFO level message, PARTIAL nets a WARNING message, FAILED is an ERROR, message, and all others will be a WARNING level message.
Parameters: |
|
---|
Determine whether the provided snapshot in repository is IN_PROGRESS. If no value is provided for snapshot, then check all of them. Return snapshot if it is found to be in progress, or False
Parameters: |
|
---|
Return True if a snapshot is in progress, and False if not
Parameters: | client – An elasticsearch.Elasticsearch client object |
---|---|
Return type: | bool |
This function calls client.tasks.get with the provided task_id. If the task data contains 'completed': True, then it will return True If the task is not completed, it will log some information about the task and return False
Parameters: |
|
---|
Test whether a SSL/TLS files exist. Will raise an exception if the files cannot be read.
Parameters: | config – A client configuration file data dictionary |
---|---|
Return type: | None |
Test whether all nodes have write access to the repository
Parameters: |
|
---|
Return a csv string from a list of indices, or a single value if only one value is present
Parameters: | indices – A list of indices to act on, or a single value, which could be in the format of a csv string already. |
---|---|
Return type: | str |
Validate an Action configuration dictionary, as imported from actions.yml, for example.
The method returns a validated and sanitized configuration dictionary.
Parameters: | data – The configuration dictionary |
---|---|
Return type: | dict |
Validate that the filters are appropriate for the action type, e.g. no index filters applied to a snapshot list.
Parameters: |
|
---|
Test if test is a proper elasticsearch.Elasticsearch client object and raise an exception if it is not.
Parameters: | test – The variable or object to test |
---|---|
Return type: | None |
Test if test is a proper curator.indexlist.IndexList object and raise an exception if it is not.
Parameters: | test – The variable or object to test |
---|---|
Return type: | None |
Test if test is a proper curator.snapshotlist.SnapshotList object and raise an exception if it is not.
Parameters: | test – The variable or object to test |
---|---|
Return type: | None |
This function becomes one place to do all wait_for_completion type behaviors
Parameters: |
|
---|
Validate config with the provided voluptuous schema. test_what and location are for reporting the results, in case of failure. If validation is successful, the method returns config as valid.
Parameters: |
|
---|