Module: Wazuh::Api::Endpoints::Cluster

Included in:
Wazuh::Api::Endpoints, V4::Cluster
Defined in:
lib/wazuh/api/endpoints/cluster.rb

Instance Method Summary collapse

Instance Method Details

#analysisd_stats(node_id) ⇒ Object

Get node node_id’s analysisd stats

Parameters:

  • node_id


163
164
165
# File 'lib/wazuh/api/endpoints/cluster.rb', line 163

def analysisd_stats(node_id)
  get "/cluster/#{node_id}/stats/analysisd"
end

#check_configurationObject

Check Wazuh configuration in all cluster nodes



37
38
39
# File 'lib/wazuh/api/endpoints/cluster.rb', line 37

def check_configuration
  get "/cluster/configuration/validation"
end

#check_configuration_by_node(node_id) ⇒ Object

Check Wazuh configuration in a cluster node



30
31
32
# File 'lib/wazuh/api/endpoints/cluster.rb', line 30

def check_configuration_by_node(node_id)
  get "/cluster/#{node_id}/configuration/validation"
end

#cluster_configuration(options = {}) ⇒ Object

Returns the cluster configuration.



23
24
25
# File 'lib/wazuh/api/endpoints/cluster.rb', line 23

def cluster_configuration(options = {})
  get "/cluster/config", options
end

#cluster_healthcheck(options = {}) ⇒ Object

Show cluster health

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):



98
99
100
# File 'lib/wazuh/api/endpoints/cluster.rb', line 98

def cluster_healthcheck(options = {})
  get '/cluster/healthcheck', options
end

#cluster_logs_by_node(node_id, options) ⇒ Object

Get ossec.log from a specific node in cluster

Parameters:

  • node_id
  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :offset (offset)

    First element to return in the collection.

  • :limit (limit)

    Maximum number of elements to return.

  • :sort (sort)

    Sorts the collection by a field or fields (separated by comma). Use +/- at the beginning to list in ascending or descending order.

  • :search (search)

    Looks for elements with the specified string.

  • :type_log (type_log)

    Filters by type of log. Allowed values: all, error, warning, info

  • :category (category)

    Filters by category of log



118
119
120
# File 'lib/wazuh/api/endpoints/cluster.rb', line 118

def cluster_logs_by_node(node_id, options)
  offset_request("get", "/cluster/#{node_id}/logs", options)
end

#cluster_logs_summary_by_node(node_id) ⇒ Object

Get summary of ossec.log from a specific node in cluster

Parameters:

  • node_id


125
126
127
# File 'lib/wazuh/api/endpoints/cluster.rb', line 125

def cluster_logs_summary_by_node(node_id)
  get "/cluster/#{node_id}/logs/summary"
end

#cluster_statusObject

Get info about cluster status



77
78
79
# File 'lib/wazuh/api/endpoints/cluster.rb', line 77

def cluster_status
  get '/cluster/status'
end

#component_configuration_by_node(node_id, component, configuration, options = {}) ⇒ Object

Returns the requested configuration in JSON format.



9
10
11
# File 'lib/wazuh/api/endpoints/cluster.rb', line 9

def component_configuration_by_node(node_id, component, configuration, options = {})
  get "/cluster/#{node_id}/config/#{component}/#{configuration}", options
end

#configuration_by_node(node_id, options = {}) ⇒ Object

Returns ossec.conf in JSON format.



16
17
18
# File 'lib/wazuh/api/endpoints/cluster.rb', line 16

def configuration_by_node(node_id, options = {})
  get "/cluster/#{node_id}/configuration", options
end

#delete_remote_file(node_id, options) ⇒ Object

Delete a remote file in a cluster node

Parameters:

  • node_id
  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :path (path)

    Relative path of file. This parameter is mandatory.

See Also:



47
48
49
# File 'lib/wazuh/api/endpoints/cluster.rb', line 47

def delete_remote_file(node_id, options)
  delete "/cluster/#{node_id}/files", options
