summaryrefslogtreecommitdiffstats
path: root/pavement.py
diff options
context:
space:
mode:
authorAndrey Mekin <amekin@crystalnix.com>2015-12-21 16:24:40 +0600
committerAndrey Mekin <amekin@crystalnix.com>2015-12-22 16:16:04 +0600
commited1f5528cebc53eb6dde05c75d6872bfcdab01a7 (patch)
tree52586fac3c120acc3f3c644ea21fb887f6a9a4f7 /pavement.py
parent74ca467a9509e09eac55376fc1fadb9c7c28a653 (diff)
downloadomaha-server-ed1f5528cebc53eb6dde05c75d6872bfcdab01a7.zip
omaha-server-ed1f5528cebc53eb6dde05c75d6872bfcdab01a7.tar.gz
omaha-server-ed1f5528cebc53eb6dde05c75d6872bfcdab01a7.tar.bz2
Add Splunk forwarder customization
Diffstat (limited to 'pavement.py')
-rw-r--r--pavement.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pavement.py b/pavement.py
index 592ade1..478f184 100644
--- a/pavement.py
+++ b/pavement.py
@@ -93,7 +93,15 @@ def create_admin():
@task
def configure_splunk_forwarder():
hostname = os.environ.get('HOST_NAME')
- sh('echo "[default] \nhost = %s \n" > /opt/splunkforwarder/etc/system/local/inputs.conf' % hostname)
+ splunk_host = os.environ.get('SPLUNK_HOST')
+ splunk_receiving_port = os.environ.get('SPLUNK_RECEIVING_PORT', 9997)
+ if splunk_host:
+ try:
+ sh('/opt/splunkforwarder/bin/splunk add forward-server %s:%s --accept-license -auth admin:changeme' % (splunk_host, splunk_receiving_port))
+ sh('/opt/splunkforwarder/bin/splunk add monitor /var/log/nginx -index main -sourcetype Nginx')
+ sh('echo "[default] \nhost = %s \n" > /opt/splunkforwarder/etc/system/local/inputs.conf' % hostname)
+ except:
+ pass
@task
def docker_run():