This is all the options i get.ctrl W (for write) I believe it shows at the bottom of the nano screen the different commands
This is all the options i get.ctrl W (for write) I believe it shows at the bottom of the nano screen the different commands
Sorry, I was mixing up editors. Crtl-O for write, then Ctrl-X to exit. (write = save)This is all the options i get.
View attachment 22509
I'm assuming you're using nano. If yes, then:How do I save the freenas_health.sh?
Thanks
See in the white bar where it's asking for the file name to write, and the correct file name is filled in? Press Enter.I did ^O and now I get these options.
That worked. For some reason I thought I needed to select one of the options on the bottom.See in the white bar where it's asking for the file name to write, and the correct file name is filled in? Press Enter.
Thanks for this... I didn't realize that this was normal behavior or the implications of there being a newer release.No, the configuration has always reloaded at midnight, that is normal for a long time.
The consul version is a new thing but it is only indicating that there is a newer version of the software available and not an issue.
If the code shown here:If the GUI is not alerting you to an error, why are you convinced that there is an error?
/usr/local/bin/midclt call notifier.get_alerts > /tmp/.alert-health if [ $? -ne 0 ] ; then exit 1 fi
/usr/local/bin/midclt call notifier.get_alerts
doing? sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
is spawning a bunch of processes, but I have no idea what is actually happening. (Have there been any changes to the reporting code? Could a poorly reported error give a blank line instead of a proper message?)Thanks @Mamdoh I will try this in an hour, appreciate the fix.
Edit: Seems like the only thing missing were the lines
if [ -z $line ] ; then
continue
fi
Gone for now, thanks
fi echo "$line" have_alert=1 done < /tmp/.alert-health rm /tmp/.alert-health
fi echo "$line" have_alert=0 done < /tmp/.alert-health rm /tmp/.alert-health
It's due out with -U2, but I don't know the ETA on that.Not sure when it'll get into a released update though.
alternatively justI just applied a proper fix. Full credit goes to @David Steinberger (see link). Steps I followed:
Step one:
cd /usr/local/etc/consul-checks/
nano freenas_health.sh
Edited contents to (go through the edit line by line and make sure it's correct; simple paste can delete some escape characters, resulting in multiple commands in one line):
Code:#!/bin/sh PATH="${PATH}:/usr/local/bin:/usr/local/sbin" export PATH /usr/local/bin/midclt call notifier.get_alerts > /tmp/.alert-health if [ $? -ne 0 ] ; then exit 1 fi have_alert=0 while read line do if [ -z $line ] ; then continue fi echo $line | grep -q "^OK" if [ $? -eq 0 ] ; then continue fi echo "$line" have_alert=1 done < /tmp/.alert-health rm /tmp/.alert-health if [ $have_alert -eq 0 ] ; then echo "No Alerts" exit 0 else exit 1 fi
Step two: (not needed if you haven’t edited usr/local/etc/consul.d/freenas.json)
cd /usr/local/etc/consul.d
nano freenas.json
I changed the the interval back to 120s.
Code:"interval": "120s"
Step three:
Executed the following in shell:
service consul stop
rm -rf /var/db/system/consul
service consul start
wget
cd /usr/local/etc/consul-checks mv freenas_health.sh freenas_health.sh.bak wget https://raw.githubusercontent.com/davidsteinberger/freenas/8bf0718c1c3a09f8189c5150c0e22f3dbc4e77e9/src/freenas/usr/local/etc/consul-checks/freenas_health.sh # grant execute to the file chmod +x freenas_health.sh
ok.. so.. did this..I just applied a proper fix. Full credit goes to @David Steinberger (see link). Steps I followed:
Step one:
cd /usr/local/etc/consul-checks/
nano freenas_health.sh
Edited contents to (go through the edit line by line and make sure it's correct; simple paste can delete some escape characters, resulting in multiple commands in one line):
Code:#!/bin/sh PATH="${PATH}:/usr/local/bin:/usr/local/sbin" export PATH /usr/local/bin/midclt call notifier.get_alerts > /tmp/.alert-health if [ $? -ne 0 ] ; then exit 1 fi have_alert=0 while read line do if [ -z $line ] ; then continue fi echo $line | grep -q "^OK" if [ $? -eq 0 ] ; then continue fi echo "$line" have_alert=1 done < /tmp/.alert-health rm /tmp/.alert-health if [ $have_alert -eq 0 ] ; then echo "No Alerts" exit 0 else exit 1 fi
Step two: (not needed if you haven’t edited usr/local/etc/consul.d/freenas.json)
cd /usr/local/etc/consul.d
nano freenas.json
I changed the the interval back to 120s.
Code:"interval": "120s"
Step three:
Executed the following in shell:
service consul stop
rm -rf /var/db/system/consul
service consul start
was kinda concerned that the /var/db/system/consul folder didn't get re-created by anything ..1. Yes, assuming it was there in the first place (-f suppresses any output).
2. Right.
Jan 26 09:31:07 freenas daemon[16739]: 2018/01/26 09:31:07 [WARN] agent: Check 'service:nas-health' is now warning Jan 26 09:33:07 freenas daemon[16739]: 2018/01/26 09:33:07 [WARN] agent: Check 'service:nas-health' is now warning Jan 26 09:35:07 freenas daemon[16739]: 2018/01/26 09:35:07 [WARN] agent: Check 'service:nas-health' is now warning
I'm currently experiencing a latent error is not being handled properly.It doesn't say what the issue is, because there isn't really an issue. It's an erroneous entry.
#!/bin/sh PATH="${PATH}:/usr/local/bin:/usr/local/sbin" export PATH /usr/local/bin/midclt call notifier.get_alerts > /CUSTOM/temp-alert-health-debug /usr/local/bin/midclt call notifier.get_alerts > /tmp/.alert-health if [ $? -ne 0 ] ; then exit 1 fi have_alert=0 while read line do if [ -z $line ] ; then continue fi echo $line | grep -q "^OK" if [ $? -eq 0 ] ; then continue fi echo "$line" have_alert=1 done < /tmp/.alert-health rm /tmp/.alert-health if [ $have_alert -eq 0 ] ; then echo "No Alerts" exit 0 else exit 1 fi
[ENOMETHOD] Method "get_alerts" not found in "notifier" Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/notifier.py", line 66, in __getattr__ return object.__getattribute__(self, attr) AttributeError: 'NotifierService' object has no attribute 'get_alerts' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 881, in _method_lookup methodobj = getattr(serviceobj, method_name) File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/notifier.py", line 68, in __getattr__ return getattr(_n, attr) AttributeError: 'notifier' object has no attribute 'get_alerts' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 150, in call_method result = await self.middleware.call_method(self, message) File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 109, in __next__ return self.gen.send(None) File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 889, in call_method serviceobj, methodobj = self._method_lookup(message['method']) File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 883, in _method_lookup raise CallError(f'Method "{method_name}" not found in "{service}"', CallError.ENOMETHOD) middlewared.service_exception.CallError: [ENOMETHOD] Method "get_alerts" not found in "notifier"
#>ls -la /var/db/system/consul ls: /var/db/system/consul: No such file or directory
service consul stop rm -rf /var/db/system/consul service consul start
Traceback (
) to capture the error for troubleshooting.I rebooted the system and the problem cleared. (It should be noted that /var/db/system/consul is still non-existent after a reboot.)
Yes, we talked about this above. We need someone on 11.1-U1 who did not attempt this fix (or at least did not run "rm -rf /var/db/system/consul") to tell us if the file exists at all in a "clean" 11.1-U1. My present assumption is that it does not.
My attempts to use this "fix" did not result in cessation of the messages BTW.
root@freenas:/var/db # la ./ hyperv/ nut/ samba4/ syslog-ng.persist ../ ipf/ pbi/ services.db zfsd/ collectd/ locate.database pkg/ sss/ zoneinfo dhclient.leases.vmx0 netdata/ ports/ sss_mc/ entropy/ ntp/ portsnap/ sudo/ freebsd-update/ ntpd.leap-seconds.list samba/ syslog-ng.ctl= root@freenas:/var/db #
I just rebooted in 11.1 release.. deleted 11.1-U1.. (with the applied fix).. re-updated to 11.1-U1Yes, we talked about this above. We need someone on 11.1-U1 who did not attempt this fix (or at least did not run "rm -rf /var/db/system/consul") to tell us if the file exists at all in a "clean" 11.1-U1. My present assumption is that it does not.
My attempts to use this "fix" did not result in cessation of the messages BTW.