Skip to content
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

Forward messages to external service #1783

Closed
TKul6 opened this issue Mar 2, 2016 · 6 comments
Closed

Forward messages to external service #1783

TKul6 opened this issue Mar 2, 2016 · 6 comments

Comments

@TKul6
Copy link

TKul6 commented Mar 2, 2016

Hi,

I started to use consul in my development environment, my environment layout consist on several Consul agents running on linux machines and consul agents running on windows servers (most of my work is in .NET environment so I work with Windows servers and run the consul as Windows Service).

Since I use windows service I'm unable to get feedback on remote execution like reload, maintenance ect'.
I wonder if there is a way to forward the messages consul agent emits to external service.
For example I would like to subscribe to a topic (command perhaps or serf info for operators) in WAMP and the consul agent will stream the information to my monitoring application.

Does consul support this kind of thing, if not can we make it?

Thanks

@slackpad
Copy link
Contributor

Hi @Tmaster a lot of things that happen in Consul can be pulled via blocking HTTP queries, so it should be possible to write tools to watch for changes and feed these into other systems pretty easily and efficiently. Were you looking specifically for operation actions like consul reload, though? I think that kind of information is mostly in our text logs at the moment.

@highlyunavailable
Copy link
Contributor

@Tmaster if you use a Windows Service Runner (e.g. NSSM (See #758)) then you can easily redirect stdout to a text file and use normal text file streamers to collect the data. I've run a pretty extensive Windows Consul infrastructure and that's how I did it.

This was my setup code for Consul:

C:\opt\nssm.exe install consul "C:\opt\consul\consul.exe" agent -config-dir "C:\opt\consul\conf" -dc "us-west-2-prod"
C:\opt\nssm.exe set consul AppRotateFiles 1
C:\opt\nssm.exe set consul AppRotateOnline 1
C:\opt\nssm.exe set consul AppRotateBytes 10485760
C:\opt\nssm.exe set consul AppStdout C:\opt\consul\log\consul.log
C:\opt\nssm.exe set consul AppStderr C:\opt\consul\log\consul.log
Start-Service consul

@TKul6
Copy link
Author

TKul6 commented Mar 10, 2016

Both solutions seems good enough, I do use NSSM so I can use the log file, which should be good enough (with a good filter ... to remove all the raft data).

But there is one think I do not understand, I know there is a monitor command So it seems that the logic of streaming the agent's log exist, so I wonder if there is a way to collect the data myself (on runtime, as requested) instead of listening to a bunch of endpoints or parsing a log file (which is indeed a nice alternative).

Thanks

@slackpad
Copy link
Contributor

@Tmaster the monitor command is using an internal RPC interface that's subject to change, and is mostly intended for operators to do interactive debugging with an elevated log level. It's not intended as a general streaming log API.

@TKul6
Copy link
Author

TKul6 commented Mar 10, 2016

OK, so I should watch for changes in the KV store \ listen to Events to know that something happen and react to that.

Thank you.

@slackpad
Copy link
Contributor

Sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants