From: Scott H. <tal...@ne...> - 2010-08-12 00:00:00
|
Hello, I am running smartmontools 5.39.1 on Mac OS X 10.6. I have installed it via MacPorts (source compiler system), which has given it the configure args of: configure.args --mandir=${prefix}/share/man \ --enable-drivedb \ --enable-savestates \ --enable-attributelog \ --enable-sample ${prefix} in my case is /opt/local My issue is with logging. On OS X the syslog is called system.log. The smartd man page states that logging will get directed to FACILITY or daemon [default]. Probably defaulting to 'messages'. Currently, with the above install arguments, nothing is logged at all. The only way I know it may be working is that I have set up emails to be sent. The way MacPorts works is that it can only modify (for the most part) files within it's own ${prefix}. So editing syslog.conf is not the preferred way to solve this It would be an edit that has to be explained to all users who install smartmontools on Mac OS X through MacPorts. I would rather get smartmontools to log to the /var/log/system.log by default. smartd is started with a launchd (cron like system on BSD/OSX) item via this command: /opt/local/sbin/smartd -n /etc/syslog.conf has this relevant line: *.notice;authpriv,remoteauth,ftp,install,internal.none /var/log/system.log I believe that to solve this, I will need to alter the smartd -n command to add -l FACILITY, --logfacility=FACILITY though I am not certain which value I should add. Thanks for any pointers. -- Scott (* For off-list contact, replace talklists@ with scott@ *) |
From: <cf...@im...> - 2010-08-12 02:14:22
|
On Wed 11th Aug, 2010 at 16:44, Scott Haneda seems to have written: > Hello, > > I am running smartmontools 5.39.1 on Mac OS X 10.6. I have installed it via MacPorts (source compiler system), which has given it the configure args of: > > configure.args --mandir=${prefix}/share/man \ > --enable-drivedb \ > --enable-savestates \ > --enable-attributelog \ > --enable-sample > > ${prefix} in my case is /opt/local > > My issue is with logging. On OS X the syslog is called system.log. The smartd man page states that logging will get directed to FACILITY or daemon [default]. Probably defaulting to 'messages'. > > Currently, with the above install arguments, nothing is logged at all. The only way I know it may be working is that I have set up emails to be sent. The way MacPorts works is that it can only modify (for the most part) files within it's own ${prefix}. So editing syslog.conf is not the preferred way to solve this It would be an edit that has to be explained to all users who install smartmontools on Mac OS X through MacPorts. > > I would rather get smartmontools to log to the /var/log/system.log by default. > > smartd is started with a launchd (cron like system on BSD/OSX) item via this command: > /opt/local/sbin/smartd -n > > /etc/syslog.conf has this relevant line: > *.notice;authpriv,remoteauth,ftp,install,internal.none /var/log/system.log > > I believe that to solve this, I will need to alter the smartd -n command to add > -l FACILITY, --logfacility=FACILITY > though I am not certain which value I should add. On 10.4, I use this: /usr/local/sbin/smartd -p /var/run/smartd.pid -l local3 -c \ /usr/local/etc/smartd.conf in a StartupItem. (This usually means I couldn't make it work with launchd.) I seem to have configured with the single option: '--with-initscriptdir=/Library/StartupItems' but I think some of the options MacPorts gives are also the defaults (e.g. drive database etc.). I use this with a customised log facility specified in syslog.conf: local3.* /usr/local/var/log/smartd.log which you obviously don't wish to do. On the version of smartmontools I'm using (5.38), the man page specifies the values as one of local0-7. On my machine, most of these are not directed anywhere in particular by syslog.conf by default certainly not to system.log. So no argument passed to smartd with -l would do what you want here. However, you would still get messages of sufficient importance logged to system.log, I think, even though you will not get the routine status messages. I think probably you already know all this, however. Incidentally and not that my view matters, it strikes me as odd to have a policy of non-modification with respect to configuration files but to be quite happy directing the output from MacPorts software to system.log. I would personally be more bothered about keeping the latter distinct than the former. (But then that's why I use the setup described, I suppose.) Good luck, cfr > Thanks for any pointers. > |
From: Scott H. <tal...@ne...> - 2010-08-12 02:58:31
|
Thanks for the answers, a few questions below... On Aug 11, 2010, at 7:14 PM, cf...@im... wrote: > On 10.4, I use this: > /usr/local/sbin/smartd -p /var/run/smartd.pid -l local3 -c \ > /usr/local/etc/smartd.conf > in a StartupItem. (This usually means I couldn't make it work with launchd.) Ok, I should be able to manage that in launchd. I did try on the command line, just starting smartd with -l local3 as you have, but I was unable to get it to report anything to the log at all. I could use `logger` as follows: logger -p local3.debug "this is a test log" and that would send the line to system.log, but smartd would not. Perhaps it won't when started from the command line? Does smartd have to fork in order for the logging to happen? I read in the man page that using -d for debug will halt the logging and send logging to stdout, but even stopping that and I was still not able to get log data to show up. > I use this with a customised log facility specified in syslog.conf: > local3.* /usr/local/var/log/smartd.log > which you obviously don't wish to do. Yes, ideally I would avoid that. However, in my tests, I did try that, along with the above steps, and only would the `logger` command work. > On the version of smartmontools I'm using (5.38), the man page > specifies the values as one of local0-7. On my machine, most of these > are not directed anywhere in particular by syslog.conf by default > certainly not to system.log. So no argument passed to smartd with -l > would do what you want here. What about the daemon log facility? Does OS X handle that at all? > However, you would still get messages of sufficient importance logged to > system.log, I think, even though you will not get the routine status > messages. It is strange, I was not able to get a single line to ever log. I will try your start command. I was hoping there would be a way to modify the source to allow one of the logging facilities to be more friendly to OS X. I just started looking through it to see how much of a mess I would make of things to go that route. > Incidentally and not that my view matters, it strikes me as odd to have > a policy of non-modification with respect to configuration files but to > be quite happy directing the output from MacPorts software to > system.log. I would personally be more bothered about keeping the > latter distinct than the former. (But then that's why I use the setup > described, I suppose.) This is sort of a unique case. My my decision than their policy. I suspect if I were to re-read the layout guidelines, it would be suggested that the logging data end up in MacPorts prefix under var/log as well. However, that is still not going to stop me from needing to alter syslog.conf. The main idea behind not modifying system files is that Apple can and does change them during software updates. The more self contained things are, the less chance they have of breaking. For example, Apache logs within MacPorts prefix. My Pure-FTPd port logs within the prefix as well. I am just trying to find the best way to solve this, which very well may mean altering the portfile and submitting the changes to MacPorts. First I have to get it to actually work in test though. Thanks for the help. -- Scott (* For off-list contact, replace talklists@ with scott@ *) |
From: <cf...@im...> - 2010-08-12 14:04:57
|
On Wed 11th Aug, 2010 at 19:58, Scott Haneda seems to have written: > Thanks for the answers, a few questions below... > > On Aug 11, 2010, at 7:14 PM, cf...@im... wrote: > >> On 10.4, I use this: >> /usr/local/sbin/smartd -p /var/run/smartd.pid -l local3 -c \ >> /usr/local/etc/smartd.conf >> in a StartupItem. (This usually means I couldn't make it work with launchd.) > > Ok, I should be able to manage that in launchd. I did try on the command line, just starting smartd with -l local3 as you have, but I was unable to get it to report anything to the log at all. I could use `logger` as follows: > logger -p local3.debug "this is a test log" > and that would send the line to system.log, but smartd would not. Perhaps it won't when started from the command line? I wouldn't expect that to make a difference but setting -l local3 won't have any effect unless local3 is directed somewhere in syslog.conf, I think. > Does smartd have to fork in order for the logging to happen? I read in the man page that using -d for debug will halt the logging and send logging to stdout, but even stopping that and I was still not able to get log data to show up. > >> I use this with a customised log facility specified in syslog.conf: >> local3.* /usr/local/var/log/smartd.log >> which you obviously don't wish to do. > > Yes, ideally I would avoid that. However, in my tests, I did try that, along with the above steps, and only would the `logger` command work. smartd is *very* quiet. For example, here's the current contents of my log file: Aug 12 02:01:19 CyfrifiadurCFR smartd[107]: Device: /dev/disk0, SMART Usage Attribute: 194 Temperature_Celsius changed from 107 to 103\n Aug 12 02:31:20 CyfrifiadurCFR smartd[107]: Device: /dev/disk0, SMART Usage Attribute: 194 Temperature_Celsius changed from 103 to 105\n Aug 12 03:01:19 CyfrifiadurCFR smartd[107]: Device: /dev/disk0, SMART Usage Attribute: 194 Temperature_Celsius changed from 105 to 107\n Aug 12 14:01:20 CyfrifiadurCFR smartd[107]: Device: /dev/disk0, SMART Usage Attribute: 194 Temperature_Celsius changed from 107 to 106\n Aug 12 14:31:19 CyfrifiadurCFR smartd[107]: Device: /dev/disk0, SMART Usage Attribute: 194 Temperature_Celsius changed from 106 to 107\n So it is very possible that there were simply no log messages during the time you looked. >> On the version of smartmontools I'm using (5.38), the man page >> specifies the values as one of local0-7. On my machine, most of these >> are not directed anywhere in particular by syslog.conf by default >> certainly not to system.log. So no argument passed to smartd with -l >> would do what you want here. > > What about the daemon log facility? Does OS X handle that at all? I think so but I assumed from the man page that smartmontools would only accept a value of local0-7 for facility. However, maybe that's not right. Or maybe it is different in 5.39.1. >> However, you would still get messages of sufficient importance logged to >> system.log, I think, even though you will not get the routine status >> messages. > > It is strange, I was not able to get a single line to ever log. I will try your start command. You will see messages of sufficient importance in the system log only if things are going wrong. I saw no messages from smartd in system.log (only the routine ones in smartd.log) for years. Only when my disk was failing did I see messages logged to system.log. > I was hoping there would be a way to modify the source to allow one of the logging facilities to be more friendly to OS X. I just started looking through it to see how much of a mess I would make of things to go that route. > >> Incidentally and not that my view matters, it strikes me as odd to have >> a policy of non-modification with respect to configuration files but to >> be quite happy directing the output from MacPorts software to >> system.log. I would personally be more bothered about keeping the >> latter distinct than the former. (But then that's why I use the setup >> described, I suppose.) > > This is sort of a unique case. My my decision than their policy. I suspect if I were to re-read the layout guidelines, it would be suggested that the logging data end up in MacPorts prefix under var/log as well. However, that is still not going to stop me from needing to alter syslog.conf. > > The main idea behind not modifying system files is that Apple can and does change them during software updates. The more self contained things are, the less chance they have of breaking. For example, Apache logs within MacPorts prefix. My Pure-FTPd port logs within the prefix as well. I know that's the idea but sometimes it feels more like working against the system rather than with it! > I am just trying to find the best way to solve this, which very well may mean altering the portfile and submitting the changes to MacPorts. First I have to get it to actually work in test though. > > Thanks for the help. You're welcome. Maybe one of the smartmontools experts will have a better idea - I am certainly not in that category! Best, cfr |
From: Scott H. <tal...@ne...> - 2010-08-12 04:13:52
|
On Aug 11, 2010, at 7:14 PM, cf...@im... wrote: > Incidentally and not that my view matters, it strikes me as odd to have > a policy of non-modification with respect to configuration files but to > be quite happy directing the output from MacPorts software to > system.log. I would personally be more bothered about keeping the > latter distinct than the former. (But then that's why I use the setup > described, I suppose.) The more that I think about this, and looking at some of the --with configure options, I am wondering... Please keep in mind, I am pretty new to the inner processes of source and make files, so if this is way out of line, please explain why it is a bad approach so I can learn from it. If I can set mandir, sbindir, docdir, initscriptdir etc, would it not also be beneficial to set syslog dir and syslog file, as well as perhaps the name of the facilities? Or is this purely a Mac OS X issue in that it was decided to use system.log for syslog instead of messages as I see on most other OS's? Thanks -- Scott (* For off-list contact, replace talklists@ with scott@ *) |
From: <cf...@im...> - 2010-08-12 14:13:05
|
On Wed 11th Aug, 2010 at 21:13, Scott Haneda seems to have written: > On Aug 11, 2010, at 7:14 PM, cf...@im... wrote: > >> Incidentally and not that my view matters, it strikes me as odd to have >> a policy of non-modification with respect to configuration files but to >> be quite happy directing the output from MacPorts software to >> system.log. I would personally be more bothered about keeping the >> latter distinct than the former. (But then that's why I use the setup >> described, I suppose.) > > The more that I think about this, and looking at some of the --with configure options, I am wondering... > > Please keep in mind, I am pretty new to the inner processes of source and make files, so if this is way out of line, please explain why it is a bad approach so I can learn from it. Somebody else will hopefully answer this for you. > If I can set mandir, sbindir, docdir, initscriptdir etc, would it not also be beneficial to set syslog dir and syslog file, as well as perhaps the name of the facilities? And this. I'm not sure but I think it may be because smartmontools is using the standard logging facilities of the OS. I have a limited understanding of this but I believe the way this works is that an application sends messages to the logging daemon which then directs them according to the configuration specified in syslog.conf. So it isn't possible to specify the directory or file to be used for logging directly to smartmontools because smartmontools doesn't handle that aspect of things. All it does is pass messages to the system logging daemon with a facility tag. To actually determine where messages tagged for that facility go, you have to tell the logging daemon rather than smartmontools. I don't know whether you could set something up so that smartmontools sent log messages to standard error and standard error was redirected to the file of your choice. That's the only thing I can think of. But, as I say, somebody is bound to know more about this than I do. > Or is this purely a Mac OS X issue in that it was decided to use system.log for syslog instead of messages as I see on most other OS's? I have no idea how things work on other systems. What happens to the messages? Good luck, cfr > Thanks > |
From: Bill D. <va...@ch...> - 2011-06-16 16:55:22
|
<cfrees <at> imapmail.org> writes: > > On Wed 11th Aug, 2010 at 16:44, Scott Haneda seems to have written: > > My issue is with logging... Sorry I don't have an answer yet, but I'll let you know what I've found... I also use the smartd from macports smartmontools-port, and wanted smartd to routinely write to some log file. I'll follow-up with some testing results. I've got something like debian's smart-notify working for windows, and am trying to do so for mac os x as well. The other major shortcoming in darwin-osx seems to be that it does not support smartctrl --offlineauto=on flag per http://sourceforge.net/mailarchive/message.php?msg_id=26943608 Even with newest 5.41: $ ./smartctl --offlineauto=on disk0 smartctl 5.41 2011-06-09 r3365 [x86_64-apple-darwin10.7.0] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF ENABLE/DISABLE COMMANDS SECTION === Error SMART Enable Automatic Offline failed: Operation not supported Smartctl: SMART Enable Automatic Offline Failed. Yet I can boot the very same intel mac from a live linux cd and this works fine: smartctrl --offlineauto=on /dev/sda And after rebooting back to mac-os-x it now shows "Auto offline data collection: enabled" so the setting sticks. Go figure: darwin/osx is an odd bird. Also, about getting smartd to automatically run after each reboot... I recall having to do some tweaks so that macports launched smartd correctly via launchd. You don't have to use the launchctl long-winded command, but, as port-install now mentions, you can set it up to run as a daemon by just typing: sudo /opt/local/bin/port load smartmontools They only remind you once during the install script: ########################################################### # A startup item has been generated that will aid in # starting smartmontools with launchd. It is disabled # by default. Execute the following command to start it, # and to cause it to launch at startup: # # sudo port load smartmontools ########################################################### Above command really does set up smartd as the startup item on all 10.5 and 10.6 boxes I've tried but see notes below. BTW I think the port load command works for other ports like mysql, apache, etc. Somewhat equivalent to this in linux: chkconfig smartd on, /etc/init.d/smartd start Originally smartd kept crashing, so ran it with -d and found I had to create path or fix permissions where darwin-ports smartd wants to write log-like files namely: /opt/local/var/lib/smartmontools Works on both 10.6-intel and 10.5-ppc boxes I've tested. Now if I can figure out a way to periodically log to a plain flat text file. I don't trust the new mac syslog database system: if there's one place you want simplicity, it is the logging system! And don't get me started on those #$%#+@ plists. Entire transcript below... $ sudo /opt/local/bin/port selfupdate ---> Updating the ports tree ---> Updating MacPorts base sources using rsync MacPorts base version 1.9.2 installed, MacPorts base version 1.9.2 downloaded. ---> MacPorts base is already the latest version The ports tree has been updated. To upgrade your installed ports, you should run port upgrade outdated $ sudo /opt/local/bin/port -v upgrade outdated Error: No ports matched the given expression $ sudo /opt/local/bin/port install smartmontools ---> Fetching smartmontools ---> Attempting to fetch smartmontools-5.40.tar.gz from http://voxel.dl.sourceforge.net/smartmontools ---> Verifying checksum(s) for smartmontools ---> Extracting smartmontools ---> Applying patches to smartmontools ---> Configuring smartmontools ---> Building smartmontools ---> Staging smartmontools into destroot ---> Creating launchd control script ########################################################### # A startup item has been generated that will aid in # starting smartmontools with launchd. It is disabled # by default. Execute the following command to start it, # and to cause it to launch at startup: # # sudo port load smartmontools ########################################################### ---> Installing smartmontools @5.40_3 ---> Activating smartmontools @5.40_3 ---> Cleaning smartmontools $ sudo /opt/local/bin/port load smartmontools $ ps -ef | grep -i smart 501 143 118 0 0:01.18 ?? 0:02.40 /Applications/SMARTReporter/SMARTReporter.app/Contents/MacOS/SMARTReporter -psn_0_45067 0 5840 1 0 0:00.01 ?? 0:00.01 /opt/local/bin/daemondo --label=smartd --start-cmd /opt/local/sbin/smartd -p /opt/local/var/run/smartd.pid ; --pid=fileauto --pidfile /opt/local/var/run/smartd.pid 0 5843 1 0 0:00.01 ?? 0:00.01 /opt/local/sbin/smartd -p /opt/local/var/run/smartd.pid 501 7631 3687 0 0:00.01 ttys001 0:00.01 grep -i smart By the way, the fellow that wrote SMARTReporter said it's once-per-hour querry should not interfere with any long self-tests since in effect it only does "smartctl -l selftest disk0" which does not interrupt any tests. That is the way gsmartcontrol gives a progress bar of the self-test. The fink gsmartcontrol can be run on mac os x, at least I got it to run in 10.5. In an X11 xterm window type sudo /sw/bin/gsmartcontrol |