Skip to content

Commit

Permalink
Merge pull request #27 from ernestas-poskus/features/use_items_functi…
Browse files Browse the repository at this point in the history
…on_instead_of_iteritems

Use items function instead of iteritems
  • Loading branch information
ernestas-poskus authored Sep 16, 2017
2 parents 99fb6ff + f76818e commit 27ec27d
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 86 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ env:
- distro: ernestasposkus/ubuntu1604
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distro: ernestasposkus/python3
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"

services:
- docker
Expand Down
2 changes: 1 addition & 1 deletion parse_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
next if line.empty?
if line.start_with?('-')
argument = line[1..line.size-1].split[0]
puts %Q(#{argument}: "{{ #{PREFIX}_#{argument.gsub('.', '__').gsub('-', '_')} }}")
puts %Q( - ['#{argument}', "{{ #{PREFIX}_#{argument.gsub('.', '__').gsub('-', '_')} }}"])
else
# puts "# #{line}"
end
Expand Down
2 changes: 1 addition & 1 deletion templates/alert_manager.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=network.target
Wants=network.target

[Service]
ExecStart={{ prometheus_install_dir }}/{{ prometheus_alert_manager_archive }}/alertmanager {% for key, value in prometheus_alert_manager_service_config.iteritems() if value is not none %}-{{ key }}={{ value }} {% endfor %}
ExecStart={{ prometheus_install_dir }}/{{ prometheus_alert_manager_archive }}/alertmanager {% for config in prometheus_alert_manager_service_config if config[1] is not none %}-{{ config[0] }}={{ config[1] }} {% endfor %}

Restart=always
RestartSec=20
Expand Down
2 changes: 1 addition & 1 deletion templates/node_exporter.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=network.target
Wants=network.target

[Service]
ExecStart={{ prometheus_install_dir }}/{{ prometheus_node_exporter_archive }}/node_exporter {% for key, value in prometheus_node_exporter_service_config.iteritems() if value is not none %}-{{ key }}={{ value }} {% endfor %}
ExecStart={{ prometheus_install_dir }}/{{ prometheus_node_exporter_archive }}/node_exporter {% for config in prometheus_node_exporter_service_config if config[1] is not none %}-{{ config[0] }}={{ config[1] }} {% endfor %}

Restart=always
RestartSec=20
Expand Down
2 changes: 1 addition & 1 deletion templates/prometheus.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=network.target
Wants=network.target

[Service]
ExecStart={{ prometheus_install_dir }}/{{ prometheus_archive }}/prometheus {% for key, value in prometheus_service_config.iteritems() if value is not none %}-{{ key }}={{ value }} {% endfor %}
ExecStart={{ prometheus_install_dir }}/{{ prometheus_archive }}/prometheus {% for config in prometheus_service_config if config[1] is not none %}-{{ config[0] }}={{ config[1] }} {% endfor %}

Restart=always
RestartSec=20
Expand Down
26 changes: 13 additions & 13 deletions vars/alertmanager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# Auto generated
############################################################
prometheus_alert_manager_service_config:
config.file: "{{ prometheus_alert_manager_config__file }}"
data.retention: "{{ prometheus_alert_manager_data__retention }}"
log.format: "{{ prometheus_alert_manager_log__format }}"
log.level: "{{ prometheus_alert_manager_log__level }}"
mesh.listen-address: "{{ prometheus_alert_manager_mesh__listen_address }}"
mesh.nickname: "{{ prometheus_alert_manager_mesh__nickname }}"
mesh.password: "{{ prometheus_alert_manager_mesh__password }}"
mesh.peer: "{{ prometheus_alert_manager_mesh__peer }}"
mesh.peer-id: "{{ prometheus_alert_manager_mesh__peer_id }}"
storage.path: "{{ prometheus_alert_manager_storage__path }}"
web.external-url: "{{ prometheus_alert_manager_web__external_url }}"
web.listen-address: "{{ prometheus_alert_manager_web__listen_address }}"
web.route-prefix: "{{ prometheus_alert_manager_web__route_prefix }}"
- ['config.file', "{{ prometheus_alert_manager_config__file }}"]
- ['data.retention', "{{ prometheus_alert_manager_data__retention }}"]
- ['log.format', "{{ prometheus_alert_manager_log__format }}"]
- ['log.level', "{{ prometheus_alert_manager_log__level }}"]
- ['mesh.listen-address', "{{ prometheus_alert_manager_mesh__listen_address }}"]
- ['mesh.nickname', "{{ prometheus_alert_manager_mesh__nickname }}"]
- ['mesh.password', "{{ prometheus_alert_manager_mesh__password }}"]
- ['mesh.peer', "{{ prometheus_alert_manager_mesh__peer }}"]
- ['mesh.peer-id', "{{ prometheus_alert_manager_mesh__peer_id }}"]
- ['storage.path', "{{ prometheus_alert_manager_storage__path }}"]
- ['web.external-url', "{{ prometheus_alert_manager_web__external_url }}"]
- ['web.listen-address', "{{ prometheus_alert_manager_web__listen_address }}"]
- ['web.route-prefix', "{{ prometheus_alert_manager_web__route_prefix }}"]
45 changes: 22 additions & 23 deletions vars/nodeexporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@
# Auto generated
############################################################
prometheus_node_exporter_service_config:
collector.diskstats.ignored-devices: "{{ prometheus_collector__diskstats__ignored_devices }}"
collector.filesystem.ignored-fs-types: "{{ prometheus_collector__filesystem__ignored_fs_types }}"
collector.filesystem.ignored-mount-points: "{{ prometheus_collector__filesystem__ignored_mount_points }}"
collector.megacli.command: "{{ prometheus_collector__megacli__command }}"
collector.netdev.ignored-devices: "{{ prometheus_collector__netdev__ignored_devices }}"
collector.ntp.protocol-version: "{{ prometheus_collector__ntp__protocol_version }}"
collector.ntp.server: "{{ prometheus_collector__ntp__server }}"
collector.procfs: "{{ prometheus_collector__procfs }}"
collector.runit.servicedir: "{{ prometheus_collector__runit__servicedir }}"
collector.supervisord.url: "{{ prometheus_collector__supervisord__url }}"
collector.sysfs: "{{ prometheus_collector__sysfs }}"
collector.systemd.private: "{{ prometheus_collector__systemd__private }}"
collector.systemd.unit-blacklist: "{{ prometheus_collector__systemd__unit_blacklist }}"
collector.systemd.unit-whitelist: "{{ prometheus_collector__systemd__unit_whitelist }}"
collector.textfile.directory: "{{ prometheus_collector__textfile__directory }}"
collector.wifi: "{{ prometheus_collector__wifi }}"
collectors.enabled: "{{ prometheus_collectors__enabled }}"
collectors.print: "{{ prometheus_collectors__print }}"
log.format: "{{ prometheus_collector__log__format }}"
log.level: "{{ prometheus_collector__log__level }}"
web.listen-address: "{{ prometheus_collector__web__listen_address }}"
web.telemetry-path: "{{ prometheus_collector__web__telemetry_path }}"

- ['collector.diskstats.ignored-devices', "{{ prometheus_collector__diskstats__ignored_devices }}"]
- ['collector.filesystem.ignored-fs-types', "{{ prometheus_collector__filesystem__ignored_fs_types }}"]
- ['collector.filesystem.ignored-mount-points', "{{ prometheus_collector__filesystem__ignored_mount_points }}"]
- ['collector.megacli.command', "{{ prometheus_collector__megacli__command }}"]
- ['collector.netdev.ignored-devices', "{{ prometheus_collector__netdev__ignored_devices }}"]
- ['collector.ntp.protocol-version', "{{ prometheus_collector__ntp__protocol_version }}"]
- ['collector.ntp.server', "{{ prometheus_collector__ntp__server }}"]
- ['collector.procfs', "{{ prometheus_collector__procfs }}"]
- ['collector.runit.servicedir', "{{ prometheus_collector__runit__servicedir }}"]
- ['collector.supervisord.url', "{{ prometheus_collector__supervisord__url }}"]
- ['collector.sysfs', "{{ prometheus_collector__sysfs }}"]
- ['collector.systemd.private', "{{ prometheus_collector__systemd__private }}"]
- ['collector.systemd.unit-blacklist', "{{ prometheus_collector__systemd__unit_blacklist }}"]
- ['collector.systemd.unit-whitelist', "{{ prometheus_collector__systemd__unit_whitelist }}"]
- ['collector.textfile.directory', "{{ prometheus_collector__textfile__directory }}"]
- ['collector.wifi', "{{ prometheus_collector__wifi }}"]
- ['collectors.enabled', "{{ prometheus_collectors__enabled }}"]
- ['collectors.print', "{{ prometheus_collectors__print }}"]
- ['log.format', "{{ prometheus_collector__log__format }}"]
- ['log.level', "{{ prometheus_collector__log__level }}"]
- ['web.listen-address', "{{ prometheus_collector__web__listen_address }}"]
- ['web.telemetry-path', "{{ prometheus_collector__web__telemetry_path }}"]
92 changes: 46 additions & 46 deletions vars/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,49 @@
# Auto generated
############################################################
prometheus_service_config:
config.file: "{{ prometheus_config_dir }}/prometheus.yml"
alertmanager.notification-queue-capacity: "{{ prometheus_alertmanager__notification_queue_capacity }}"
alertmanager.timeout: "{{ prometheus_alertmanager__timeout }}"
alertmanager.url: "{{ prometheus_alertmanager__url }}"
log.format: "{{ prometheus_log__format }}"
log.level: "{{ prometheus_log__level }}"
query.max-concurrency: "{{ prometheus_query__max_concurrency }}"
query.staleness-delta: "{{ prometheus_query__staleness_delta }}"
query.timeout: "{{ prometheus_query__timeout }}"
storage.local.checkpoint-dirty-series-limit: "{{ prometheus_storage__local__checkpoint_dirty_series_limit }}"
storage.local.checkpoint-interval: "{{ prometheus_storage__local__checkpoint_interval }}"
storage.local.chunk-encoding-version: "{{ prometheus_storage__local__chunk_encoding_version }}"
storage.local.dirty: "{{ prometheus_storage__local__dirty }}"
storage.local.engine: "{{ prometheus_storage__local__engine }}"
storage.local.index-cache-size.fingerprint-to-metric: "{{ prometheus_storage__local__index_cache_size__fingerprint_to_metric }}"
storage.local.index-cache-size.fingerprint-to-timerange: "{{ prometheus_storage__local__index_cache_size__fingerprint_to_timerange }}"
storage.local.index-cache-size.label-name-to-label-values: "{{ prometheus_storage__local__index_cache_size__label_name_to_label_values }}"
storage.local.index-cache-size.label-pair-to-fingerprints: "{{ prometheus_storage__local__index_cache_size__label_pair_to_fingerprints }}"
storage.local.max-chunks-to-persist: "{{ prometheus_storage__local__max_chunks_to_persist }}"
storage.local.memory-chunks: "{{ prometheus_storage__local__memory_chunks }}"
storage.local.num-fingerprint-mutexes: "{{ prometheus_storage__local__num_fingerprint_mutexes }}"
storage.local.path: "{{ prometheus_storage__local__path }}"
storage.local.pedantic-checks: "{{ prometheus_storage__local__pedantic_checks }}"
storage.local.retention: "{{ prometheus_storage__local__retention }}"
storage.local.series-file-shrink-ratio: "{{ prometheus_storage__local__series_file_shrink_ratio }}"
storage.local.series-sync-strategy: "{{ prometheus_storage__local__series_sync_strategy }}"
storage.local.target-heap-size: "{{ prometheus_storage__local__target_heap_size }}"
storage.remote.graphite-address: "{{ prometheus_storage__remote__graphite_address }}"
storage.remote.graphite-prefix: "{{ prometheus_storage__remote__graphite_prefix }}"
storage.remote.graphite-transport: "{{ prometheus_storage__remote__graphite_transport }}"
storage.remote.influxdb-url: "{{ prometheus_storage__remote__influxdb_url }}"
storage.remote.influxdb.database: "{{ prometheus_storage__remote__influxdb__database }}"
storage.remote.influxdb.retention-policy: "{{ prometheus_storage__remote__influxdb__retention_policy }}"
storage.remote.influxdb.username: "{{ prometheus_storage__remote__influxdb__username }}"
storage.remote.opentsdb-url: "{{ prometheus_storage__remote__opentsdb_url }}"
storage.remote.timeout: "{{ prometheus_storage__remote__timeout }}"
web.console.libraries: "{{ prometheus_web__console__libraries }}"
web.console.templates: "{{ prometheus_web__console__templates }}"
web.enable-remote-shutdown: "{{ prometheus_web__enable_remote_shutdown }}"
web.external-url: "{{ prometheus_web__external_url }}"
web.listen-address: "{{ prometheus_web__listen_address }}"
web.max-connections: "{{ prometheus_web__max_connections }}"
web.read-timeout: "{{ prometheus_web__read_timeout }}"
web.route-prefix: "{{ prometheus_web__route_prefix }}"
web.telemetry-path: "{{ prometheus_web__telemetry_path }}"
web.user-assets: "{{ prometheus_web__user_assets }}"
- ['config.file', "{{ prometheus_config_dir }}/prometheus.yml"]
- ['alertmanager.notification-queue-capacity', "{{ prometheus_alertmanager__notification_queue_capacity }}"]
- ['alertmanager.timeout', "{{ prometheus_alertmanager__timeout }}"]
- ['alertmanager.url', "{{ prometheus_alertmanager__url }}"]
- ['log.format', "{{ prometheus_log__format }}"]
- ['log.level', "{{ prometheus_log__level }}"]
- ['query.max-concurrency', "{{ prometheus_query__max_concurrency }}"]
- ['query.staleness-delta', "{{ prometheus_query__staleness_delta }}"]
- ['query.timeout', "{{ prometheus_query__timeout }}"]
- ['storage.local.checkpoint-dirty-series-limit', "{{ prometheus_storage__local__checkpoint_dirty_series_limit }}"]
- ['storage.local.checkpoint-interval', "{{ prometheus_storage__local__checkpoint_interval }}"]
- ['storage.local.chunk-encoding-version', "{{ prometheus_storage__local__chunk_encoding_version }}"]
- ['storage.local.dirty', "{{ prometheus_storage__local__dirty }}"]
- ['storage.local.engine', "{{ prometheus_storage__local__engine }}"]
- ['storage.local.index-cache-size.fingerprint-to-metric', "{{ prometheus_storage__local__index_cache_size__fingerprint_to_metric }}"]
- ['storage.local.index-cache-size.fingerprint-to-timerange', "{{ prometheus_storage__local__index_cache_size__fingerprint_to_timerange }}"]
- ['storage.local.index-cache-size.label-name-to-label-values', "{{ prometheus_storage__local__index_cache_size__label_name_to_label_values }}"]
- ['storage.local.index-cache-size.label-pair-to-fingerprints', "{{ prometheus_storage__local__index_cache_size__label_pair_to_fingerprints }}"]
- ['storage.local.max-chunks-to-persist', "{{ prometheus_storage__local__max_chunks_to_persist }}"]
- ['storage.local.memory-chunks', "{{ prometheus_storage__local__memory_chunks }}"]
- ['storage.local.num-fingerprint-mutexes', "{{ prometheus_storage__local__num_fingerprint_mutexes }}"]
- ['storage.local.path', "{{ prometheus_storage__local__path }}"]
- ['storage.local.pedantic-checks', "{{ prometheus_storage__local__pedantic_checks }}"]
- ['storage.local.retention', "{{ prometheus_storage__local__retention }}"]
- ['storage.local.series-file-shrink-ratio', "{{ prometheus_storage__local__series_file_shrink_ratio }}"]
- ['storage.local.series-sync-strategy', "{{ prometheus_storage__local__series_sync_strategy }}"]
- ['storage.local.target-heap-size', "{{ prometheus_storage__local__target_heap_size }}"]
- ['storage.remote.graphite-address', "{{ prometheus_storage__remote__graphite_address }}"]
- ['storage.remote.graphite-prefix', "{{ prometheus_storage__remote__graphite_prefix }}"]
- ['storage.remote.graphite-transport', "{{ prometheus_storage__remote__graphite_transport }}"]
- ['storage.remote.influxdb-url', "{{ prometheus_storage__remote__influxdb_url }}"]
- ['storage.remote.influxdb.database', "{{ prometheus_storage__remote__influxdb__database }}"]
- ['storage.remote.influxdb.retention-policy', "{{ prometheus_storage__remote__influxdb__retention_policy }}"]
- ['storage.remote.influxdb.username', "{{ prometheus_storage__remote__influxdb__username }}"]
- ['storage.remote.opentsdb-url', "{{ prometheus_storage__remote__opentsdb_url }}"]
- ['storage.remote.timeout', "{{ prometheus_storage__remote__timeout }}"]
- ['web.console.libraries', "{{ prometheus_web__console__libraries }}"]
- ['web.console.templates', "{{ prometheus_web__console__templates }}"]
- ['web.enable-remote-shutdown', "{{ prometheus_web__enable_remote_shutdown }}"]
- ['web.external-url', "{{ prometheus_web__external_url }}"]
- ['web.listen-address', "{{ prometheus_web__listen_address }}"]
- ['web.max-connections', "{{ prometheus_web__max_connections }}"]
- ['web.read-timeout', "{{ prometheus_web__read_timeout }}"]
- ['web.route-prefix', "{{ prometheus_web__route_prefix }}"]
- ['web.telemetry-path', "{{ prometheus_web__telemetry_path }}"]
- ['web.user-assets', "{{ prometheus_web__user_assets }}"]

0 comments on commit 27ec27d

Please sign in to comment.