What's new

Tempmon.sh script not logging to syslog

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

M

MvW

Guest
Pinging @Maverickcdn

First of all, thanks for the script you wrote, I wish I had discovered it sooner.

I downloaded and installed tempmon.sh but it's not logging to syslog. I verified it's running, but it only prints out temps to the terminal when starting, nothing gets in to syslog. Could that be because I uses syslog-ng and Scribe with ScribeUI?

Code:
marco@RT-AC86U:/tmp/home/root# cru l
*/5 * * * * /jffs/scripts/tempmon.sh logging #tempmon#

Code:
marco@RT-AC86U:/tmp/home/root# cat /jffs/scripts/services-start
#!/bin/sh
/jffs/nextdns/nextdns.init start
/jffs/scripts/tempmon.sh

Code:
marco@RT-AC86U:/tmp/home/root# ps | grep tempmon
2214 marco     3392 S    sh /jffs/scripts/tempmon.sh monitor

The files temps.tmp, temps_ath.tmp and temps_atl.tmp in /tmp are being created as well.

Any clues how to solve this?

Thanks in advance.

Best regards,
Marco
 
Sorry... updated tempmon on github with an alternate logging method if scribe is present.... give it a try and report back
 
  • Like
Reactions: MvW
Thanks for your efforts. I downloaded the new version.

First of all I noticed that when starting the script I now see busybox output that I didn't see before:

