Preparing Your Environment
Set up the tools and access you need before you write a connector. A connector is a standalone Maven project that compiles against the published Connector API. You don't need the agent's source code.
A GitHub account that has been granted read access to the package that hosts the Connector API.
Administrator access to the console, to issue the agent API key and to onboard a test application. A developer can work with an administrator instead.
Installing the toolchain
| Requirement | Needed for |
|---|---|
| JDK 17 | The Connector API, the agent and every connector target Java 17. |
| Maven 3.9 or later | Building the connector JAR with mvn clean package. |
| Docker with Buildx | Optional. Only needed if you package the connector as an installer image for an agent that runs in Docker. |
| Network access to the target system | From the machine that runs the agent, not from Zetect. |
Configuring access to the Connector API
Your connector depends on io.cyiam:cyiam-connector-api, published to GitHub Packages. GitHub Packages asks for credentials on every download, even for reads, so Maven needs a token. You only read the package, so a read-only token is enough.
To configure Maven:
- In GitHub, create a personal access token (classic) with the
read:packagesscope. - Copy
settings.xml.examplefrom the agent repository to~/.m2/settings.xml. If you already have a settings file, copy only its<server>block into yours. - In the
<server>block, replace the username with your GitHub username and the password with the token. - Keep the server
<id>asgithub. Maven matches it to the<repository>with the same id in your connector'spom.xml.
<settings>
<servers>
<server>
<id>github</id>
<username>your-github-username</username>
<password>your-read-packages-token</password>
</server>
</servers>
</settings>
The connector template's pom.xml already declares the matching repository. Keep that block when you copy the template.
Getting an agent to test with
You test a connector by running it inside a real agent registered to a Zetect tenant, ideally a test tenant.
To prepare a test agent:
- Ask an administrator for the tenant identifier and the agent API key. Administrators generate the key under Configuration → Agent API Key; it is shown only once. See Deploying Agents.
- Install the agent on a machine that can reach the target system, with Java 17 and outbound access to Zetect and the broker.
- Set the agent's environment variables:
CYIAM_API_KEY– the agent API key. Required.CYIAM_BASE_URL– your Zetect address, without a trailing slash. Required.CYIAM_TENANT_SLUG– the tenant identifier. Required.CYIAM_CONNECTORS_DIR– the folder the agent loads connectors from. Defaults to./connectors, and to/opt/cyiam-agent/connectorsin the agent's container image.CYIAM_AGENT_NAMEandCYIAM_LOG_LEVEL– optional. SetCYIAM_LOG_LEVEL=DEBUGwhile you develop.
- Start the agent and confirm it shows as Online under Configuration → Agents.
Project structure
Every connector follows the same layout. The fastest way to get it is to copy the connector-template folder, as described in Building a Connector.
cyiam-connector-<name>/
├── pom.xml
└── src/main/
├── java/<your/package>/
│ └── <Name>Connector.java implements Connector
└── resources/
└── META-INF/services/
└── io.cyiam.connector.api.Connector one line: your class name
Troubleshooting
| Problem | What to check |
|---|---|
| Maven can't resolve cyiam-connector-api (401 or 403) | The token is missing the read:packages scope, or the server id in settings.xml isn't github. |
| Agent stops with "Registration rejected" | The API key or tenant identifier is wrong. The agent doesn't retry after this error; fix the variables and restart it. |
| Agent logs "Connectors directory does not exist" | Create the folder that CYIAM_CONNECTORS_DIR points to. |