end

#get_remote_file(node_id, options) ⇒ Object

Get local file from any cluster node

Parameters:

  • node_id
  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :path (path)

    Relative path of file. This parameter is mandatory.

  • :validation (validation)

    Validates the content of the file. An error will be returned if file content is not strictly correct. False by default.



58
59
60
# File 'lib/wazuh/api/endpoints/cluster.rb', line 58

def get_remote_file(node_id, options)
  get "/cluster/#{node_id}/files", options
end

#local_nodeObject

Get local node info



131
132
133
# File 'lib/wazuh/api/endpoints/cluster.rb', line 131

def local_node
  get '/cluster/node'
end

#node(node_name) ⇒ Object

Get node info



137
138
139
# File 'lib/wazuh/api/endpoints/cluster.rb', line 137

def node(node_name)
  get "/cluster/nodes/#{node_name}"
end

#node_info(node_id) ⇒ Object

Get node_id’s information

Parameters:

  • node_id


91
92
93
# File 'lib/wazuh/api/endpoints/cluster.rb', line 91

def node_info(node_id)
  get "/cluster/#{node_id}/info"
end

#node_status(node_id) ⇒ Object

Get node node_id’s status

Parameters:

  • node_id


84
85
86
# File 'lib/wazuh/api/endpoints/cluster.rb', line 84

def node_status(node_id)
  get "/cluster/#{node_id}/status"
end

#nodes(options = {}) ⇒ Object

Get nodes info



143
144
145
# File 'lib/wazuh/api/endpoints/cluster.rb', line 143

def nodes(options = {})
  offset_request('get', '/cluster/nodes', options)
end

#nodes_stats(node_id, options) ⇒ Object

Get node node_id’s stats

Parameters:

  • node_id
  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :data (data)

    Selects the date for getting the statistical information. Format: YYYYMMDD



179
180
181
# File 'lib/wazuh/api/endpoints/cluster.rb', line 179

def nodes_stats(node_id, options)
  get "/cluster/#{node_id}/stats", options
end

#nodes_stats_by_hourly(node_id) ⇒ Object

Get node node_id’s stats by hour

Parameters:

  • node_id


186
187
188
# File 'lib/wazuh/api/endpoints/cluster.rb', line 186

def nodes_stats_by_hourly(node_id)
  get "/cluster/#{node_id}/stats/hourly"
end

#nodes_stats_by_weekly(node_id) ⇒ Object

Get node node_id’s stats by weekly

Parameters:

  • node_id


193
194
195
# File 'lib/wazuh/api/endpoints/cluster.rb', line 193

def nodes_stats_by_weekly(node_id)
  get "/cluster/#{node_id}/stats/weekly"
end

#remoted_stats(node_id) ⇒ Object

Get node node_id’s remoted stats

Parameters:

  • node_id


170
171
172
# File 'lib/wazuh/api/endpoints/cluster.rb', line 170

def remoted_stats(node_id)
  get "/cluster/#{node_id}/stats/remoted"
end

#restart_all_nodeObject

Restart all nodes in cluster



156
157
158
# File 'lib/wazuh/api/endpoints/cluster.rb', line 156

def restart_all_node
  put '/cluster/restart'
end

#restart_node(node_id) ⇒ Object

Restart a specific node in cluster

Parameters:

  • node_id


150
151
152
# File 'lib/wazuh/api/endpoints/cluster.rb', line 150

def restart_node(node_id)
  put "/cluster/#{node_id}/restart"
end

#update_remote_file(node_id, options) ⇒ Object

Update local file at any cluster node

Parameters:

  • node_id
  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :file (file)

    Input file.

  • :path (path)

    Relative path were input file will be placed. This parameter is mandatory.

  • :overwrite (overwrite)

    Replaces the existing file. False by default.



71
72
73
# File 'lib/wazuh/api/endpoints/cluster.rb', line 71

def update_remote_file(node_id, options)
  post "/cluster/#{node_id}/files", options
end