Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-2516

Passing environment variables to custom sms alert script

    XMLWordPrintable

Details

    • Help
    • Resolution: Unresolved
    • Trivial
    • None
    • None
    • Alerting
    • None

    Description

      Hello,

      I write custom sms alert script.

      In alerts, I point to file location:

      External program path      /opt/observium/alarmy/sms.py

       

      My question is:

      how to pass environment variables correctly to this script?:

      http://docs.observium.org/alerting_transports/#script

      this is only test, so please don't judge this:

      cat sms.py
      #!/usr/bin/python
      import os

      f = open('output.txt', 'w')
      #f.write(os.environ['OBSERVIUM_ALERT_STATE'])
      f.write(os.environ['OBSERVIUM_ALERT_ID'])

      #f.write(OBSERVIUM_ALERT_STATE)

       

      ??

      output.txt is empty now.

      Maybe variables must be used from others in special set (not only one variable).

      I'm not sure this question is asked in right place, but if someone can help me, I will appreciate any advice.

       

      Attachments

        Activity

          People

            adama Adam Armstrong
            janix Janusz Janik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: