-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Output Plugin with virtual socket support #6382
Comments
It sounds like you are working on implementing this, would you like me to assign you to this so the work isn't doubled? |
Yes. I've already worked on the code. My problem is to test it. When I run |
To get it installed into your gopath, use |
Is there a way to collect this metrics with influxdb? I would like to monitore them. What would approach would you take? Thanks for your support! |
Sure, you add an influxdb output in your config file. |
May I should explain my setup. Telegraf is running in a virtual machine, but the influxdb is placed on the host. To send the metrics from the guest environment to the host I don't want to use networking, because it has to be configured on the guest and host and virtual sockets works on the fly. The virtual socket is identified by a CID and a port. Am I on the wrong way? Hope you could understand my problem. |
I think you will need Telegraf running a |
Yes that sounds good. So my colleague and me had an idea, we want that multiple VM of the same tenant can write their metrics to the same influxdb. To distinguish from which VM the metric comes I want to append a tag with the vm`s Cid to each metric. I want to do this on the telegraf (forwarder) on the host side because of verification reasons. The approach to enriche the metrics with the cid tag would rudimentary be like, having a vscokets_listener that gets the messages. Parse the messages back to |
Sounds good, yes AddTag is the way to go. Are you using the github.com/mdlayher/vsock package? If so, I think it may be possible to get the guests CID from the host using conn.RemoteAddr(). Assuming this works you could have an option on the input plugin like: [[inputs.socket_listener]]
## When set a tag will be created with the specified name and set to the string
## representation of the remote CID.
remote_cid_tag = "" This would allow a user to choose a tag for the CID or ignore it as desired. We probably want to add something similar in the future to socket_listener for the I'd like the vsock support added in the |
Exactly I am using that.
... sounds good. I just wrote it into an own package actually, as I thought it might be easier for testing and experimenting with it for the beginning. But yeah, it makes more sense in the end to add it to the |
Am I right when I think that I've got to use a service_input plugin? Or is it possible with a normal input plugin as well? The service_input plugin seemes to be very complicated. Actually I don't understand how the So how can I call the |
Yes you would need to use the ServiceInput interface, it is a bit more complicated. If your Stop() function is not being called when you interrupt Telegraf then most likely your plugin doesn't match the interface exactly. You could use an "interface assertion" and the compiler will tell you why the type doesn't match the interface.
|
Hi @alrob9894 were you able to find a solution to the problem? Did you end up modifying an existing telegraf plugin to get what you need? |
Yes I found a solution, I just extended the socket plugin for virtual sockets, not that big deal. I just forgot to write some tests for it, since I was busy with my CS master. |
If you would submit a PR with your changes we'd be happy to review it. Thanks! |
Do you want to have this beeing integrated to the socket_writer/socket_listener plugins or as a standalone plugin? |
Hi,
Skimming quickly through this feature request, it sounds like this would be good to the extend to the existing socket_listener input plugin and socket_writer output plugin. |
Hi, quick question regarding how you want the URL for the vsock connection to be represented in the sample.conf, my suggestion would be this: #address = "vsock://cid:port" as it follows the represenation of TCP, UDP and so on. #address = "tcp://127.0.0.1:8094" |
@alrob9894 I think that is worth putting up a PR with. Thanks! |
…6382) usage: listen = "vsock://:9273"
hey guys, i add a patch to support vsock in prometheus_client output plugin #14108 |
…6382) usage: listen = "vsock://:9273"
…6382) usage: listen = "vsock://:9273"
…6382) usage: listen = "vsock://:9273"
Feature Request
Adds an output plugin that allows telegraf (running in a guest environment) to write to a virtual socket on the host. The benefit compared to the socket_writer plugin is, that the no network configuration is required.
I reused a lot of codelines from the original socket_writer package. May one could also extend this package instead of writing a new one.
I am still trying to test the vsocket_writer on my local machine. But running into some problems.
The text was updated successfully, but these errors were encountered: