# Adding different host and its services

**URL:** <https://community.icinga.com/t/adding-different-host-and-its-services/14549>\
**Category:** Service Monitoring\
**Created:** [February 6, 2025, 12:15pm UTC](https://community.icinga.com/t/adding-different-host-and-its-services/14549 "2025-02-06T12:15:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wisal](https://community.icinga.com/letter_avatar_proxy/v4/letter/w/ecb155/32.png) [@Wisal](https://community.icinga.com/u/Wisal)\
**Post date:** [February 6, 2025, 12:15pm UTC](https://community.icinga.com/t/adding-different-host-and-its-services/14549/1 "2025-02-06T12:15:35Z")

</div>

Is it possible to monitor Windows and Linux machines without deploying an agent? If so, please provide details on the approach. Additionally, do we need to configure any settings on the host side, or can Icinga automatically detect and monitor key metrics such as CPU load, disk space, and memory usage through additional configuration on the Icinga server?

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [February 6, 2025, 12:33pm UTC](https://community.icinga.com/t/adding-different-host-and-its-services/14549/2 "2025-02-06T12:33:56Z")

</div>

Yes and no.  
If you use SSH then this is the agent.  
If you use SNMP then this is the agent.  
If you use WinRM then this is the agent.

But yes, you can monitor without the icinga2 agent.

Icinga doesn’t do anything if it wan’t told to do so.  
To me it’s not a monitoring solution but a monitoring framework in which I can implement my ideal monitoring.

I would recommend the icinga2 agent with the monitoring plugins from the Linuxfabrik. This Plugin collection comes with service sets that would provide you with some defaults like CPU load, disk space, RAM, std. services of the OS etc.

You could also run thinly wrapped checks via cronjob, systemd timer or scheduled tasks and send the results via Icinga2 API (passive checks) from the wrapper. To make this scale, would require some sort of config management like Ansible to create the hosts and services in Icinga, deploy the wrapped checks and schedules them.

---

<div class="post-metadata">

**Author:** ![suresh.kumar](https://community.icinga.com/user_avatar/community.icinga.com/suresh.kumar/32/8247_2.png) [@suresh.kumar](https://community.icinga.com/u/suresh.kumar)\
**Post date:** [February 7, 2025, 4:04am UTC](https://community.icinga.com/t/adding-different-host-and-its-services/14549/3 "2025-02-07T04:04:32Z")

</div>

yes, it is possible to monitor Windows and Linux machines without deploying an agent by using **agentless monitoring** techniques in Icinga.

## **Agentless Monitoring Approaches in Icinga**

Icinga can monitor remote machines without an agent using standard network protocols like **SNMP, SSH**.

**Monitoring a Linux Server Using `check_by_ssh` in Icinga 2**

If you want to monitor a Linux server without installing an agent, you can use **`check_by_ssh`** , which allows Icinga to execute commands remotely via SSH. Below is a step-by-step guide:

### **1. Prerequisites**

- Ensure SSH is enabled and running on the target Linux server (`systemctl status sshd`).
- The Icinga 2 server must have SSH access to the target machine.
- A dedicated user (e.g., `icinga`) should be created on the remote server with restricted privileges.

### **2. Set Up SSH Key-Based Authentication**

On the Icinga server, generate an SSH key if you haven’t already:

```auto
ssh-keygen -t rsa -b 4096

```

Copy the public key to the remote server:

```auto
ssh-copy-id icinga@<remote_host>

```

Test the connection:

```auto
ssh icinga@<remote_host> uptime

```

### **3. Install `check_by_ssh` Plugin**

Ensure the plugin is installed on your Icinga server:

```auto
apt install nagios-plugins -y # Debian/Ubuntu  
yum install nagios-plugins-ssh -y # CentOS/RHEL  

```

### **4. Define the Service in Icinga 2**

Edit the configuration file (e.g., `/etc/icinga2/conf.d/services.conf`):

```auto
apply Service "CPU Load" {
  import "generic-service"
  check_command = "by_ssh"
  
  vars.by_ssh_host = host.address
  vars.by_ssh_command = "uptime | awk '{print $10}'"
  vars.by_ssh_logname = "icinga"
  
  assign where host.vars.os == "Linux"
}

```

### **5. Restart Icinga 2**

Apply the changes:

```auto
systemctl restart icinga2

```

### **6. Test the Check**

Run the command manually to verify:

```auto
/usr/lib/nagios/plugins/check_by_ssh -H <remote_host> -l icinga -C "uptime"

```

### **References**

- [Stevie’s Blog: Icinga2 Check by SSH](https://steviesblog.de/blog/2020/08/02/icinga2-check-by-ssh/)
- [Thomas-Krenn: Icinga Check by SSH Plugin](https://www.thomas-krenn.com/de/wiki/Icinga_check_by_ssh_Plugin?xtxsearchselecthit=1#)

Hope this helps! Let me know if you need further clarification. 😊
