Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PHP 8.2 and a new setting which can save some money #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion newrelic/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ include:
{% if salt['pkg.list_pkgs']().get('php5', False) -%}
- .daemon
- .php
{% elif salt['pkg.list_pkgs']().get('php7.0', False) -%}
- .daemon
- .php7
{% elif salt['pkg.list_pkgs']().get('php8.2-common', False) -%}
- .daemon
- .php8
{% endif %}
- .nrsysmond
4 changes: 2 additions & 2 deletions newrelic/nrsysmond.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ newrelic-sysmond:
pkg:
- installed
service.running:
- reload: True
- watch:
- pkg: newrelic-sysmond
- file: /etc/newrelic/nrsysmond.cfg
Expand All @@ -19,7 +20,6 @@ add_licence_key:
- append_if_not_found: True
- marker_start: '#-- salt managed license key zone --'
- marker_end: '#-- end salt managed license key --'
- content: |
license_key={{ salt['pillar.get']('newrelic:apikey', '') }}
- content: license_key={{ salt['pillar.get']('newrelic:apikey', '') }}
- require:
- pkg: newrelic-sysmond
66 changes: 66 additions & 0 deletions newrelic/php7.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@


newrelic-php:
pkg.installed:
- name: newrelic-php5

file.replace:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/7.0/mods-available/newrelic.ini
{% endif %}
- pattern: 'newrelic.license = .*'
- repl: newrelic.license = "{{ salt['pillar.get']('newrelic:apikey', '') }}"
- watch_in:
- service: newrelic-daemon
- require:
- pkg: newrelic-php

newrelic-files-folder:
file.directory:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/7.0/mods-available
{% endif %}
- makedirs: True

newrelic-appname:
file.replace:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/7.0/mods-available/newrelic.ini
{% endif %}
- pattern: 'newrelic.appname = "PHP Application"'
- repl: newrelic.appname = "{{ salt['pillar.get']('newrelic:appname', '') }}"
- watch_in:
- service: newrelic-daemon
- require:
- pkg: newrelic-php

newrelic-explain_uncomment:
file.uncomment:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/7.0/mods-available/newrelic.ini
{% endif %}
- regex: ^newrelic.transaction_tracer.explain_enabled
- char : ;

newrelic-explain_enabled:
file.replace:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/7.0/mods-available/newrelic.ini
{% endif %}
- pattern: 'newrelic.transaction_tracer.explain_enabled = .*'
- repl: newrelic.transaction_tracer.explain_enabled = {{ salt['pillar.get']('newrelic:explain_enable', 'true') }}
- watch_in:
- service: newrelic-daemon
- require:
- pkg: newrelic-php

90 changes: 90 additions & 0 deletions newrelic/php8.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@


newrelic-php:
pkg.installed:
- name: newrelic-php5

file.replace:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/8.2/mods-available/newrelic.ini
{% endif %}
- pattern: 'newrelic.license = .*'
- repl: newrelic.license = "{{ salt['pillar.get']('newrelic:apikey', '') }}"
- watch_in:
- service: newrelic-daemon
- require:
- pkg: newrelic-php

newrelic-files-folder:
file.directory:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/8.2/mods-available
{% endif %}
- makedirs: True

newrelic-appname:
file.replace:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/8.2/mods-available/newrelic.ini
{% endif %}
- pattern: 'newrelic.appname = "PHP Application"'
- repl: newrelic.appname = "{{ salt['pillar.get']('newrelic:appname', '') }}"
- watch_in:
- service: newrelic-daemon
- require:
- pkg: newrelic-php

newrelic-explain_uncomment:
file.uncomment:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/8.2/mods-available/newrelic.ini
{% endif %}
- regex: ^newrelic.transaction_tracer.explain_enabled
- char : ;

newrelic-explain_enabled:
file.replace:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/8.2/mods-available/newrelic.ini
{% endif %}
- pattern: 'newrelic.transaction_tracer.explain_enabled = .*'
- repl: newrelic.transaction_tracer.explain_enabled = {{ salt['pillar.get']('newrelic:explain_enable', 'true') }}
- watch_in:
- service: newrelic-daemon
- require:
- pkg: newrelic-php

newrelic-span_events_uncomment:
file.uncomment:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/8.2/mods-available/newrelic.ini
{% endif %}
- regex: ^newrelic.span_events_enabled
- char : ;

newrelic-newrelic.span_events_enabled:
file.replace:
{% if grains['os_family'] == 'RedHat' %}
- name: /etc/php.d/newrelic.ini
{% elif grains['os_family'] == 'Debian' %}
- name: /etc/php/8.2/mods-available/newrelic.ini
{% endif %}
- pattern: 'newrelic.span_events_enabled = .*'
- repl: newrelic.span_events_enabled = {{ salt['pillar.get']('newrelic:span_events_enabled', 'true') }}
- watch_in:
- service: newrelic-daemon
- require:
- pkg: newrelic-php

5 changes: 0 additions & 5 deletions newrelic/repo.sls
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,3 @@ newrelic-repo:
- keyid: 548C16BF
- keyserver: keyserver.ubuntu.com
{% endif %}
- require_in:
{% if salt['pkg.list_pkgs']().get('php', False) -%}
- pkg: newrelic-php
{% endif %}
- pkg: newrelic-sysmond
1 change: 1 addition & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ newrelic:
apikey: 803117443ae24ef58f4cc149d8b3dba7
appname: myphpapp
explain_enable: false
span_events_enabled: false