Code:
marco@RT-AC86U:/tmp/home/root# sh /jffs/scripts/tempmon.sh
Initializing...
BusyBox v1.25.1 (2021-03-10 11:45:34 EST) multi-call binary.

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

        [-s,--set] TIME Set time to TIME
        -u,--utc        Work in UTC (don't convert to local time)
        -R,--rfc-2822   Output RFC-2822 compliant date string
        -I[SPEC]        Output ISO-8601 compliant date string
                        SPEC='date' (default) for date only,
                        'hours', 'minutes', or 'seconds' for date and
                        time to the indicated precision
        -r,--reference FILE     Display last modification time of FILE
        -d,--date TIME  Display TIME, not 'now'
        -D FMT          Use FMT for -d TIME conversion

Recognized TIME formats:
        hh:mm[:ss]
        [YYYY.]MM.DD-hh:mm[:ss]
        YYYY-MM-DD hh:mm[:ss]
        [[[[[YY]YY]MM]DD]hh]mm[.ss]
        'date TIME' form accepts MMDDhhmm[[YY]YY][.ss] instead
Started tempmon.sh w/ PID 22733 Current CPUtemp:58.6C Log Interval:5m PollFreq:5s

Second, which is most likely related, the output to messages is printed without a timestamp. This is directly copied from System Messages from within ScribeUI.

Code:
 tempmon[22707]: Started tempmon.sh w/ PID 22733 Current CPUtemp:59.1C Log Interval:5m PollFreq:5s
 tempmon[22867]: CPUnow: 58.1C CPUavg: 58.3C CPUhigh: 58.1C CPUlow: 58.1C Uptime CPUhigh: 61.0C Uptime CPUlow: 57.1C
 tempmon[22867]: LogPeriod: 5m PollFreq: 5s Rec: 2/60 Current Monitor PID: 22733
 tempmon[28389]: CPUnow: 58.1C CPUavg: 57.9C CPUhigh: 59.6C CPUlow: 57.6C Uptime CPUhigh: 61.0C Uptime CPUlow: 57.1C
 tempmon[28389]: LogPeriod: 5m PollFreq: 5s Rec: 60/60 Current Monitor PID: 22733

Could you please take another look at it, if you can find the time?

Thanks for your efforts.

Best regards,
Marco
 
Bah, forgot to quote the date, at least the rest of the output made it to the log! Sorry, made a fix to github, should prefix the date/time now in the logged messages
 
  • Like
Reactions: MvW
Excellent! Thanks for the quick fix!

Code:
marco@RT-AC86U:/tmp/home/root# sh /jffs/scripts/tempmon.sh
Initializing...
Started tempmon.sh w/ PID 15872 Current CPUtemp:58.6C Log Interval:5m PollFreq:5s

Code:
Mar 16 19:50:29 tempmon[15847]: Started tempmon.sh w/ PID 15872 Current CPUtemp:59.1C Log Interval:5m PollFreq:5s

Thanks again!

Best regards,
Marco
 
Bah, forgot to quote the date, at least the rest of the output made it to the log! Sorry, made a fix to github, should prefix the date/time now in the logged messages
I'm confused as to why logger isn't printing correctly, it's supposed to send to syslog which scribe should be reading
 
I'm confused as to why logger isn't printing correctly, it's supposed to send to syslog which scribe should be reading
Was quite literally just about to post the same query. I thought the logger command was part of syslog-ng

Im at work (shh dont tell anyone Im doggin it) didnt have time to really research and just cobbled a 'workaround'
 
Was quite literally just about to post the same query. I thought the logger command was part of syslog-ng

Im at work (shh dont tell anyone Im doggin it) didnt have time to really research and just cobbled a 'workaround'
logger is part of the firmware
 
logger is part of the firmware
Thats why you're the guru;) (my presumption was syslog-ng supplemented its own logger process)

Is a user able to manually kill the process? maybe his isnt running?
 
Don't ask me :) I just noticed that tempmon didn't output to the log and now after the modifications it does. I only changed the frequency in the script and left at the rest of the code as is, as far as I'm aware. Maybe I screwed something up in the original version, I hope I didn't cause you too much trouble.
 
It was running, it said so when I tried to start it and showed its PID.
Not tempmon.sh....

My script uses the command 'logger' to send messages to the log. I cobbled a fix for your issue by directly writing to the syslog.

I've never used scribe and unsure how it substitutes itself for the default logging..... hopefully someone with more knowledge can help out here.
 
I guess the bigger issue for you would be that technically any other scripts (maybe more?) that rely on the logger command should also fail to log.

First test would be from an ssh prompt try
Code:
logger -t testing "test log message 123"

And see if it appears in your log
 
I guess the bigger issue for you would be that technically any other scripts (maybe more?) that rely on the logger command should also fail to log.

First test would be from an ssh prompt try
Code:
logger -t testing "test log message 123"

And see if it appears in your log
Looks fine to me:

Code:
Mar 16 20:40:42 RT-AC86U testing: test log message 123
 
I see in another thread you were playing with filters, what's the chances you were trying tempmon at the same time and maybe accidentally killed syslogd or had a failed restart of scribe?
 
None, as far as I can see. I have no gaps in syslog and I only once have restarted scribe, which went fine.
I did have to reboot before my logfile got filled and must admit I haven't checked whether tempmon had output as well by that time, as I was too focussed on the logfile being filled with nextdns.

One other thing I just noticed: the lines tempmon is outputting to syslog appear to be the only ones missing my hostname after the timestamp. Could it be you missed that in your workaround.

If you want me to, I can try the original script again, and reboot after installation to see if that makes a difference? I don't know how to find older version on Github, so if you could post any directions that would be great.
 
One other thing I just noticed: the lines tempmon is outputting to syslog appear to be the only ones missing my hostname after the timestamp. Could it be you missed that in your workaround.

If you want me to, I can try the original script again, and reboot after installation to see if that makes a difference? I don't know how to find older version on Github, so if you could post any directions that would be great.

Ya my work around only logged what I explicitly coded for (date/time/PID/name)

If you wouldn't mind trying it out again fresh, would put my mind at ease lol

I reverted the commits on github, please delete tempmon.sh from your router and reinstall and let us know.
 
Ya my work around only logged what I explicitly coded for (date/time/PID/name)

If you wouldn't mind trying it out again fresh, would put my mind at ease lol

I reverted the commits on github, please delete tempmon.sh from your router and reinstall and let us know.
I just installed fresh and I can see the script being started, but only after I rebooted my RT-AC86U. I manually started it, it looked fine, but it didn't give any output. After I rebooted I see the script being started from services-start. I'm heading off to bed now, will checking in the morning if it has actually printed it's results to syslog-ng during the night.

Sorry for causing you unnecessary work, allthough I still don't get why I have to reboot to have the results be printed to system log. This install is only a few weeks old and I have barely made any modifications, so I have trouble understanding why things are behaving differently then expected.
 
I just installed fresh and I can see the script being started, but only after I rebooted my RT-AC86U. I manually started it, it looked fine, but it didn't give any output. After I rebooted I see the script being started from services-start. I'm heading off to bed now, will checking in the morning if it has actually printed it's results to syslog-ng during the night.

Sorry for causing you unnecessary work, allthough I still don't get why I have to reboot to have the results be printed to system log. This install is only a few weeks old and I have barely made any modifications, so I have trouble understanding why things are behaving differently then expected.
No problem at all, its a learning experience for me, I wouldn't have made it public if I wasn't willing to help out with user issues

Fingers crossed!
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top