Plugin for Monitoring CPU Temperature

Status
Not open for further replies.

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
While I'm not an AMD fan, I don't want to see them dead either. But AMD used to do fairly well for themselves in the server markets, and they've stupidly hurt that market by getting rid of developers. When AMD did that many people made the argument that the executives were deliberately killing the company in the name of short-term profits.
 

George Kyriazis

Dabbler
Joined
Sep 3, 2013
Messages
42
Well, the problem is that Intel provides a spec for monitoring temps and they have provided developers to handle that code. AMD is much less supportive of anything that isn't Windows. But, the fact that I said AMD as well as non-server boards are often a problem and your setup is both of those I think the answer is fairly likely.

So statistically your problem is probably related to owning AMD. I'm not sure how much more in-depth you can go though as it should be something that "works" or "doesn't work". AMDs seem to just have weird quirks. Some work well, some don't. I can't vouch for your situation because I just take the stance that if you read our stickies and still buy AMD that's on you to solve. I've avoided AMDs for quite a few years now because Intel just flat out provides better software support for their hardware.

This isn't fanboy-ism or anything like that. 2 summers ago AMD laid off 1/2 of their developers that maintained open-source software like FreeBSD, Linux, etc. You can't do that kind of thing and expect quality to remain. And believe me, people have noticed.


Point taken.

