Multi-Port Port Generation Script

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
IncompleteString
Posts: 33
Joined: Wed May 01, 2019 11:57 pm

Multi-Port Port Generation Script

Post by IncompleteString »

I created a python script to automatically generate the entries you need to add to your ports.conf and virtual host file to enable multi port.

I have 76 monitors at one site and I screwed up the entires I needed to make in the ports.conf and virtual hosts file to configure multi-port so many times that I decided to write a script to automate the task.

The script will ask you what you would you like to use as the starting port number, how many monitors you have and if you are using HTTPS or not and generate the appropriate entries for you to copy and paste as well as where to put them on a ubuntu system.

The script can be found here:
https://github.com/IncompleteString/mul ... -generator


you run it like this:

Code: Select all

python multi_port_generator.py
An example of using the script follows:

Code: Select all

$ multi_port_generator.py 
Enter your starting port number:3000
Enter your number of monitors:10
If you use HTTPS enter 1:1
 
 
Paste the following into your /etc/apache2/sites-available/000-default-le-ssl.conf OR default-ssl.conf at the line that begins with <VirtualHost *:443
 
 
*:3001 *:3002 *:3003 *:3004 *:3005 *:3006 *:3007 *:3008 *:3009 *:3010  
 
Paste the following into your /etc/apache2/ports.conf file at the line starting with listen 443
 
 
Listen 3001 https
Listen 3002 https
Listen 3003 https
Listen 3004 https
Listen 3005 https
Listen 3006 https
Listen 3007 https
Listen 3008 https
Listen 3009 https
Listen 3010 https


and http mode:

Code: Select all

$ multi_port_generator.py 
Enter your starting port number:30000
Enter your number of monitors:10
If you use HTTPS enter 1:2
 
 
Paste the following into your /etc/apache2/sites-available/000-default.conf at the line that begins with <VirtualHost *:80
 
 
*:30001 *:30002 *:30003 *:30004 *:30005 *:30006 *:30007 *:30008 *:30009 *:30010  
 
Paste the following into your /etc/apache2/ports.conf file at the line starting with listen 80
 
 
Listen 30001
Listen 30002
Listen 30003
Listen 30004
Listen 30005
Listen 30006
Listen 30007
Listen 30008
Listen 30009
Listen 30010
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Multi-Port Port Generation Script

Post by iconnor »

Um, good work!

There is also a util in the utils dir that comes with ZM called generate_apache_config.pl that does this.
IncompleteString
Posts: 33
Joined: Wed May 01, 2019 11:57 pm

Re: Multi-Port Port Generation Script

Post by IncompleteString »

ROFL, I wish I had known that
Post Reply