Skip to content

Commit

Permalink
Add packetbeat.yaml.j2 template to use yaml
Browse files Browse the repository at this point in the history
- requested by #5
  • Loading branch information
monicasarbu committed Apr 9, 2015
1 parent 5ee85ca commit 425066a
Showing 1 changed file with 212 additions and 0 deletions.
212 changes: 212 additions & 0 deletions tests/templates/packetbeat.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
################### Packetbeat Agent configuration Example ######################

# This file contains an overview of various configuration settings. Please consult
# the guide at <http://elastic.co/guide> for more details.

# Packetbeat is a distributed application monitoring that works
# by sniffing the network traffic between your application components.
#
#

############################# Agent ############################################
agent:

# The name of the agent that publishes the network data. It can be used to group
# all the transactions sent by a single agent in the web interface.
# If this options is not defined, the hostname is used.
name:

# The tags of the agent are included in their own field with each
# transaction published. Tags make it easy to group servers by different
# logical properties.
tags: [
{%- if agent_tags -%}
{%- for tag in agent_tags -%}
"{{ tag }}"
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
{%- endif -%}]


# Uncomment the following if you want to ignore transactions created
# by the server on which the agent is installed. This option is useful
# to remove duplicates if agents are installed on multiple servers.
# ignore_outgoing: true

############################# Sniffer ############################################

# Select the network interfaces to sniff the data. You can use the "any"
# keyword to sniff on all connected interfaces.
interfaces:
device: 'any'


# Configure the processes to be monitored and how to find them. The processes can
# be found by searching their command line by a given string.
procs:
monitored:
- process: mysqld
cmdline_grep: mysqld

- process: pgsql
cmdline_grep: postgres

- process: nginx
cmdline_grep: nginx

- process: app
cmdline_grep: gunicorn

# Configure which protocols to monitor and the ports where they are
# running. You can disable a given protocol by commenting out its
# configuration.
protocols:
http:
ports: [{{ http_ports|default([80])|join(", ") }}]
{% if http_send_request %}send_request: true{% endif %}
{% if http_send_response %}send_response: true{% endif %}

mysql:
ports: [{{ mysql_ports|default([3306])|join(", ") }}]

pgsql:
ports: [{{ pgsql_ports|default([5432])|join(", ") }}]

redis:
ports: [{{ redis_ports|default([6379])|join(", ") }}]

thrift:
ports: [{{ thrift_ports|default([9090])|join(", ") }}]

thrift:
transport_type: "{{ thrift_transport_type|default('socket') }}"
idl_files: [
{%- if thrift_idl_files -%}
{%- for file in thrift_idl_files -%}
"{{ pb.working_dir + '/' + file }}"
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
{%- endif -%}
]
{% if thrift_send_request %} send_request: true{% endif %}
{% if thrift_send_response %} send_response: true{% endif %}

http:
{% if http_send_all_headers %} send_all_headers: true{% endif %}
{% if http_split_cookie %} split_cookie: true{% endif %}
{% if http_send_headers -%}
send_headers: [{%- for hdr in http_send_headers -%}
"{{ hdr }}"
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
]{%- endif %}
{% if http_real_ip_header %} real_ip_header: "{{ http_real_ip_header }}"{% endif %}
{% if http_include_body_for -%}
include_body_for: [{%- for ct in http_include_body_for -%}
"{{ ct }}"
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
]{%- endif %}

{% if http_strip_authorization %} strip_authorization: true{% endif %}
hide_keywords: [
{%- if http_hide_keywords -%}
{%- for keyword in http_hide_keywords -%}
"{{keyword}}"
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
{%- endif -%}
]


mysql:
{% if mysql_max_rows %} max_rows: {{mysql_max_rows}}{%endif %}
{% if mysql_max_row_length %} max_row_length: {{mysql_max_row_length}}{%endif%}
{% if mysql_send_request %} send_request: true{% endif %}
{% if mysql_send_response %} send_response: true{% endif %}

pgsql:
{% if pgsql_max_rows %} max_rows: {{pgsql_max_rows}}{%endif %}
{% if pgsql_max_row_length %} max_row_length: {{pgsql_max_row_length}}{%endif%}
{% if pgsql_send_request %} send_request: true{% endif %}
{% if pgsql_send_response %} send_response: true{% endif %}

redis:
{% if redis_send_request %} send_request: true{% endif %}
{% if redis_send_response %} send_response: true{% endif %}

############################# Filters ############################################

{% if filter_plugins -%}
filter:
filters: [
{%- for filter in filter_plugins -%}
"{{ filter }}"
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
]

{% if filter_config -%}
{%- for name, dict in filter_config.items() %}
{{name}}:
{%- for key, val in dict.items() %}
{{key}}: "{{val}}"
{%- endfor %}
{% endfor %}
{%- endif -%}
{%- endif %}


############################# GeoIP ############################################
{% if geoip_paths is not none -%}
geoip:
paths: [
{%- for path in geoip_paths -%}
"{{ pb.working_dir + '/' + path }}"
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
]
{%- endif %}



############################# Output ############################################

# Configure what outputs to use when sending the data collected by packetbeat.
# You can enable one or multiple outputs by setting enabled option to true.
output:

# Elasticsearch as output
# Options:
# host, port: where Elasticsearch is listening on
# save_topology: specify if the topology is saved in Elasticsearch
elasticsearch:
enabled: false
host: localhost
port: 9200
save_topology: true

# Redis as output
# Options:
# host, port: where Redis is listening on
# save_topology: specify if the topology is saved in Redis
redis:
enabled: false
host: localhost
port: 6379
save_topology: true

# File as output
# Options
# path: where to save the files
# filename: name of the files
# rotate_every_kb: maximum size of the files in path
# number of files: maximum number of files in path
file:
enabled: true
path: "{{ output_file_path|default(pb.working_dir + "/output") }}"
filename: "{{ output_file_filename|default("packetbeat") }}"
rotate_every_kb: 1000
#number_of_files: 7

# vim: set ft=jinja:

0 comments on commit 425066a

Please sign in to comment.