The other machine that I have is also AMD (albeit a bit older; it's a HP ProLiant Microserver), and temps work fine over there. I hope it's just a matter of time; it's not that paramount that I know the temperature; I'm just migrating some scripts from my old machine..

BTW, the reason why I got an AMD motherboard is that I can get 8 SATA ports on the motherboard without having to get an extra card. For the price, it's a good deal.

From a certain point of view, though, you pay the price (in $$) for the better software support that Intel has. Intel HW is (in general) more expensive.

One would hope that AMD is going to change stance on open-source soon. (fingers crossed)
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
BTW, the reason why I got an AMD motherboard is that I can get 8 SATA ports on the motherboard without having to get an extra card.


An excellent example of putting the cart ahead of the horse. You picked a CPU type based on finding a motherboard with a feature that allows you to avoid buying a $15 SATA card.

Next time, you'd be better off determining the feature set required in the server, then picking hardware that supports that, and just adding the SATA ports with a card if it comes down to that.

You're now stuck with a suboptimal board that, yay, has two extra SATA ports but has crap for brains.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
You are correct that you pay more for all of the extras that Intel provides. But if you look through the forum there's lots of AMD users that are kicking themselves for not going Intel. Many have been so disgusted with limitations that they've bought Intel just to solve their problems. So while you might be okay with just missing out on monitoring the temperatures, there's plenty of evidence that the extra cost of going Intel is well worth it.

Also the compatibility of AMD and FreeBSD isn't as good as Intel, and while you are only mildly inconvenienced with missing out on temperatures there are people that have non-viable systems and cannot use FreeNAS because it won't even boot. As someone that isn't rolling in cash and given a choice between saving some cash but having hardware that might not work or spending a little more and be given virtual 100% certainty that things will "just work" I'll go with paying a little more. You also must factor in that hardware that you buy today must also be compatible with future FreeBSD/FreeNAS images. Guess which manufacturer may not be providing much support in the future? So I also don't want to end up in a situation where I'm happily using FreeNAS for a while and then suddenly I can't do any updates because my hardware isn't compatible.
 

George Kyriazis

Dabbler
Joined
Sep 3, 2013
Messages
42
An excellent example of putting the cart ahead of the horse. You picked a CPU type based on finding a motherboard with a feature that allows you to avoid buying a $15 SATA card.

Next time, you'd be better off determining the feature set required in the server, then picking hardware that supports that, and just adding the SATA ports with a card if it comes down to that.

You're now stuck with a suboptimal board that, yay, has two extra SATA ports but has crap for brains.


Thank you for your comments, but please, enough AMD bashing.

I've set up 4 FreeNAS/FreeBSD boxes, all with AMD HW (for various reasons). Never had any problems with them. They've been running flawlessly for years.

In this particular case, chassis size and ability to stuff as many disks as a can in that size is of utmost importance. Small size IS part of the feature set (actually the most important one) in this particular build. Based on my previous track of successful AMD builds, choosing this setup was an easy choice.

In fact, I've had bad previous experience with external cards, which pushed me towards a motherboard with maximum number of SATA ports.

Please don't make assumptions when you don't know all the facts. Not everybody wants to build a big server.

Thank you!
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
Well, we aren't AMD bashing. We're bashing a product that is inadequate for FreeNAS. If you want us to sit here and promote products based on the name and not the actual product itself you should go elsewhere. I hate AMD with a passion personally, but I do NOT make the claims that AMDs are inadequate because "I don't like them". Not only is it very much a personal opinion, but there's no way I could defend my perspective with facts.

Sorry, but you just made yourself look like a fool by telling the two highest posters in the forums things like "when you don't know all the facts". If you knew all the facts you wouldn't be here...
 

George Kyriazis

Dabbler
Joined
Sep 3, 2013
Messages
42
Well, we aren't AMD bashing. We're bashing a product that is inadequate for FreeNAS. If you want us to sit here and promote products based on the name and not the actual product itself you should go elsewhere. I hate AMD with a passion personally, but I do NOT make the claims that AMDs are inadequate because "I don't like them". Not only is it very much a personal opinion, but there's no way I could defend my perspective with facts.

Sorry, but you just made yourself look like a fool by telling the two highest posters in the forums things like "when you don't know all the facts". If you knew all the facts you wouldn't be here...


The point for having something be open-source is that it will improve over time given the collective efforts of the community. Promoting one company over another makes sense, but the hidden benefit of that is that the non-promoted company may listen and do something about its position. That is my hope about AMD. Similarly, community members may hear a rant and go fix something that is broken.

I have my reasons for not liking Intel (basically I dislike their corporate culture; I've dealt with both Intel and AMD at the corporate level), but similar with your opinions, that's a personal view.

jgreco's post was a bit abrasive in that he assumed that I didn't do my homework, when, in fact, I was mulling over what HW to get for over 6 months. Priorities are not the same for all people. That's what was I was annoyed about.

Having said all that, thank you all for the response to my initial question (regarding the temperature monitoring).

Cheers...
 

Yatti420

Wizard
Joined
Aug 12, 2012
Messages
1,437
The point for having something be open-source is that it will improve over time given the collective efforts of the community. Promoting one company over another makes sense, but the hidden benefit of that is that the non-promoted company may listen and do something about its position. That is my hope about AMD. Similarly, community members may hear a rant and go fix something that is broken.

I have my reasons for not liking Intel (basically I dislike their corporate culture; I've dealt with both Intel and AMD at the corporate level), but similar with your opinions, that's a personal view.

jgreco's post was a bit abrasive in that he assumed that I didn't do my homework, when, in fact, I was mulling over what HW to get for over 6 months. Priorities are not the same for all people. That's what was I was annoyed about.

Having said all that, thank you all for the response to my initial question (regarding the temperature monitoring).

Cheers...


You spent 6 months picking this hardware? I could care less what CPU you run (aslong as it supports what is necessary for a sucessful FreeNAS box) but not following the rules regarding FreeNAS setups can land you in some hot water.. Nobody has said yet that your hardware is inadequate for a build.. So I thought I would post this reminder as your hardware lacks what is actually required for a FreeNAS box with peace of mind imho.. I'm not quite sure why you are annoyed.. It's pretty clear you chose to ignore some pretty drastic advice/rules/threads with all this information posted.. Including the documentation..

Good luck!
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
The point for having something be open-source is that it will improve over time given the collective efforts of the community. Promoting one company over another makes sense, but the hidden benefit of that is that the non-promoted company may listen and do something about its position. That is my hope about AMD. Similarly, community members may hear a rant and go fix something that is broken.

...and the very "non-hidden" benefit is that your stuff may just NEVER be supported. There's tons of companies that just don't support FreeBSD at all. Look at Realtek. They may have more NIC chips out in production environments than any other manufacturer, yet they don't give a damn about FreeBSD and barely give a damn about Linux.

I have my reasons for not liking Intel (basically I dislike their corporate culture; I've dealt with both Intel and AMD at the corporate level), but similar with your opinions, that's a personal view.

That's totally fine. But you should also realize that with your choice you may also be implying that FreeNAS isn't ever going to work well for you.

jgreco's post was a bit abrasive in that he assumed that I didn't do my homework, when, in fact, I was mulling over what HW to get for over 6 months. Priorities are not the same for all people. That's what was I was annoyed about.

Well, he's put tons of time into the hardware threads. He's basically "the man" when it comes to writing the stickies on hardware. I do more esoteric stuff and I do how-to guides. From your choice of hardware and your reasoning, that was basically a slap in the face for him because he's worked very hard to provide the information so you could make an informed choice. He doesn't like seeing people waste money on dead-end systems. And your choice, in his eyes as well as mine, wasn't the most logical. It's one thing when you can understand the thought process even if you wouldn't have done it. But in your case I'm having a very very hard time justifying to myself how you chose to go AMD and go with your hardware over 2 silly SATA ports. There's dozens and dozens of boards out there with 8 SATA ports, both AMD and Intel. So arguing that you had to go AMD for 8 ports, which you did when you said "BTW, the reason why I got an AMD motherboard is that I can get 8 SATA ports on the motherboard without having to get an extra card" is kind of hogwash. I can get 10 port Intel boards. That doesn't really say much.

In conclusion, all we're seeing is you went AMD because of your hatred for Intel as there's no real logical reasoning for your purchase of AMD. Well, that's great and you are entitled to your opinion, but don't expect your AMD to work as well as your typical Intel when the body of evidence supporting Intel as just being flat out better(even if more expensive) is very conclusive. That's the reality of it, whether either of us like it or not.
 

marian78

Patron
Joined
Jun 30, 2011
Messages
210
ok now someone needs to setup a cron job to output this to a file, and then build a plugin to pull the data into a purdy graph

Hi, today i experiment with small scripting (cron schedule) . It check temperature of all CPUs and if it over max, send mail. Can you check if it work for you?

Edit 10.10.2014:

Today I added error checking (as best I know) as mentioned "cyberjock". Now when a break occurs in the identification number of CPU, it will send error mail. And if cant detect temperature or is equal "0",it will send error mail.

Code:
#!/bin/sh
 
#warning temperature
WARNING="55"
 
#error temperature - dont change
ERRTEMP="0"
 
#path to work file
FPATH="/mnt/volume1/cputemp.txt"
 
#mail settings
#account
EMAIL="yourmail@gmail.com"
 
#freenas server name
SERVER="yourservername"
 
#get number of processors
NCPU=$( sysctl hw.ncpu | awk '{ print $2 }' )
#run only if no error
if [ $? -eq 0 ]; then
 
    #check if NCPU is not 0
    if [ $NCPU -ne 0 ]; then
   
        #prepare mail
        if [ -f "$FPATH" ]; then
            rm $FPATH
            if [ $? -ne 0 ]; then
                # cant delete old work file
                exit 0
            fi
        fi
        echo "To: $EMAIL" >> $FPATH
   
        #run only if work file exist
        if [ -f "$FPATH" ]; then
            echo "Subject: CPU temperature on server $SERVER" >> $FPATH
            M="false"
       
            #get processors temperatures
            for n in `jot ${NCPU} 0`; do
                TEMP=$( sysctl dev.cpu.${n}.temperature | sed -e 's|.*: \([0-9.]*\)C|\1|' )
                # run only if get TEMP
                if [ $(echo "$ERRTEMP<$TEMP" | bc) -ne 0 ]; then
                    #compare with max temperature
                    if [ $(echo "$WARNING<$TEMP" | bc) -ne 0 ]; then
                        #if HOT then M=1
                        M="true"
                        echo "WARNING, HIGH CPU${n} temperature: $TEMP C" >> $FPATH
                    fi
                else
                    M="true"
                    echo "ERROR, CPU${n} temperature is under $ERRTEMP C or cant get temperature" >> $FPATH
                fi
            done
   
            #send mail
            if [ "$M" == "true" ]; then
                sendmail -t < $FPATH
            fi
        else
            exit 1
        fi
    else
        #prepare mail if NCPU is 0 or error
        if [ -f "$FPATH" ]; then
            rm $FPATH
            if [ $? -ne 0 ]; then
                # cant delete old work file
                exit 2
            fi
 
        fi
   
        echo "To: $EMAIL" >> $FPATH
   
        #run only if work file exist
        if [ -f "$FPATH" ]; then
            echo "Subject: CPU temperature on server $SERVER" >> $FPATH
            echo "ERROR, zero CPUs" >> $FPATH
            sendmail -t < $FPATH
        else
            exit 3
        fi
    fi
else
    #prepare mail if error with get NCPU
    if [ -f "$FPATH" ]; then
        rm $FPATH
        if [ $? -ne 0 ]; then
            # cant delete old work file
            exit 4
        fi
    fi
   
    echo "To: $EMAIL" >> $FPATH
   
    #run only if work file exist
    if [ -f "$FPATH" ]; then
        echo "Subject: CPU temperature on server $SERVER" >> $FPATH
        echo "ERROR, cant get number of CPUs" >> $FPATH
        sendmail -t < $FPATH
    else
        exit 5
    fi
fi
 
if [ -f "$FPATH" ]; then
    rm $FPATH
fi
 
exit 6
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
Two things marian78: (I can't check this on my box unfortunately.. long story).

1. What if the sysctl doesn't exist? Do you get an email or does it gracefully quit? I know a lot of AMD hardware doesn't support temperature support.
2. If you get validation that this works can you make your own thread with this info.. I'll put it in the guides section if you do. ;) Just PM me after you post it so I don't skip over it on accident.
 

marian78

Patron
Joined
Jun 30, 2011
Messages
210
You can replace my path in script....;)
 
Status
Not open for further replies.
Top