#!/bin/bash

mkdir -p /root/resource-monitor

cd /root/resource-monitor

wget https://download.cloudclusters.io/resource-monitor.py

cd ~

/root/env/bin/pip install prometheus_client

cat <<EOF > /etc/supervisor/conf.d/resource-monitor.conf
[program:resource-monitor]
command=/root/env/bin/python /root/resource-monitor/resource-monitor.py
autostart=true
autorestart=true
stderr_logfile=/var/log/resource-monitor.err.log
stdout_logfile=/var/log/resource-monitor.out.log
EOF

supervisorctl update

supervisorctl status

netstat -atnpl|grep 9177

ufw allow from 108.181.95.28 to any port 9177 proto tcp


