Getting Data In

Is there a way for a universal forwarder to monitor Environment Variables?

duffeysplunk
Path Finder

I am trying to determine if there is a way for the Splunk Universal Forwarder to monitor environmental variables. We have an in-house application that uses a particular one to determine whether a service should be actively running certain processes (i.e. the service should only run the process if it is flagged as the active server). Is there a way for the Universal Forwarder to monitor these values?

Ideally what I am shooting for is to send an alert when it changes from active to standby (or vice versa).

0 Karma
1 Solution

woodcock
Esteemed Legend

You could create a Scripted Input that runs whatever command that dumps the environment variable. Then you would have regular periodic updates as to the current value. Alternatively, you could create a script that monitors the variable and whenever it changes it writes a line to a log that says something like "ENV changed from X to Y" and then monitor that log file. You could even do the same thing but instead of writing to a log, you could send SNMP Trap to Splunk when the variable changes, if that more fits your model of how you do things.

View solution in original post

0 Karma

woodcock
Esteemed Legend

You could create a Scripted Input that runs whatever command that dumps the environment variable. Then you would have regular periodic updates as to the current value. Alternatively, you could create a script that monitors the variable and whenever it changes it writes a line to a log that says something like "ENV changed from X to Y" and then monitor that log file. You could even do the same thing but instead of writing to a log, you could send SNMP Trap to Splunk when the variable changes, if that more fits your model of how you do things.

0 Karma

duffeysplunk
Path Finder

That is what I thought might be a solution, but wasn't sure if there was anything built in natively with Universal Forwarder.

Thanks! I will see if anyone else has any good ideas before marking accepted.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...