Skip to content

Commit

Permalink
Merge pull request #4 from mnellemann/agent
Browse files Browse the repository at this point in the history
Rename client to agent
  • Loading branch information
mnellemann committed Aug 8, 2024
2 parents e9e04ef + b2a3888 commit 5eef68e
Show file tree
Hide file tree
Showing 44 changed files with 213 additions and 99 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ steps:
- ./gradlew build packages shared:publishLibraryPublicationToGiteaRepository
- for file in server/build/distributions/*.deb ; do curl --user "${DRONE_REPO_OWNER}:$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done
- for file in server/build/distributions/*.rpm ; do curl --user "${DRONE_REPO_OWNER}:$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done
- for file in client/build/distributions/*.deb ; do curl --user "${DRONE_REPO_OWNER}:$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done
- for file in client/build/distributions/*.rpm ; do curl --user "${DRONE_REPO_OWNER}:$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done
- for file in agent/build/distributions/*.deb ; do curl --user "${DRONE_REPO_OWNER}:$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done
- for file in agent/build/distributions/*.rpm ; do curl --user "${DRONE_REPO_OWNER}:$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done
- for file in plugins/build/distributions/*.deb ; do curl --user "${DRONE_REPO_OWNER}:$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done
- for file in plugins/build/distributions/*.rpm ; do curl --user "${DRONE_REPO_OWNER}:$${AUTH_TOKEN}" --upload-file "$${file}" "https://git.data.coop/api/packages/${DRONE_REPO_OWNER}/generic/${DRONE_REPO_NAME}/${DRONE_TAG}/$(basename $file)" ; done
when:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## [1.2.1] - 2024-08-05
- Adjust defaults intervals from 10s to 30s
- Measure sleep overrun
- Rename client to agent
- When upgrading, ensure any *client* related init-scripts are removed
- Updated 3rd party dependencies

## [1.1.8] - 2024-05-14
- Update 3rd party dependencies
- Avoid infinite timeout on http connections to server (max 1s now)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This software is free to use and is licensed under the [Apache 2.0 License](LICE
Some of my other related projects are:

- [hmci](https://github.com/mnellemann/hmci) for agent-less monitoring of IBM Power servers
- [svci](https://github.com/mnellemann/svci) for monitoring IBM Spectrum Virtualize (Flashsystems / Storwize / SVC)
- [svci](https://github.com/mnellemann/svci) for monitoring IBM Storage Virtualize (Flashsystems / Storwize / SVC)
- [syslogd](https://github.com/mnellemann/syslogd) for redirecting syslog and GELF to other logging destinations

## Screenshots
Expand All @@ -26,18 +26,18 @@ Screenshots of other dashboards are available in the [doc/screenshots](doc/scree

### Server

The server component receives aggregated metrics from *clients* and saves these into InfluxDB.
The server component receives aggregated metrics from *agents* and saves these into InfluxDB.

- Downloaded server package from [releases](https://github.com/mnellemann/sysmon/releases).
- More information and documentation on the [sysmon-server](server/README.md).

### Client & Plugins
### Agent & Plugins

The client runs on all or some of your hosts and collects metrics, which are then sent to the central sysmon-server component. Plugins are loaded by the client at startup and should also be installed.
The agent runs on all or some of your hosts and collects metrics, which are then sent to the central sysmon-server component. Plugins are loaded by the agent at startup and should also be installed.

- Downloaded client & plugin packages from [releases](https://github.com/mnellemann/sysmon/releases).
- More information and documentation on the [sysmon-client](client/README.md).
. More information and documentation on the [sysmon-plugins](plugins/README.md).
- Downloaded agent & plugin packages from [releases](https://github.com/mnellemann/sysmon/releases).
- More information and documentation on the [sysmon-agent](agent/README.md).
- More information and documentation on the [sysmon-plugins](plugins/README.md).


## Known problems
Expand Down
17 changes: 17 additions & 0 deletions agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Agent

This is the monitoring agent sysmon, which you install (together with sysmon-plugins) on your hosts.

## Installation

Download *.deb* or *.rpm* packages for sysmon-agent *and* sysmon-plugins, and install.

## Development

### Build & Test

Use the gradle build tool, which will download all required dependencies:

```shell
./gradlew clean build
```
10 changes: 5 additions & 5 deletions client/build.gradle → agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ dependencies {

}

def projectName = "sysmon-client"
def projectName = "sysmon-agent"

application {
// Define the main class for the application.
mainClass.set('sysmon.client.Application')
applicationDefaultJvmArgs = [ "-Xms64m", "-Xmx64m", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ]
mainClass.set('sysmon.agent.Application')
applicationDefaultJvmArgs = [ "-Xms16m", "-Xmx64m", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ]
}

run {
systemProperty 'sysmon.pluginsDir', '../plugins/output/'
systemProperty 'sysmon.cfgFile', 'doc/sysmon-client.toml'
systemProperty 'sysmon.cfgFile', 'doc/sysmon-agent.toml'
systemProperty 'sysmon.debug', '1'
}

Expand Down Expand Up @@ -82,7 +82,7 @@ ospackage {
user = 'root'
packager = "Mark Nellemann <mark.nellemann@gmail.com>"

into '/opt/sysmon/client'
into '/opt/sysmon/agent'

from(shadowJar.outputs.files) {
into 'lib'
Expand Down
10 changes: 5 additions & 5 deletions client/doc/readme-aix.md → agent/doc/readme-aix.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Works on IBM Power VIO (Virtual IO) servers, as well as regular IBM Power AIX in

## Installation

We require Java 8, which should already be installed on AIX, or is available to install.
Requires Java 8 (or later), which should already be installed on AIX, or is available to install.
The RPM packages are *"noarch"* Java bytecode, so we can use the **--ignoreos** option to install:

```shell
rpm -ivh --ignoreos sysmon-client-*.rpm sysmon-plugins-*.rpm
rpm -ivh --ignoreos sysmon-agent-*.rpm sysmon-plugins-*.rpm
```

## Configuration

Edit **/etc/sysmon-client.toml** and modify the server URL.
Edit **/etc/sysmon-agent.toml** and modify the server URL.

