Appendix J Multiple Instances of Genmon - jgyates/genmon GitHub Wiki

Running Multiple Instances of Genmon

This page describes how to run multiple instances of genmon on one system. As of version 1.13.08 genmon supports multiple instances running simultaneously. You are limited by system memory and resources as the the number of instances.

The genmon program typically runs out of the /home/pi/genmon/ directory and the configuration data is stored in /etc/genmon/. To run another instance of genmon an additional set of configuration data must be created in a separate directory. The installation process will :

  1. Install the required libraries needed to run genmon
  2. Create a set of configuration files in the /etc/genmon/ folder by default.
  3. Modify the system crontab so genmon will be loaded when the system boots

The default settings for the initial installation uses the following relevant parameters:

  • /etc/genmon/genmon.conf - server_port = 9082
  • /etc/genmon/genmon.conf - loglocation = /var/log/
  • /etc/genmon/genmon.conf - http_port = 8000 (or https_port=443 if secure web interface is used)
  • /etc/genmon/genmon.conf - multi_instance = True

The first three parameters listed above and the location of all of the configuration files must be unique for each instance of gennmon. The final parameter (multi_instance) must be True in all copies of genmon.conf

To create a separate instance of genmon you will need to address 2 and 3 from the list above for each new instance of genmon.

To create a set of configuration files use the following command:

 bash ./genmonmaint.sh -s -c /home/pi/generator1/

This will create a set of configuration files in the /home/pi/generator1/ folder. Then modify the entries in the genmon.conf file in the newly created directory.

The installation process will create the following entry in the crontab file for the root user to start genmon when the system boots:

 @reboot sleep 30 && /bin/bash /home/pi/genmon/startgenmon.sh start

You will need to edit the crontab file by typing:

 sudo crontab -e

You can specify the nano editor if you are prompted, then add a line similar to this one for each instance of genmon:

@reboot sleep 30 && /bin/bash /home/pi/genmon/startgenmon.sh start -c /home/pi/generator1/

Notice the last parameter is the folder of the configuration files. To exit the nano editor type Ctrl+X, then press Y to save.

Once you reboot all instances specified in the crontab should start.

The following is a bash script that can be used to start multiple instances of genmon:

mygens=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22")

for t in ${mygens[@]}; do
    sudo bash /home/gen/genmon/startgenmon.sh restart -c /etc/genmon/gen$t/
done

To stop you could do this:

mygens=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22")

for t in ${mygens[@]}; do
    sudo bash /home/gen/genmon/startgenmon.sh stop -c /etc/genmon/gen$t/
done