How to list the networks of the computers in Medulla.
Applies to: Medulla
Version: All
Environment: On-Premise
Category: Medulla
To set up rules in Medulla for relays and if you want to manage the computers assigned to specific relays based on the network, you can run an SQL query on the server to do so:
connect to the server via an SSH console, or in your server’s terminal, type the command
mysql
in the MySQL shell, run the following query:
SELECT INET_NTOA(INET_ATON(n.ipaddress) & INET_ATON(n.mask)) AS reseau, n.mask AS masque, n.gateway AS passerelle, COUNT(DISTINCT n.machines_id) AS nb_machines FROM xmppmaster.network n JOIN xmppmaster.machines m ON
m.id = n.machines_id WHERE n.ipaddress IS NOT NULL AND n.ipaddress <> '' AND n.mask IS NOT NULL AND n.mask <> '' GROUP BY reseau, n.mask, n.gateway ORDER BY nb_machines DESC;
You will see output similar to the following:
+--------------+---------------+---------------+-------------+
| reseau | masque | passerelle | nb_machines |
+--------------+---------------+---------------+-------------+
| 192.168.1.0 | 255.255.255.0 | 192.168.1.1 | 3 |
| 172.16.12.0 | 255.255.252.0 | 172.16.12.5 | 2 |
| 172.16.12.0 | 255.255.252.0 | 172.16.12.7 | 2 |
| 192.168.1.0 | 255.255.255.0 | 192.168.1.254 | 1 |
| 192.168.1.0 | 255.255.255.0 | 0.0.0.0 | 1 |
| 192.168.64.0 | 255.255.255.0 | 192.168.64.1 | 1 |
+--------------+---------------+---------------+-------------+
6 rows in set (0.001 sec)