## Upgrades

Expand All @@ -23,8 +23,8 @@ To upgrade the packages:
rpm -Uvh --ignoreos sysmon-*.rpm
```

To restart sysmon-client process after upgrade:
To restart sysmon-agent process after upgrade:

```shell
/etc/rc.d/init.d/sysmon-client stop; /etc/rc.d/init.d/sysmon-client start
/etc/rc.d/init.d/sysmon-agent stop; /etc/rc.d/init.d/sysmon-agent start
```
12 changes: 6 additions & 6 deletions client/doc/readme-linux.md → agent/doc/readme-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Java 8 (or later) runtime is required.

## Installation

[Download](https://github.com/mnellemann/sysmon/releases) the latest client and plugins rpm or deb files.
[Download](https://github.com/mnellemann/sysmon/releases) the latest agent and plugins rpm/deb packages.

### RedHat Linux

```shell
sudo dnf install java-11-openjdk-headless
sudo rpm -ivh sysmon-client-*.noarch.rpm sysmon-plugins-*.rpm
sudo rpm -ivh sysmon-agent-*.noarch.rpm sysmon-plugins-*.rpm
```

Use *yum* if *dnf* is not available.
Expand All @@ -26,18 +26,18 @@ Use *yum* if *dnf* is not available.

```shell
sudo zypper install java-11-openjdk-headless
sudo zypper install sysmon-client-*.noarch.rpm sysmon-plugins-*.rpm
sudo zypper install sysmon-agent-*.noarch.rpm sysmon-plugins-*.rpm
```

### Debian/Ubuntu Linux

```shell
sudo apt install default-jre-headless
sudo dpkg -i sysmon-client-*.deb sysmon-plugins-*.deb
sudo dpkg -i sysmon-agent-*.deb sysmon-plugins-*.deb
```

## Configuration

Edit **/etc/sysmon-client.toml** and modify the server URL.
Edit **/etc/sysmon-agent.toml** and modify the server URL.

Check logs for errors with: ```journalctl -u sysmon-client```
Check logs for errors with: ```journalctl -u sysmon-agent```
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[Unit]
Description=Sysmon Client
Description=Sysmon Agent

[Service]
#User=nobody
#Group=nobody
TimeoutSec=20
Restart=on-failure
ExecStart=/opt/sysmon/client/bin/client
ExecStart=/opt/sysmon/agent/bin/agent

[Install]
WantedBy=default.target
6 changes: 3 additions & 3 deletions client/doc/sysmon-client.sh → agent/doc/sysmon-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
# Description: Enable service provided by daemon.
### END INIT INFO

dir="/opt/sysmon/client"
cmd="/opt/sysmon/client/bin/client"
dir="/opt/sysmon/agent"
cmd="/opt/sysmon/agent/bin/agent"
args=""
user=""

name="sysmon-client"
name="sysmon-agent"
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"
Expand Down
6 changes: 3 additions & 3 deletions client/doc/sysmon-client.toml → agent/doc/sysmon-agent.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###
### Sysmon Client
### Sysmon Agent
###
### Example configuration with some default values.
###
Expand All @@ -22,11 +22,11 @@ interval = '60m'

[extension.base_disk]
enabled = true
interval = '10s'
interval = '30s'

[extension.base_filesystem]
enabled = true
interval = '10s'
interval = '30s'
exclude_type = [ "tmpfs", "ahafs" ]
exclude_mount = [ "/boot/efi" ]

Expand Down
8 changes: 6 additions & 2 deletions client/scripts/install.sh → agent/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/sh

install_config() {
# Migrate from old (name) configuration file
test -f "/etc/sysmon-client.toml" && mv "/etc/sysmon-client.toml" "/etc/${service_name}.toml"

# Install default configuration file
test -f "/etc/${service_name}.toml" || cp "${config_source}" "/etc/${service_name}.toml"
}

Expand All @@ -24,8 +28,8 @@ install_sysv_linux() {
install_sysv_aix() {
test -f "/etc/rc.d/init.d/${service_name}" || cp "${sysv_source}" "/etc/rc.d/init.d/${service_name}"
chmod 0755 "/etc/rc.d/init.d/${service_name}"
ln -sf /etc/rc.d/init.d/sysmon-client /etc/rc.d/rc2.d/Ssysmon-client
ln -sf /etc/rc.d/init.d/sysmon-client /etc/rc.d/rc2.d/Ksysmon-client
ln -sf /etc/rc.d/init.d/sysmon-agent /etc/rc.d/rc2.d/Ssysmon-agent
ln -sf /etc/rc.d/init.d/sysmon-agent /etc/rc.d/rc2.d/Ksysmon-agent
}

install_sysv() {
Expand Down
4 changes: 2 additions & 2 deletions client/scripts/remove.sh → agent/scripts/remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ remove_sysv_linux() {

remove_sysv_aix() {
/etc/rc.d/init.d/${service_name} stop
rm -f /etc/rc.d/init.d/sysmon-client /etc/rc.d/rc2.d/Ksysmon-client
rm -f /etc/rc.d/rc2.d/Ssysmon-client
rm -f /etc/rc.d/init.d/sysmon-agent /etc/rc.d/rc2.d/Ksysmon-agent
rm -f /etc/rc.d/rc2.d/Ssysmon-agent
}

remove_sysv() {
Expand Down
7 changes: 7 additions & 0 deletions agent/scripts/shared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

service_name="sysmon-agent"
sysv_source="/opt/sysmon/agent/doc/sysmon-agent.sh"
config_source="/opt/sysmon/agent/doc/sysmon-agent.toml"
systemd_source="/opt/sysmon/agent/doc/sysmon-agent.service"

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sysmon.client;
package sysmon.agent;

import org.apache.camel.Exchange;
import org.apache.camel.LoggingLevel;
Expand Down Expand Up @@ -26,9 +26,9 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class ClientRouteBuilder extends RouteBuilder {
public class AgentRouteBuilder extends RouteBuilder {

private static final Logger log = LoggerFactory.getLogger(ClientRouteBuilder.class);
private static final Logger log = LoggerFactory.getLogger(AgentRouteBuilder.class);

private final Set<String> scriptFiles = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package sysmon.client;
package sysmon.agent;

import org.apache.camel.main.Main;
import org.slf4j.simple.SimpleLogger;
Expand All @@ -12,10 +12,10 @@
import java.net.UnknownHostException;
import java.util.concurrent.Callable;

@CommandLine.Command(name = "sysmon-client", mixinStandardHelpOptions = true)
@CommandLine.Command(name = "sysmon-agent", mixinStandardHelpOptions = true)
public class Application implements Callable<Integer> {

@CommandLine.Option(names = { "-c", "--conf" }, description = "Configuration file [default: '/etc/sysmon-client.toml'].", paramLabel = "<file>", defaultValue = "/etc/sysmon-client.toml")
@CommandLine.Option(names = { "-c", "--conf" }, description = "Configuration file [default: '/etc/sysmon-agent.toml'].", paramLabel = "<file>", defaultValue = "/etc/sysmon-agent.toml")
private File configurationFile;

@CommandLine.Option(names = { "-d", "--debug" }, description = "Enable debugging (default: ${DEFAULT_VALUE}).")
Expand Down Expand Up @@ -84,7 +84,7 @@ public Integer call() {
main.bind("pluginPath", pluginPath);
main.bind("myServerUrl", configuration.getServer());
main.bind("myHostname", hostname);
main.configure().addRoutesBuilder(ClientRouteBuilder.class);
main.configure().addRoutesBuilder(AgentRouteBuilder.class);

// now keep the application running until the JVM is terminated (ctrl + c or sigterm)
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sysmon.client;
package sysmon.agent;

import sysmon.shared.ComboResult;
import sysmon.shared.MetricResult;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sysmon.client;
package sysmon.agent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sysmon.client;
package sysmon.agent;

import org.apache.camel.Exchange;
import org.apache.camel.processor.aggregate.AbstractListAggregationStrategy;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sysmon.client;
package sysmon.agent;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sysmon.client;
package sysmon.agent;

import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
## limitations under the License.
## ---------------------------------------------------------------------------

camel.main.name = sysmon-client
camel.main.name = agent
camel.main.jmxEnabled = false
camel.main.lightweight = true
camel.component.seda.queue-size = 100
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sysmon.client
package sysmon.agent

import spock.lang.Specification

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ subprojects {
tasks.register("packages") {
group "build"

dependsOn ":client:buildDeb"
dependsOn ":client:buildRpm"
dependsOn ":agent:buildDeb"
dependsOn ":agent:buildRpm"

dependsOn ":server:buildDeb"
dependsOn ":server:buildRpm"
Expand Down
17 changes: 0 additions & 17 deletions client/README.md

This file was deleted.

Loading

0 comments on commit 5eef68e

Please sign in to comment.