Details
-
Help
-
Resolution: Unresolved
-
Trivial
-
None
-
None
-
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.
Hello,
thank You for your answer.
I improve a little my testing code.
My script had a little error.
Path to file should be unrelative:
My testing program code is now:
cat sms.py
#!/usr/bin/python
print(os.environ)
#.... and so on
Location script is:
/opt/observium/alarmy/sms.py
cd /opt/observium/alarmy
I run test script:
Output: (print os.environ):
{
}
cat test:
...
Now actual question.
How can I get information about another devices:
172.16.16.10
172.16.16.11
172.16.16.20
172.16.16.21
172.16.16.22
172.16.16.23
.....
And specific port problems within this devices?