LR 0.4.11:

- Service Manager updated
- Docker files updated
- Bug fixed for x86 arch

Change-Id: I1e584c3d57641f2eb3112b728e5691da7f4c9814
This commit is contained in:
Nicola Peditto 2019-07-02 15:03:28 +02:00
parent 071908ec73
commit 6b20cfcc9c
6 changed files with 143 additions and 5 deletions

View File

@ -789,7 +789,7 @@ def wampConnect(wamp_conf):
LOG.warning("WAMP Connection Failure timer: EXPIRED")
lr_utils.LR_restart()
global connFailure
global connFailure # da valutare la rimozione
connFailure = Timer(CONF.connection_failure_timer, timeout)
connFailure.start()
LOG.warning("WAMP Connection Failure timer: STARTED")

View File

@ -1142,8 +1142,8 @@ class ServiceManager(Module.Module):
else:
message = rpc_name + " result: " + s_uuid \
+ " already removed!"
LOG.error(" - " + message)
w_msg = WM.WampError(msg=message, req_id=req_id)
LOG.warning(" - " + message)
w_msg = WM.WampSuccess(msg=message, req_id=req_id)
except Exception as err:
message = "Updating services.json error: " + str(err)

View File

@ -17,7 +17,7 @@ RUN sed -i 's/# server_names_hash_bucket_size 64;/server_names_hash_bucket_size
RUN rm -rf /var/lib/apt/lists/*
RUN npm install -g --unsafe @mdslab/wstun@1.0.10 && npm cache --force clean
RUN npm install -g --unsafe @mdslab/wstun@1.0.11 && npm cache --force clean
RUN pip3 install iotronic-lightningrod
@ -26,6 +26,7 @@ RUN sed -i "s|80 default_server;|50000 default_server;|g" /etc/nginx/sites-avail
COPY data/lr_configure /usr/local/bin/lr_configure
COPY data/lr_install /usr/local/bin/lr_install
COPY data/lr_checks /usr/local/bin/lr_checks
COPY data/startLR /usr/local/bin/startLR
RUN /usr/local/bin/lr_install

68
utils/docker/arm/data/lr_checks Executable file
View File

@ -0,0 +1,68 @@
#!/usr/bin/python3
# lr_checks v1.0.1
import psutil
import subprocess
start_checks=True
print(
"\n###############################\n"
" Lightning-rod checks v1.0.1\n"
"###############################\n")
""" CONNECTIONS """
try:
res_pid = subprocess.Popen("ps aux | grep '/bin/lightning-rod' |grep -v grep| awk '{print $2}'", shell=True, stdout=subprocess.PIPE)
lr_pid = res_pid.communicate()[0].decode("utf-8").split("\n")[0]
if(lr_pid == ""):
start_checks = False
print(" - LR not running")
else:
print("\nLR PID: " + str(lr_pid))
except Exception as e:
print("LR pid error: " + str(e))
start_checks = False
if start_checks:
lr_socket = None
proc = psutil.Process(int(lr_pid))
conn_list = proc.connections()
#print(str(conn_list))
print("\nLR open connections:")
check=False
for socks in conn_list:
print(" - " + str(socks))
#print(socks.raddr, socks.fd)
if socks.raddr != () :
if socks.raddr.port == 8181:
#print(socks.raddr.port, socks.fd)
#break;
check=True
lr_socket = [socks.raddr.port, socks.fd]
if check:
print("\nLR WAMP socket:" + " port[" +str(lr_socket[0]) + "] - FD[" + str(lr_socket[1]) + "]")
""" LSOF """
res_lsof = subprocess.Popen("lsof -i -n -P | grep '8080\|8181'| grep -v grep", shell=True, stdout=subprocess.PIPE)
sockets = res_lsof.communicate()[0].decode("utf-8").split("\n")
print("\nS4T sockets opened: ")
for socks in sockets[:-1]:
print(" - " + str(socks))
""" PS """
res_ps = subprocess.Popen("ps aux | grep 'wstun\|lightning' | grep -v grep", shell=True, stdout=subprocess.PIPE)
ps_s4t = res_ps.communicate()[0].decode("utf-8").split("\n")
print("\nS4T running processes: ")
for socks in ps_s4t[:-1]:
print(" - " + str(socks))

View File

@ -19,7 +19,7 @@ RUN sed -i 's/# server_names_hash_bucket_size 64;/server_names_hash_bucket_size
RUN rm -rf /var/lib/apt/lists/*
RUN npm install -g --unsafe @mdslab/wstun@1.0.10 && npm cache --force clean
RUN npm install -g --unsafe @mdslab/wstun@1.0.11 && npm cache --force clean
RUN pip3 install iotronic-lightningrod
@ -28,6 +28,7 @@ RUN sed -i "s|80 default_server;|50000 default_server;|g" /etc/nginx/sites-avail
COPY data/lr_configure /usr/local/bin/lr_configure
COPY data/lr_install /usr/local/bin/lr_install
COPY data/lr_checks /usr/local/bin/lr_checks
COPY data/startLR /usr/local/bin/startLR
RUN /usr/local/bin/lr_install

View File

@ -0,0 +1,68 @@
#!/usr/bin/python3
# lr_checks v1.0.1
import psutil
import subprocess
start_checks=True
print(
"\n###############################\n"
" Lightning-rod checks v1.0.1\n"
"###############################\n")
""" CONNECTIONS """
try:
res_pid = subprocess.Popen("ps aux | grep '/bin/lightning-rod' |grep -v grep| awk '{print $2}'", shell=True, stdout=subprocess.PIPE)
lr_pid = res_pid.communicate()[0].decode("utf-8").split("\n")[0]
if(lr_pid == ""):
start_checks = False
print(" - LR not running")
else:
print("\nLR PID: " + str(lr_pid))
except Exception as e:
print("LR pid error: " + str(e))
start_checks = False
if start_checks:
lr_socket = None
proc = psutil.Process(int(lr_pid))
conn_list = proc.connections()
#print(str(conn_list))
print("\nLR open connections:")
check=False
for socks in conn_list:
print(" - " + str(socks))
#print(socks.raddr, socks.fd)
if socks.raddr != () :
if socks.raddr.port == 8181:
#print(socks.raddr.port, socks.fd)
#break;
check=True
lr_socket = [socks.raddr.port, socks.fd]
if check:
print("\nLR WAMP socket:" + " port[" +str(lr_socket[0]) + "] - FD[" + str(lr_socket[1]) + "]")
""" LSOF """
res_lsof = subprocess.Popen("lsof -i -n -P | grep '8080\|8181'| grep -v grep", shell=True, stdout=subprocess.PIPE)
sockets = res_lsof.communicate()[0].decode("utf-8").split("\n")
print("\nS4T sockets opened: ")
for socks in sockets[:-1]:
print(" - " + str(socks))
""" PS """
res_ps = subprocess.Popen("ps aux | grep 'wstun\|lightning' | grep -v grep", shell=True, stdout=subprocess.PIPE)
ps_s4t = res_ps.communicate()[0].decode("utf-8").split("\n")
print("\nS4T running processes: ")
for socks in ps_s4t[:-1]:
print(" - " + str(socks))