Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

cpu usage reported by port 311

I am using Nagios to monitor my servers (one Linux box and one Mac Mini Server with Mountain Lion, all upgrades installed).


For the Mac server, I was using check_osx_server plugin, which is using port 311 to get information from the OS-X server. After the last upgrade (I am not sure if it started with the 10.8.2 upgrade or the latest supplemental upgrade), the CPU Usage reported by the server is very strange. The thing is, it's not Nagios which is reporting wrong numbers, it is the server itself which is returning erroneous values. You can check this by opening a browser window and point it to https://yourserver.com:311 and then select servermgr_info and then from the drop-down menu getHardwareInfo and click Send Command. That XML document returned from the server, is where check_osx_server plugin is getting its numbers from.


What I have found so far:


1. When you first power up the server, if you check the CPU usage you get a number with 20-something digits. This is crazy, because the number reported is supposed to be less than 10000, since that number is divided by 100, to show you the CPU Usage percentage.


2. The number remains the same for ever. Obviously, the CPU Usage changes with time, and that was reported accordingly, in the past. Now this number changes only if you run Server.app in the server or on a remote Mac. It changes to a more meaningful number (four digits, since this number has to be divided by 100, to get the CPU Usage percentage), but again, it remains the same for ever, until you close Server.app and re-run it. It also changes, if you go to the Stats in Server.app and change the default period from 4 hours, to 1 hour, but not if you change from one hour to 4 or 24h. Here is a sample of the XML file returned:


> <?xml version="1.0" encoding="UTF-8"?>

> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"

> "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0">

> <dict>

> <key>command</key>

> <string>getHardwareInfo</string>

> <key>cpuUsageBy100</key>

> <integer>9183</integer>

> <key>cpuUsagesBy100Array</key>

> <array>

> <dict>

> <key>cpuUsage-0</key>

> <integer>9094</integer>

> </dict>

> <dict>

> <key>cpuUsage-1</key>

> <integer>9272</integer>

> </dict>

> </array>


There are more lines, but I have cut the file for brevity.


3. Again, as long as the Server.app is running, the CPU Usage reported does NOT change. Only if you quit Server.app and re-run it, it changes.


From the above, it is clear that port 311 is no longer reporting the momentary CPU Usage, but some other value, which is stored somewhere and is not updated unless you run Server.app.


Has anyone else noticed this behavior?

Posted on Oct 11, 2012 4:25 AM

Reply
17 replies

Oct 21, 2012 5:51 AM in response to John Caradimas

Can someone who has access to a Mac Mini Server running Mountain Lion, try this? Just point a browser to your server port 311 (https://yourserver.com:311) and select servermgr_info and then from the drop-down menu getHardwareInfo and click Send Command. Then notice the number below <key>cpuUsageBy100</key> and then refresh the page (do a reload). Does the number change for you??

Nov 23, 2012 3:42 PM in response to henningkessler

I am afraid you are right. Unfortunately, the new "Server.app" is nowhere near being an industry standard, so I wonder how will sysadmins where Mac Servers coexist with other machines will manage their servers farm. I mean, with that serveradmin interface, you could monitor your Mac servers in the same way you monitor your Linux machines. Now, how can one monitor a Mac in a mixed environment is anyone's guess. Something tells me that Apple is no longer interested in being a server manufacturer, which means that sooner or later my poor Mac Mini Server will be delegated to other tasks.


Thanks for confirming my findings, I was very surprised that no one has noticed this so far.

Nov 24, 2012 1:17 PM in response to John Caradimas

Well lets see how things are developing...


But if your issues are about how to monitor your mac servers than you should probably have look at SNMP as very capable possibility, as you can integrate it very well into nagios and even extend it with own scripts running some nice severadmin commands and grap information from that.


http://www.bynkii.com/archives/2007/12/a_primer_to_snmp_on_mac_os_x_1.html

Nov 24, 2012 2:05 PM in response to henningkessler

I'll check your link later tomorrow, but I am not sure if SNMP can monitor the same services as libsrvrmgrd-osx can via Nagios and the port 311. Right now, I have a one-page monitoring report, which shows me everything I need to know about all my routers and servers. I have no idea how I can replicate that via SNMP.


I'll get back after I check your link.


Again, many thanks!

Apr 18, 2013 7:25 AM in response to John Caradimas

I know this is an older thread but I thought that I would reply with my findings.


John is correct, you need to open Server.app to unstick the cpu integer, then it will change once and stick again until you close and re-open the app again.


I haven't found a way to get it to refresh properly yet, SNMP might be the best way around it.


Interestingly enough on a 10.8.3 server I have just installed I get the error below (exactly the same as above). Same command returns correctly on a server running 10.7.4 so I guess its a 10.8.3 thing.


ERROR: Problem Contacting Server:<urlopen error [Errno 8] _ssl.c:490: EOF occurred in violation of protocol>

cpu usage reported by port 311

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.