-
Notifications
You must be signed in to change notification settings - Fork 25
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
Option to specify Nagios fields from environment variables #10
base: master
Are you sure you want to change the base?
Conversation
I tested it out and it works as advertised! It handles quotes with no problems now. Thanks! |
4724821
to
c627fb9
Compare
c627fb9
to
f1e9903
Compare
Added ICINGA support |
v = os.environ.get("NAGIOS_%s" % f) | ||
if v is None: | ||
v = os.environ.get("ICINGA_%s" % f) | ||
if v is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just do something like this instead?
if v is not None:
details[f] = v
Otherwise, I imagine we'll be creating events with some "" => ""
details fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could do. Though I'm not sure you'd get a blank key? I was leaning towards always sending the field even if the value is blank so that the user knows there's no bug in the pd parts of the stack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. Yeah, this seems good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a comment explaning!
499b571
to
4fa5297
Compare
return | ||
from os import environ | ||
for f in env_fields: | ||
details[f] = environ.get("NAGIOS_%s" % f) or environ.get("ICINGA_%s" % f) or "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! |
@mdcollins05 - would appreciate it if you can test the latest version on aws. (icinga testing too if that's easy) No rush. |
@mdcollins05 - please try this out.
-f FOO="$FOO"
viacommand_line
can also be sent by-e FOO
I just picked
-e
/--env-field
- other suggestions welcomecc @chamblin