Specify graphite machine to send collectd data to using ip address? - graphite

I am trying to configure a CentOS 7 VM to send some performance metrics using collectd to another CentOS 7 VM that is running Graphite so the performance metrics can be displayed graphically. Below is the configuration parameters for collectd write_graphite in the collectd.conf file:
<Plugin write_graphite>
<Node "commandNode1">
Host "localhost"
Port "2003"
Protocol "tcp"
LogSendErrors true
Prefix "collectd."
# Postfix "collectd"
StoreRates true
AlwaysAppendDS false
EscapeCharacter "_"
</Node>
</Plugin>
Is there anyway that I can specify the host parameter using just the ip address? Or is there somewhere where I have to associate the IP Address with a given hostname in the collectd.conf file? For refernce I primarily used this link to get to where I am now: https://www.digitalocean.com/community/tutorials/how-to-keep-effective-historical-logs-with-graphite-carbon-and-collectd-on-centos-7. Thanks!

You can use IP or hostname as long as it resolves to a valid IP.

Since you are using two different VMs, one with Collectd and the other with Graphite. You need to make sure one VM is able to talk to another VM.
If you are using Virtualbox to bring up these VMs, Virtualbox assigns a NAT'd IP to the VM. The VMs should be able to connect to each other using the NAT IP address, usually its of the form 192.168.x.x
Use the NAT IP of the VM that's running graphite to configure write_graphite plugin, by replacing "localhost" with this IP, in your example of the config above.

Related

Unable to SSH into VM instance on Google Cloud Platform

I have created a firewall rule in VPC network for port 22 by assigning an IP with the port e.g (192.168.xx.yy) instead of 0.0.0.0/0 in the rules. Now, when I create a compute engine VM instance in Google Cloud Platform and SSH into it, it states that "cannot connect to port 22".
I don't want the port tcp:22 to have ip range 0.0.0.0/0 but only have a single ip as stated above? How can I solve this issue?
The 192.168.x.x is an internal IP address, and in your situation would apply to a VM instance within the same network as the instance you want to connect to.
If you want to connect from outside that network, you'll need to set the source of the firewall rule to the external IP of the instance/machine you want to connect from. You can get your external IP by going to https://whatismyipaddress.com for example.
The firewall rule setting would be something like this:
Direction of traffic: Ingress
Action on match: Allow
Targets: Specified target tags (for example)
Source filter: IP ranges
Source IP ranges: x.x.x.x/32 (your external IP)
If you would not like to have your GCE instance's port 22 open to internet, but you would like to connect to it, I propose you 2 different solutions:
Create a bastion host. This VM is a proxy to access to your GCE instances. You log into the bastion and then you can perform a ssh hop to your GCE instance. Only the bastion host is opened to internet on port 22. And you can start this Bastion VM only when you need to connect to your others GCE instances, that increase the security and decrease the risk of attack on this "backdoor" instance.
For both the bastion and for directly reaching your VM on port 22, you can limit the source IP of your firewall rule to your current IP.
But remember, the IP is not a source of truth.

Please Example Kubernetes External Address vs Internal Addresses

In a vmware environment, should the external address become populated with the VM's (or hosts) ip address?
I have three clusters, and have found that only those using a "cloud provider" have external addresses when I run kubectl get nodes -o wide. It is my understanding that the "cloud provider" plugin (GCP, AWS, Vmware, etc) is what assigns the public ip address to the node.
KOPS deployed to GCP = external address is the real public IP addresses of the nodes.
Kubeadm deployed to vwmare, using vmware cloud provider = external address is the same as the internal address (a private range).
Kubeadm deployed, NO cloud provider = no external ip.
I ask because I have a tool that scrapes /api/v1/nodes and then interacts with each host that is finds, using the "external ip". This only works with my first two clusters.
My tool runs on the local network of the clusters, should it be targeting the "internal ip" instead? In other words, is the internal ip ALWAYS the IP address of the VM or physical host (when installed on bare metal).
Thank you
Baremetal will not have an "extrenal-IP" for the nodes and the "internal-ip" will be the IP address of the nodes. You are running your command from inside the same network for your local cluster so you should be able to use this internal IP address to access the nodes as required.
When using k8s on baremetal the external IP and loadbalancer functions don't natively exist. If you want to expose an "External IP", quotes because most cases it would still be a 10.X.X.X address, from your baremetal cluster you would need to install something like MetalLB.
https://github.com/google/metallb

How to setup a bridge connection with vbox/vmware using a second wan ip on a dedicated server

I am using a dedicated server with a certain wan ip / netmask / gateway / nameservers.
I got a second wan ip to use with virtualbox i installed on the server.
I want to use bridge connection in virtualbox because i use some "servers" in it and want them to be able to be seen from internet .
I created a virtual network interface on the server and assigned the second ip to it.
It works , meaning i can ping that ip from outside.I setup virtualbox to bridge to that interface but i am stuck at what settings i have to set up in the virtual guest so everything will work.
Second ip has netmask 255.255.255.255 so i assume its a single ip situation and probably using gateway and nameservers of the server because i was given none of them with it.
I have to mention that first ip and second ip are not in the same subnet , nor is the gateway (e.g. XX.YY.ZZ.WW , ZZ is different between first , second and gateway ip)
Thanks in advance.
You have to unbind TCP and all other protocols and services on the hosts NIC that you want to use in VBox. After that, you can configure a bridged network connection using that interface. After that, you can set the IP and network settings in your virtual system. This has also been addressed in this post: https://serverfault.com/questions/136969/dedicate-a-nic-to-a-virtualbox-vm

VirtualBox networking for an NGINX client having multiple hostnames

I have a host laptop running Debian, and a client VM running Debian. On the client, I run NGINX, and it serves up a complex web application with several hostnames (e.g. www.host, api.host, blog.host). The laptop moves between several different networks, with a seemingly ever-changing IP address.
I'm trying to meet the following conditions with this VM:
The IP address of the client shouldn't change (e.g. always 192.168.10.10)
With a static IP, I could edit the host /etc/hosts file and keep complex hostnames
The client should have access to the Internet
No other machines need to access the client
What is the best way to set up the Attached to settings for this client?
To do this, simply add two network interfaces to the box.
The first interface will use Host-Only, and that is how your host can connect to the client. This will create an additional network adapter on the host.
The second interface will use NAT, and that is the gateway to the internet. This will create an additional network adapter on the client.
If you've already got a client running, you'll need to get the next network adapter up and running by executing sudo ifconfig eth1 up and to get an IP address, run sudo dhclient eth1.

How can a VM work out the address of the host node?

How can a Linux VM work out the IPaddress of the host node?
I need to connect to the IP address of the host node. I also need to know when it changes as it could be a dynamic IP. I need it to connect to a service there.
Is there some way to check this, irregardless of the type of VM, VMWare, Xen, Virtual Box?
It needs to be a Linux script, and should work regardless of the host operating system, whether Linux or Windows
My solution is to bridge a network adapter in the VM with one on the host, making it a dymanic IP address. As such it will always be on the subnet as the host adapter.
Next thing is to run an HTTP service on the host IP, that the VM will scan its network range on. The IP the service responds on will be the IP of the host. Having an IP service on the host is not ideal, but it is the best I can come up with.

Resources