Skip to main content
The deploy script puts the Observer Agent on a small Compute Engine VM in a network you choose. From there the agent checks what that network can reach, such as private databases, internal APIs and Prometheus. It only makes outbound calls: the firewall denies all inbound traffic except SSH through Identity-Aware Proxy. Your cloud’s pricing applies to everything the script creates. Open in Cloud Shell

What the script creates

Every name comes from --name (default observer-agent):
  • A Secret Manager secret observer-agent-key that holds the agent key. The key is never in the VM’s metadata.
  • A service account observer-agent@<project>.iam.gserviceaccount.com that may read only that secret.
  • Two firewall rules on the network, for the VM’s network tag: observer-agent-allow-iap-ssh allows SSH from Identity-Aware Proxy (35.235.240.0/20) and observer-agent-deny-ingress denies every other inbound connection.
  • A VM observer-agent: e2-micro, Debian 12, a 10 GB balanced disk, Shielded VM and OS Login turned on. Its startup script reads the key with the service account and runs the install script, which installs the agent binary as the observer-agent systemd service. Later boots skip the install.
The script also enables the Compute Engine, Secret Manager and IAM APIs in the project.

Before you start

  • Create the agent in Observer: Agents, Add agent, then Cloud platforms. Copy the key. Observer shows it once.
  • To check private services, note their VPC network and subnet. The subnet needs outbound internet access: keep the VM’s external IP (the default), or use a subnet with Cloud NAT and pass --no-address.

Deploy from Cloud Shell

1

Open Cloud Shell

Choose Open in Cloud Shell above and confirm. Cloud Shell clones the agent repository and opens a short tutorial next to the terminal.
2

Choose the project

3

Run the script

The script asks for the key and hides what you type. To check services in another network, add --network <name> and --subnet <name>. When it finishes, it prints the command that shows the agent’s logs and the one that removes everything it created.

Deploy from any shell

Where gcloud is installed and signed in:
Without AGENT_KEY the script asks for the key on the terminal.

Flags

Running the script again is safe: it adds the key as a new secret version and leaves an existing VM as it is.

Check that it connected

A minute or two after the script finishes, the Add agent screen shows Connected and the Agents page marks the agent as running. If it does not connect, read the agent’s logs through Identity-Aware Proxy (the script prints this command with your values):
Your account needs permission to use IAP TCP forwarding and OS Login with admin rights; project owners have both. The agent logs every failed call to Observer with the reason. The most common cause is a wrong or replaced agent key. If the observer-agent service does not exist, the install failed. Read the startup script’s output with sudo journalctl -u google-startup-scripts.service on the VM. The usual cause is a subnet without outbound internet access.

Add settings and secrets

The agent reads its environment from /etc/observer-agent/agent.env. To add a variable, such as PROMETHEUS_SERVER_URL or a secret that a probe references by name (connection_string_ref and the like), edit the file over IAP SSH and restart the service:
After a key rotation, put the new key in AGENT_KEY in the same file. The VM reads Secret Manager only for its first install. See Environment variables for every setting.

Upgrades

The VM installs the agent binary with the install script. To upgrade, run the script again on the VM. It replaces the binary, restarts the service, and keeps the key and your settings:
To install a given release, use sh -s -- --version <X.Y.Z> in place of sh.

Remove

From the same repository checkout (Cloud Shell keeps it in your home directory), run the script with --delete and the same project, zone and name:
It deletes the VM, the two firewall rules, the secret and the service account. The APIs it enabled stay enabled. Delete the agent in Observer (Agents) too if you no longer need it.