Hello There, Guest!  
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

/usr/local/share/nems/nems-scripts/stats-livestatus.py - Errno 111 on startup

#1
Hey Robbie,

I think I discovered a very minor processing issue here on startup. Over the weekend, I installed apticron so that I can get email when updates are available on the NEMS box. It's a standard I do on all my Raspberry Pi servers. Side Note: I am aware that NEMS automatically applies security updates as I reading that in another forum. I just prefer to know when I have updates and apticron sends the package details on what the updates are.

Anyway since I now get email notifications on cron jobs, I get the ones when a cron job fails. Whenever I startup NEMS, I get this email notification error:

Traceback (most recent call last):
  File "/usr/local/share/nems/nems-scripts/stats-livestatus.py", line 35, in <module>
    main()
  File "/usr/local/share/nems/nems-scripts/stats-livestatus.py", line 15, in main
    s.connect(socket_path)
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused
Traceback (most recent call last):
  File "/usr/local/share/nems/nems-scripts/stats-livestatus.py", line 35, in <module>
    main()
  File "/usr/local/share/nems/nems-scripts/stats-livestatus.py", line 15, in main
    s.connect(socket_path)
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused

I believe I understand what's going on here. The python file loads at reboot and NEMS isn't quite "fully initialized". Hence the cron job fails and now I get this email since I have apticron installed. It may be best to have add in a sleep 60 to put in a one minute delay. I would edit the crontab job, but I know that it's discouraged to manually edit config files. So just an idea down the road as a possible enhancement to NEMS.
 Reply
#2
Thanks so much. I didn't catch this, and your little email script has revealed it :)

Yes, you're bang-on. stats-livestatus.py connects to Nagios via [you guessed it] the livestatus socket. Well, I didn't think to add errorhandling if the socket isn't yet initialized (eg., Nagios hasn't loaded yet).

Rather than a sleep 60 as you suggest, I will modify the program to wait until the socket becomes ready.

Will push that out today. Thanks again.

Robbie
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
 Reply
#3
Patch issued. Please run: sudo nems-update

Then, reboot and let me know if the error is gone.

Cheers!
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
 Reply
 
 
Forum Jump:

Users browsing this thread: 1 Guest(s)