├── check_osx_mem ├── check_osx_mem_Prefix.pch ├── check_osx_mem.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── jedda.xcuserdatad │ │ │ └── WorkspaceSettings.xcsettings │ ├── xcuserdata │ │ └── jedda.xcuserdatad │ │ │ ├── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ ├── Release.xcscheme │ │ │ └── check_osx_mem.xcscheme │ │ │ └── xcdebugger │ │ │ └── Breakpoints.xcbkptlist │ ├── jedda.pbxuser │ ├── project.pbxproj │ └── jedda.mode1v3 ├── README └── check_osx_mem.m ├── check_daylite_postgres.sh ├── check_od_bind.sh ├── check_od_auth.sh ├── check_od_bdb.sh ├── notify_by_boxcar.sh ├── LICENSE ├── check_file_age.sh ├── check_apns_reachability.sh ├── check_osx_hostname.sh ├── check_certificate_expiry.sh ├── check_crashplan_currency.sh ├── check_crashplan_currency_gnu.sh ├── check_apc_smt750_battery.sh ├── check_folder_size.sh ├── check_ccc_currency.sh ├── check_osx_smc ├── README.md ├── known-registers.md ├── check_osx_smc │ ├── smc.h │ ├── smc.c │ └── check_osx_smc.m └── check_osx_smc.xcodeproj │ └── project.pbxproj ├── README.md ├── check_osx_dhcp.sh ├── notify_by_pushover.sh ├── check_radius.sh ├── check_time_machine_currency.sh ├── check_osx_swupdate.sh ├── check_ssl_certificate_expiry.sh ├── check_ssl_certificate_expiry_gnu.sh ├── check_osx_launchd.sh ├── check_kerio_connect_stats.sh ├── check_od_status.sh ├── check_smart.sh └── check_osx_caching.sh /check_osx_mem/check_osx_mem_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'check_osx_mem' target in the 'check_osx_mem' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /check_osx_mem/README: -------------------------------------------------------------------------------- 1 | check_osx_mem 2 | by Jedda Wignall 3 | http://jedda.me 4 | 5 | v1.0 - 12 Mar 2012 6 | Initial release. 7 | 8 | Tool to report OSX memory utilization to nagios and Groundwork server. 9 | Requires -w and -c values as percentage utilization. Returns lots of performance data. 10 | ./check_osx_mem -w 65.00 -c 85.00 11 | -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/project.xcworkspace/xcuserdata/jedda.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /check_daylite_postgres.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Daylite Postgres 4 | # by Dan Barrett 5 | # http://yesdevnull.net 6 | 7 | # v1.0 - 9 Aug 2013 8 | # Initial release. 9 | 10 | # Checks to make sure the user _dayliteserver has spawned at least one Postgres process 11 | 12 | # Example: 13 | # ./check_daylite_postgres.sh 14 | 15 | result=`ps aux -o tty | grep _dayliteserver` 16 | if echo $result | grep -q postgres; then 17 | printf "OK - Daylite has spawned at least one Postgres instance.\n" 18 | exit 0 19 | else 20 | printf "CRITICAL - Daylite has no Postgres instances running!.\n" 21 | exit 2 22 | fi -------------------------------------------------------------------------------- /check_od_bind.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Open Directory client bind 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.0 - 21 Feb 2012 8 | # Initial release. 9 | 10 | # Super simple script that id's a potential user in your directory service. 11 | # Takes one argument (user short name) and checks to see if id returns group information: 12 | # ./check_od_bind.sh diradmin 13 | 14 | # We use this on our OD bound mail server to ensure it is getting directory information from our master or replica. 15 | 16 | if echo `id $1` | grep -q "uid" 17 | then 18 | printf "OK - $1 was id'd successfully\n" 19 | exit 0 20 | else 21 | printf "CRITICAL - Could not id $1\n" 22 | exit 2 23 | fi 24 | -------------------------------------------------------------------------------- /check_od_auth.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Open Directory authentication 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.0 - 21 Feb 2012 8 | # Initial release. 9 | 10 | # Script that uses dscl -authonly to make sure user authentication is working for your directory. 11 | # Takes two arguments (user shortname, user password) and checks to make sure that said user can authenticate: 12 | # ./check_od_auth.sh diradmin password 13 | 14 | # We use this on our OD master to ensure auth is up, and that password server and slapd are happy. 15 | 16 | if dscl /LDAPv3/127.0.0.1 -authonly $1 $2; then 17 | printf "OK - OD authentication succeeded."; 18 | exit 0 19 | else 20 | printf "CRITICAL - OD authentication FAILED!"; 21 | exit 2 22 | fi 23 | -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/xcuserdata/jedda.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Release.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | check_osx_mem.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 8DD76F960486AA7600D96B5E 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /check_od_bdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Open Directory BDB databases 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.1 - 07 Jan 2013 8 | # Added check for root user. 9 | 10 | # v1.0 - 27 Mar 2012 11 | # Initial release. 12 | 13 | # This script verifies each of the .bdb files in /var/db/openldap/openldap-data/*.bdb and returns 14 | # a critical status if verification fails. You really only need to have this run once a day, or even weekly. 15 | 16 | # This script must run with root privilege. 17 | 18 | if [[ $EUID -ne 0 ]]; then 19 | printf "ERROR - This script must be run as root.\n" 20 | exit 3 21 | fi 22 | 23 | for db in /var/db/openldap/openldap-data/*.bdb 24 | do 25 | result=`db_verify -q "$db"` 26 | if [ $? != 0 ]; then 27 | printf "CRITICAL: $db failed verification!\n" 28 | exit 2 29 | fi 30 | done 31 | 32 | printf "OK - All bdb databases verified.\n" 33 | exit 0 -------------------------------------------------------------------------------- /notify_by_boxcar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Notify by Boxcar 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.0 - 21 May 2012 8 | # Initial release. 9 | 10 | # This script pushes a Boxcar notification to your account, based on the passed arguments. 11 | # 12 | # Takes the following REQUIRED arguments: 13 | # 14 | # -e Your Boxcar registered email address. 15 | # -h The affected host. 16 | # -m The notification text. 17 | 18 | # IMPORTANT 19 | # You will need to subscribe to the "Monitoring" generic provider with this command before this will work (sub. in your boxcar account): 20 | # curl -d "email=your-boxcar-registered-email@example.com" http://boxcar.io/devices/providers/MH0S7xOFSwVLNvNhTpiC/notifications/subscribe 21 | 22 | while getopts "e:h:m:" optionName; do 23 | case "$optionName" in 24 | e) boxcarEmail=( "$OPTARG" );; 25 | h) host=( "$OPTARG" );; 26 | m) message=( "$OPTARG" );; 27 | esac 28 | done 29 | 30 | curl --ssl --data-urlencode "email=$boxcarEmail" \ 31 | --data-urlencode "¬ification[from_screen_name]=$host" \ 32 | --data-urlencode "¬ification[icon_url]=http://jedda.me/assets/BoxcarMonitoringIcon.png" \ 33 | --data-urlencode "¬ification[message]=$message" \ 34 | https://boxcar.io/devices/providers/MH0S7xOFSwVLNvNhTpiC/notifications 35 | 36 | exit 0 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognise copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to -------------------------------------------------------------------------------- /check_file_age.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check file age 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.0 - 21 Feb 2012 8 | # Initial release. 9 | 10 | # Script that checks the last modification date of a file, and warns if a certain threshold of minutes has passed since last modification. 11 | # Takes two arguments (file path, minutes): 12 | # ./check_file_age.sh /test.txt 3600 13 | 14 | # There are plenty of file age scripts on nagios exchange, but I wanted a portable bash version 15 | # (not reliant on working perl or python installs) that could report on single files.check 16 | 17 | # We use this on heaps of our monitored Macs to check a range of things: 18 | # 19 | # Ensure currency of pgsql dumps on Lion Server 20 | # ./check_file_age.sh /Library/Server/PostgreSQL/Backups/dumpall.sql 3600 21 | # 22 | # Check currency of locally stored CrashPlan backups 23 | # ./check_file_age.sh /Volumes/CP/484907427172245292/cpbf0000000000000000000/484907427172245292 1440 24 | # Check currency of locally stored CrashPlan backups 25 | 26 | 27 | if ! [ -f "$1" ]; 28 | then 29 | printf "CRITICAL - $1 does not exist!\n" 30 | exit 2 31 | fi 32 | 33 | if echo `find "$1" -mmin +$2` | grep -q "$1"; then 34 | printf "WARNING - $1 has NOT been modified within $2 minutes\n" 35 | exit 1 36 | else 37 | printf "OK - $1 was modified within $2 minutes\n" 38 | exit 0 39 | fi -------------------------------------------------------------------------------- /check_apns_reachability.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check APNS Reachability 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.1 - 21 Mar 2012 8 | # Added check of x.courier.push.apple.com:5223 9 | 10 | # v1.0 - 20 Mar 2012 11 | # Initial release. 12 | 13 | # This script checks the reachability of Apple's APNS servers. This can be very useful on remote Profile Manager 14 | # or Lion Server collaboration installs where you may not be the only one in control of the firewall. 15 | 16 | # Takes no arguments, as it simply looks for a connection. 17 | 18 | # check port 2195 at gateway.push.apple.com 19 | status="$(openssl s_client -connect gateway.push.apple.com:2195)"; sleep 2; 20 | if ! echo $status | grep -q 'CONNECTED'; then 21 | printf "CRITICAL - gateway.push.apple.com:2195 not responding" 22 | exit 2 23 | fi 24 | 25 | # check port 2196 at gateway.push.apple.com 26 | status="$(openssl s_client -connect gateway.push.apple.com:2196)"; sleep 2; 27 | if ! echo $status | grep -q 'CONNECTED'; then 28 | printf "CRITICAL - gateway.push.apple.com:2196 not responding" 29 | exit 2 30 | fi 31 | 32 | # check port 5223 at x.courier.push.apple.com 33 | status="$(openssl s_client -connect 1-courier.push.apple.com:5223)"; sleep 2; 34 | if ! echo $status | grep -q 'CONNECTED'; then 35 | printf "CRITICAL - 1-courier.push.apple.com:5223 not responding" 36 | exit 2 37 | fi 38 | 39 | # we are all good! 40 | printf "OK - APNS ports at gateway.push.apple.com are reachable" 41 | exit 0 -------------------------------------------------------------------------------- /check_osx_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Mac OS X Server Hostname 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.1 - 12 Aug 2013 8 | # Significant re-work. Now also does a forward and reverse lookup to ensure server DNS is healthy. 9 | 10 | # v1.0 - 20 Mar 2012 11 | # Initial release. 12 | 13 | # Simple script that makes sure the infamous changeip -checkhostname command returns a happy status. 14 | # It then does a forward and reverse lookup of the returned hostname and IP adress to make sure that DNS is healthy. 15 | 16 | checkHostname=`sudo /Applications/Server.app/Contents/ServerRoot/usr/sbin/changeip -checkhostname` 17 | regex="s.+=.([0-9].+)..Cu.+=.([a-z0-9.-]+).D" 18 | 19 | if echo $checkHostname | grep -q "The names match."; then 20 | [[ $checkHostname =~ $regex ]] 21 | if [ "${BASH_REMATCH[0]}" != "" ]; then 22 | forward=`dig ${BASH_REMATCH[2]} +short` 23 | reverse=`dig -x ${BASH_REMATCH[1]} +short` 24 | if [ "$forward" != "${BASH_REMATCH[1]}" ]; then 25 | printf "CRITICAL - DNS lookup of ${BASH_REMATCH[2]} yielded $forward. We expected ${BASH_REMATCH[1]}!\n" 26 | exit 2 27 | elif [ "$reverse" != "${BASH_REMATCH[2]}." ]; then 28 | printf "CRITICAL - Reverse DNS lookup of ${BASH_REMATCH[1]} yielded $reverse. We expected ${BASH_REMATCH[2]}.!\n" 29 | exit 2 30 | fi 31 | else 32 | printf "CRITICAL - Could not read hostname or IP! Run 'sudo changeip -checkhostname' on server!\n" 33 | exit 2 34 | fi 35 | printf "OK - Hostname is ${BASH_REMATCH[2]}. Forward and reverse lookups matched expected values.\n" 36 | exit 0 37 | else 38 | printf "CRITICAL - Hostname check returned non matching names!\n" 39 | exit 2 40 | fi 41 | -------------------------------------------------------------------------------- /check_certificate_expiry.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Mac OS X Server Certificate Expiry 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.1 - 17 Sep 2012 8 | # Fixed script to throw proper critical error if a cert cannot be loaded by openssl. 9 | 10 | # v1.0 - 20 Mar 2012 11 | # Initial release. 12 | 13 | # This script checks the expiry dates of all certificates in the /etc/certificates directory, and returns a warning if needed based on your defined number of days. 14 | # Takes 1 argument - the minimum number of days between today and cert expiry to throw a warning: 15 | # 16 | # check_certificate_expiry.sh 7 17 | # Warns if a certificate is set to expire in the next 7 days. 18 | 19 | CERTS=/etc/certificates/* 20 | currentDate=`date "+%s"` 21 | 22 | for c in $CERTS 23 | do 24 | fileType=`echo $c | awk -F . '{print $(NF-1)}'` 25 | if [ $fileType == 'cert' ]; then 26 | # read the dates on each certificate 27 | certDates=`openssl x509 -noout -in "$c" -dates 2>/dev/null` 28 | if [ -z "$certDates" ]; then 29 | # this cert could not be read. 30 | printf "CRITICAL - $c could not be loaded by openssl\n" 31 | exit 2 32 | fi 33 | notAfter=`echo $certDates | awk -F notAfter= '{print $NF}'` 34 | expiryDate=$(date -j -f "%b %e %T %Y %Z" "$notAfter" "+%s") 35 | diff=$(( $expiryDate - $currentDate )) 36 | warnSeconds=$(($1 * 86400)) 37 | if [ "$diff" -lt "0" ]; then 38 | # this cert is has already expired! return critical status. 39 | printf "CRITICAL - $c has expired!\n" 40 | exit 2 41 | elif [ "$diff" -lt "$warnSeconds" ]; then 42 | # this cert is expiring within the warning threshold. return warning status. 43 | printf "WARNING - $c will expire within the next $1 days.\n" 44 | exit 1 45 | fi 46 | fi 47 | done 48 | 49 | # all certificates passed testing. return OK status. 50 | printf "OK - Certificates are valid.\n" 51 | exit 0 52 | -------------------------------------------------------------------------------- /check_crashplan_currency.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Crashplan Currency 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | 8 | # v1.0.1 - 3 May 2012 9 | # Added comments and fixed broken bits. 10 | 11 | # v1.0 - 27 Apr 2012 12 | # Initial release. 13 | 14 | # This script checks the currency of a CrashPlan backup on Mac OS X. There is a different version for linux due to differences between date on BSD and GNU. 15 | # Takes three arguments ([-d] cp.properties file in backup destination, [-w] warning threshold in minutes, [-c] critical threshold in minutes): 16 | # ./check_crashplan_currency_gnu.sh -d /Volumes/Backups/52352423423424243/cp.properties -w 240 -c 1440 17 | 18 | currentDate=`date "+%s"` 19 | cpDirectory="" 20 | warnMinutes="" 21 | critMinutes="" 22 | 23 | while getopts "d:w:c:" optionName; do 24 | case "$optionName" in 25 | d) cpDirectory=("$OPTARG");; 26 | w) warnMinutes=( $OPTARG );; 27 | c) critMinutes=( $OPTARG );; 28 | esac 29 | done 30 | 31 | # check to see if the cp.properties file exists 32 | if ! [ -f "$cpDirectory" ]; 33 | then 34 | printf "CRITICAL - the CrashPlan backup you pointed to does not exist!\n" 35 | exit 2 36 | fi 37 | 38 | lastBackupLine=`grep -n lastCompletedBackupTimestamp "$cpDirectory"` 39 | lastBackupDateString=`echo $lastBackupLine | awk -F lastCompletedBackupTimestamp= '{print $NF}' | sed 's/.\{5\}$//' | sed 's/%//'` 40 | lastBackupDate=$(date -j -f "%Y-%m-%eT%H\:%M\:%S" "$lastBackupDateString" "+%s" ) 41 | 42 | diff=$(( $currentDate - $lastBackupDate)) 43 | warnSeconds=$(($warnMinutes * 60)) 44 | critSeconds=$(($critMinutes * 60)) 45 | 46 | if [ "$diff" -gt "$critSeconds" ]; then 47 | # this cert is has already expired! return critical status. 48 | printf "CRITICAL - $cpDirectory has not been backed up in more than $critMinutes minutes!\n" 49 | exit 2 50 | elif [ "$diff" -gt "$warnSeconds" ]; then 51 | # this cert is expiring within the warning threshold. return warning status. 52 | printf "WARNING - $cpDirectory has not been backed up in more than $warnMinutes minutes!\n" 53 | exit 1 54 | fi 55 | 56 | printf "OK - $cpDirectory has been backed up within the last $warnMinutes minutes.\n" 57 | exit 0 -------------------------------------------------------------------------------- /check_crashplan_currency_gnu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Crashplan Currency - GNU 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.0.1 - 3 May 2012 8 | # Added comments and fixed broken bits. 9 | 10 | # v1.0 - 27 Apr 2012 11 | # Initial release. 12 | 13 | # This script checks the currency of a CrashPlan backup on Linux. There is a different version for Mac OS X due to differences between date on GNU and BSD. 14 | # Takes three arguments ([-d] cp.properties file in backup destination, [-w] warning threshold in minutes, [-c] critical threshold in minutes): 15 | # ./check_crashplan_currency_gnu.sh -d /media/Backups/52352423423424243/cp.properties -w 240 -c 1440 16 | 17 | currentDate=`date "+%s"` 18 | cpDirectory="" 19 | warnMinutes="" 20 | critMinutes="" 21 | 22 | while getopts "d:w:c:" optionName; do 23 | case "$optionName" in 24 | d) cpDirectory=("$OPTARG");; 25 | w) warnMinutes=( $OPTARG );; 26 | c) critMinutes=( $OPTARG );; 27 | esac 28 | done 29 | 30 | 31 | # check to see if the cp.properties file exists 32 | if ! [ -f "$cpDirectory" ]; 33 | then 34 | printf "CRITICAL - the CrashPlan backup you pointed to does not exist!\n" 35 | exit 2 36 | fi 37 | 38 | lastBackupLine=`grep -n lastCompletedBackupTimestamp "$cpDirectory"` 39 | if [ -z "$lastBackupLine" ]; then 40 | printf "CRITICAL - Could not read the last backup date. Has an initial backup occurred?\n" 41 | exit 2 42 | fi 43 | lastBackupDateString=`echo $lastBackupLine | awk -F lastCompletedBackupTimestamp= '{print $NF}' | sed 's/.\{5\}$//' | sed 's/\\\//g'` 44 | lastBackupDate=$(date -d "$lastBackupDateString" "+%s" ) 45 | 46 | diff=$(( $currentDate - $lastBackupDate)) 47 | warnSeconds=$(($warnMinutes * 60)) 48 | critSeconds=$(($critMinutes * 60)) 49 | 50 | if [ "$diff" -gt "$critSeconds" ]; then 51 | # this cert is has already expired! return critical status. 52 | printf "CRITICAL - $cpDirectory has not been backed up in more than $critMinutes minutes!\n" 53 | exit 2 54 | elif [ "$diff" -gt "$warnSeconds" ]; then 55 | # this cert is expiring within the warning threshold. return warning status. 56 | printf "WARNING - $cpDirectory has not been backed up in more than $warnMinutes minutes!\n" 57 | exit 1 58 | fi 59 | 60 | printf "OK - $cpDirectory has been backed up within the last $warnMinutes minutes.\n" 61 | exit 0 -------------------------------------------------------------------------------- /check_apc_smt750_battery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check APC SmartUPS SMT 750 Battery & Voltage (check_apc_smt750_battery.sh) 4 | # by Dan Barrett 5 | # http://yesdevnull.net 6 | 7 | # v1.0 - 20 August 2013 8 | # Initial Release 9 | 10 | # Requirements: 11 | # - Apcupsd to be stored in the same directory (http://www.apcupsd.com/) 12 | # - check_apcupsd.sh v2.6 (http://martintoft.dk/?p=check_apcupsd) 13 | 14 | # Arguments: 15 | # -w Warning threshold for battery charge (%) 16 | # -c Critical threshold for battery charge (%) 17 | 18 | # Example: 19 | # ./check_apc_smt750_battery.sh -w 80 -c 20 20 | 21 | # Change this variable if the path to check_apcupsd.sh is different 22 | apcupsdPath="/opt/local/libexec/nagios" 23 | warnThresh="" 24 | critThresh="" 25 | 26 | while getopts "w:c:" opt 27 | do 28 | case $opt in 29 | w ) warnThresh=$OPTARG;; 30 | c ) critThresh=$OPTARG;; 31 | esac 32 | done 33 | 34 | if [ "$warnThresh" == "" ] 35 | then 36 | printf "ERROR - You must provide a warning threshold with -w!\n" 37 | exit 1 38 | fi 39 | 40 | if [ "$critThresh" == "" ] 41 | then 42 | printf "ERROR - You must provide a critical threshold with -c!\n" 43 | exit 2 44 | fi 45 | 46 | battCharge=`$apcupsdPath/check_apcupsd.sh -w $warnThresh -c $critThresh bcharge | grep -E -o "[0-9.]+[%]" | tail -1 | grep -E -o "[0-9.]+"` 47 | battVoltage=`$apcupsdPath/check_apcupsd.sh battv | grep -E -o "[0-9.V]+" | tail -1 | grep -E -o "[0-9.]+"` 48 | 49 | # Do BC math because battCharge is returned as a float 50 | critMath=`echo $battCharge '<=' $critThresh | bc -l` 51 | if [ $critMath -eq 1 ] 52 | then 53 | printf "CRITICAL - Battery charge is $battCharge%%, which is below $critThresh%% | battCharge=$battCharge; battWarn=$warnThresh; battCrit=$critThresh; voltage=$battVoltage;\n" 54 | exit 2 55 | fi 56 | 57 | # Do BC math because battCharge is returned as a float 58 | warnMath=`echo $battCharge '<=' $warnThresh | bc -l` 59 | if [ $warnMath -eq 1 ] 60 | then 61 | printf "WARNING - Battery charge is $battCharge%%, which is below $warnThresh%% | battCharge=$battCharge; battWarn=$warnThresh; battCrit=$critThresh; voltage=$battVoltage;\n" 62 | exit 1 63 | fi 64 | 65 | printf "OK - Battery charge is at $battCharge%% | battCharge=$battCharge; battWarn=$warnThresh; battCrit=$critThresh; voltage=$battVoltage;\n" 66 | exit 0 -------------------------------------------------------------------------------- /check_folder_size.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Folder Size 4 | # by Dan Barrett 5 | # http://yesdevnull.net 6 | 7 | # v1.1 - 28 October 2013 8 | # Added OS X 10.9 Support and fixes a bug where folders with spaces in their name would fail with du. 9 | 10 | # v1.0 - 9 August 2013 11 | # Initial release. 12 | 13 | # Checks to see how large the folder is and warns or crits if over a specified size. 14 | # Defaults to MB 15 | 16 | # Arguments: 17 | # -f Path to folder 18 | # -b Block size (i.e. data returned in MB, KB or GB - enter as m, k or g) 19 | # -w Warning threshold for storage used 20 | # -c Critical threshold for storage used 21 | 22 | # Example: 23 | # ./check_folder_size.sh -f /Library/Application\ Support/ -w 2048 -c 4096 24 | 25 | # Supports: 26 | # Untested but I'm sure it works fine on OS X 10.6 and 10.7 27 | # * OS X 10.8.x 28 | # * OS X 10.9 29 | 30 | folderPath="" 31 | blockSize="m" 32 | blockSizeFriendly="MB" 33 | warnThresh="" 34 | critThresh="" 35 | 36 | # Get the flags! 37 | while getopts "f:b:w:c:" opt 38 | do 39 | case $opt in 40 | f ) folderPath=$OPTARG;; 41 | b ) blockSize=$OPTARG;; 42 | w ) warnThresh=$OPTARG;; 43 | c ) critThresh=$OPTARG;; 44 | esac 45 | done 46 | 47 | if [ "$folderPath" == "" ] 48 | then 49 | printf "ERROR - You must provide a file path with -f!\n" 50 | exit 2 51 | fi 52 | 53 | if [ "$warnThresh" == "" ] 54 | then 55 | printf "ERROR - You must provide a warning threshold with -w!\n" 56 | exit 2 57 | fi 58 | 59 | if [ "$critThresh" == "" ] 60 | then 61 | printf "ERROR - You must provide a critical threshold with -c!\n" 62 | exit 2 63 | fi 64 | 65 | if [ "$blockSize" == "k" ] 66 | then 67 | blockSizeFriendly="KB" 68 | fi 69 | 70 | if [ "$blockSize" == "g" ] 71 | then 72 | blockSizeFriendly="GB" 73 | fi 74 | 75 | folderSize=`du -s$blockSize "$folderPath" | grep -E -o "[0-9]+"` 76 | 77 | if [ "$folderSize" -ge "$critThresh" ] 78 | then 79 | printf "CRITICAL - folder is $folderSize $blockSizeFriendly in size | folderSize=$folderSize;$warnThresh;$critThresh;\n" 80 | exit 2 81 | elif [ "$folderSize" -ge "$warnThresh" ] 82 | then 83 | printf "WARNING - folder is $folderSize $blockSizeFriendly in size | folderSize=$folderSize;$warnThresh;$critThresh;\n" 84 | exit 1 85 | fi 86 | 87 | printf "OK - folder is $folderSize $blockSizeFriendly in size | folderSize=$folderSize;$warnThresh;$critThresh;\n" 88 | exit 0 -------------------------------------------------------------------------------- /check_ccc_currency.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Carbon Copy Clone - Check Currency 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.0 - 2 Jul 2012 8 | # Initial release. 9 | 10 | # This script has 2 modes: 11 | # • Can be used as a post-clone script in Carbon Copy Cloner to mark a destination as successful 12 | # • Can be used as a Nagios plugin to check the time of the last successful clone to a destination 13 | 14 | # --- In Carbon Copy Cloner (CCC) --- 15 | # Simply set the script as the post-clone shell script (After copying files...) for your scheduled clone. 16 | # More information can be found at my original blog post about this script (http://jedda.me/2012/07/checking-carbon-copy-cloner-nagios/) 17 | # or the documentation on this feature in CCC (http://www.bombich.com/software/docs/CCC/en.lproj/scheduling/performing-actions-before-and-after-the-backup-task.html) 18 | 19 | # --- In Nagios --- 20 | # This script checks .ccc_clone_last_completed file on a volume, and reports if a clone has completed successfully within a number of minutes of the current time. 21 | # Takes two arguments (clone destination, warning threshold in minutes): 22 | # ./check_ccc_currency.sh -d '/Volumes/Boot-Clone' -w 1440 23 | 24 | destVolume="" 25 | warnMinutes="" 26 | 27 | while getopts "d:w:" optionName; do 28 | case "$optionName" in 29 | d) destVolume=("$OPTARG");; 30 | w) warnMinutes=( $OPTARG );; 31 | esac 32 | done 33 | 34 | parentProcess=`ps -ocommand= -p $PPID | awk -F/ '{print $NF}' | awk '{print $1}'` 35 | 36 | # check to see if we are being called from CCC 37 | if [ "$parentProcess" = "com.bombich.ccc" ]; then 38 | # we are being called by CCC 39 | echo "We are being called by CCC" 40 | if [ $3 -eq 0 ]; then 41 | echo "Clone to $2 was good!" 42 | # clone completed successfully 43 | touch "$2/.ccc_clone_last_completed" 44 | fi 45 | exit 0 46 | else 47 | # we are NOT being called by CCC 48 | if ! [ -f "$destVolume/.ccc_clone_last_completed" ]; 49 | then 50 | printf "CRITICAL - $destVolume has never been a successful clone destination!\n" 51 | exit 2 52 | fi 53 | if echo `find "$destVolume/.ccc_clone_last_completed" -mmin +$warnMinutes` | grep -q "$destVolume/.ccc_clone_last_completed"; then 54 | printf "WARNING - A clone has NOT succeeded to $destVolume in more than $warnMinutes minutes\n" 55 | exit 1 56 | else 57 | printf "OK - A clone to $destVolume has succeeded within the last $warnMinutes minutes\n" 58 | exit 0 59 | fi 60 | fi -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/xcuserdata/jedda.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 19 | 20 | 33 | 34 | 47 | 48 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /check_osx_smc/README.md: -------------------------------------------------------------------------------- 1 | check\_osx\_smc 2 | ========================= 3 | 4 | A Nagios plugin to read and report SMC readings (temperature sensors, fan speed sensors) on Apple hardware. It is part of [Mac OS X Monitoring Tools](https://github.com/jedda/OSX-Monitoring-Tools), a collection of scripts and tools to assist in monitoring Mac OS X and essential services with Nagios. 5 | 6 | ####Usage 7 | ./check_osx_smc [options] 8 | 9 | ####Options 10 | * -r : comma delimited list of smc registers to read 11 | * -w [required] : comma delimited list of warning thresholds 12 | * -c [required] : comma delimited list of critical thresholds 13 | * -s [required] : temperature scale to use. c for celcius, f for fahrenheit 14 | * -h : display help 15 | 16 | ####Example 17 | ./check_osx_smc -r TA0P,TC0D,F0Ac -w 75,85,3800 -c 85,100,5200 -s c 18 | 19 | This example on a 2011 Mac mini Server would check TA0P (Ambient Air 1), TC0D (CPU Diode), and F0Ac (Primary Fan Speed). It would return values in degrees Celcius, return warning status on values above values of 75,85,3800 respectively, and return critical status above values of 85,100,5200 respectively. 20 | 21 | ####SMC Registers 22 | This plugin currently accepts and processes SMC registers for temperature and fan speed. There are plans in the future to implement power values too. It is up to the end user to provide register keys to the script, but a list of known values for current hardware is located at: [known-registers](https://github.com/jedda/OSX-Monitoring-Tools/blob/master/check_osx_smc/known-registers.md) 23 | 24 | ####Source Code & Licensing 25 | The source code of this plugin is available [here](https://github.com/jedda/OSX-Monitoring-Tools/blob/master/check_osx_smc/). 26 | This plugin includes and makes use of 'Apple System Management Control (SMC) Tool' by devnull, which is licensed under the GNU General Public License. All other parts of this plugin are made available under an unlicense, and is free and unencumbered software released into the public domain. Please refer to the [LICENSE](https://github.com/jedda/OSX-Monitoring-Tools/blob/master/LICENSE) for further details . 27 | 28 | ####Support, Bugs & Issues: 29 | This plugin is free and open-source, and as such, support is limited - queries can be directed to [this contact page](http://jedda.me/contact-jedda/). Any issues or bugs should be registered on the project's GitHub [Issue Tracker](https://github.com/jedda/OSX-Monitoring-Tools/issues). 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### This repository has been archived and it's use is discouraged. I haven't looked at this code in a very long time. 2 | 3 | Mac OS X Monitoring Tools 4 | ========================= 5 | 6 | A collection of scripts and tools to assist in monitoring Mac OS X and essential services with Nagios. 7 | 8 | Overviews and use cases for a lot of these can be found in posts at my site: 9 | [http://jedda.me](http://jedda.me) 10 | 11 | ![Services](http://jedda.me/assets/osx-monitoring/RAM.jpg) 12 | 13 | Some of the features of these scripts include: 14 | 15 | * Checking the currency of backups with Time Machine, CrashPlan, and Carbon Copy Cloner 16 | * Checking memory utilization on Mac OS X 17 | * Checking SMC sensors (temperatures/fans) on Apple hardware 18 | * Checking the health of Open Directory masters and replicas on Mac OS X Server 19 | * Checking Open Directory binding & authentication 20 | * Checking the status of tasks scheduled or executed by launchd 21 | * Checking certificate expiry on Mac OS X Server 22 | * Checking DHCP & Software Update services on Mac OS X Server 23 | * Checking Kerio Connect statistics & performance data 24 | * Native (no perl, no python) file age check 25 | * Notify via popular notifications platforms Boxcar & Pushover 26 | * & more! 27 | 28 | These scripts and tools were specifically designed to be dependency free, so in the case of all but one or two, they will run on a stock Mac OS X client/server system from 10.4+ onwards. Most of them are pure BASH, with a few Obj-C exceptions that will need to be compiled prior to use. 29 | 30 | 31 | Support & Feedback: 32 | -------- 33 | 34 | The project's [Issues Tracker](https://github.com/jedda/OSX-Monitoring-Tools/issues) is the best place to let me know of any specific issues or bugs that you find. I am more than happy to chat about ideas on integrating these scripts into your environment - feel free to send me an email ([jedda@jedda.me](mailto:jedda@jedda.me "jedda@jedda.me")), or contact me with iMessage or AIM ([jwignall@mac.com](imessage://jwignall@mac.com)). 35 | 36 | 37 | License: 38 | -------- 39 | 40 | This is free and unencumbered software released into the public domain - see [LICENSE](https://github.com/jedda/OSX-Monitoring-Tools/blob/master/LICENSE) ([http://unlicense.org/](http://unlicense.org/)) 41 | 42 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/jedda/osx-monitoring-tools/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 43 | 44 | [![githalytics.com alpha](https://cruel-carlota.pagodabox.com/404c380afb0c0015e7b44b4612459b03 "githalytics.com")](http://githalytics.com/jedda/OSX-Monitoring-Tools) 45 | -------------------------------------------------------------------------------- /check_osx_dhcp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check OS X DHCP Status 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.0 - 7 Dec 2012 8 | # Initial release. 9 | 10 | # Script that uses serveradmin to check that the OS X Server DHCP service is listed as running. 11 | # If all is OK, it checks that the number of active clients does not exceed a set threshold, then 12 | # returns performance data for the number of provided leases and number of active clients. 13 | 14 | # Required Arguments: 15 | # -w Warning threshold for active clients. Script throws WARNING if number of active clients is greater than or equals the supplied number. 16 | # -c Critical threshold for active clients. Script throws CRITICAL if number of active clients is greater than or equals the supplied number. 17 | 18 | # Example: 19 | # ./check_osx_swupdate.sh -w 120 -c 180 20 | 21 | # Performance Data - this script returns the followng Nagios performance data: 22 | # providedLeases - Number of leases provided to clients (active & non-active). 23 | # activeClients - Number of clients with an active lease. 24 | 25 | # Compatibility - this script has been tested on and functions on the following stock OSes: 26 | # 10.6 Server 27 | # 10.7 Server 28 | # 10.8 Server 29 | 30 | if [[ $EUID -ne 0 ]]; then 31 | printf "ERROR - This script must be run as root.\n" 32 | exit 1 33 | fi 34 | 35 | warnThresh="" 36 | critThresh="" 37 | 38 | while getopts "w:c:" optionName; do 39 | case "$optionName" in 40 | w) warnThresh=( $OPTARG );; 41 | c) critThresh=( $OPTARG );; 42 | esac 43 | done 44 | 45 | if [ "$warnThresh" == "" ]; then 46 | printf "ERROR - You must provide a warning threshold with -w!\n" 47 | exit 3 48 | fi 49 | 50 | if [ "$critThresh" == "" ]; then 51 | printf "ERROR - You must provide a critical threshold with -c!\n" 52 | exit 3 53 | fi 54 | 55 | # check that the dhcp service is running 56 | dhcpStatus=`serveradmin fullstatus dhcp | grep 'dhcp:state' | sed -E 's/dhcp:state.+"(.+)"/\1/'` 57 | 58 | if [ "$dhcpStatus" != "RUNNING" ]; then 59 | printf "CRITICAL - DHCP service is not running!\n" 60 | exit 2 61 | fi 62 | 63 | dhcpActiveClients=`serveradmin fullstatus dhcp | grep 'dhcp:numDHCPActiveClients' | grep -E -o "[0-9]+"` 64 | dhcpLeases=`serveradmin fullstatus dhcp | grep 'dhcp:numDHCPLeases' | grep -E -o "[0-9]+"` 65 | 66 | if [ "$dhcpActiveClients" -ge "$critThresh" ]; then 67 | printf "CRITICAL - $dhcpLeases leases ($dhcpActiveClients active clients) | providedLeases=$dhcpLeases; activeClients=$dhcpActiveClients;\n" 68 | exit 2 69 | elif [ "$dhcpActiveClients" -ge "$warnThresh" ]; then 70 | printf "WARNING - $dhcpLeases leases ($dhcpActiveClients active clients) | providedLeases=$dhcpLeases; activeClients=$dhcpActiveClients; \n" 71 | exit 1 72 | fi 73 | 74 | printf "DHCP OK - $dhcpLeases leases ($dhcpActiveClients active clients) | providedLeases=$dhcpLeases; activeClients=$dhcpActiveClients;\n" 75 | exit 0 -------------------------------------------------------------------------------- /check_osx_smc/known-registers.md: -------------------------------------------------------------------------------- 1 | Known SMC Registers 2 | =================== 3 | This document details known SMC register keys for Apple hardware. These registers can be supplied to [check\_osx\_smc](https://github.com/jedda/OSX-Monitoring-Tools/tree/master/check_osx_smc) to monitor SMC sensor values such as temperature and fan speeds using Nagios. 4 | 5 | Working out new registers 6 | ------------- 7 | 8 | These registers were figured out with a bit of web sleuthing, and the excellent [smc\_util](https://github.com/alexleigh/smc_util) by Alex Leigh, which can be used to list all registers and data types on a system. If you are trying to figure out registers for non listed hardware, i'd recommend starting there. 9 | 10 | Submission 11 | ------------- 12 | 13 | Should you figure registers that aren't listed here (non listed hardware/missing), and you want to share them, [contact me here](http://jedda.me/contact-jedda/), and i'll be happy to include them in this list. 14 | 15 | Hardware List 16 | ------------- 17 | 18 | ####Macmini3,1 19 | - *TC0D* - CPU A Diode 20 | - *TC0H* - CPU A Heatsink 21 | - *TC0P* - CPU A Proximity 22 | - *TH0P* - Hard Drive Bay 23 | - *TN0D* - Northbridge Diode 24 | - *TN0P* - Northbridge Proximity 25 | - *TW0P* - Wireless Module 26 | - *F0Ac* - Internal Fan (Actual Speed) 27 | 28 | ####Macmini5,1 / Macmini5,2 / Macmini 5,3 29 | - *TA0P* - Ambient Air 1 30 | - *TA1P* - Ambient Air 2 31 | - *TC0D* - CPU A Diode 32 | - *TC0P* - CPU A Proximity 33 | - *TI0P* - Thunderbolt 1 Proximity 34 | - *TI1P* - Thunderbolt 2 Proximity 35 | - *TM0S* - Memory Slot 1 36 | - *TMBS* - Memory Slot 2 37 | - *TM0P* - Memory Slots Proximity 38 | - *TP0P* - Platform Controller Hub Proximity 39 | - *TPCD* - Platform Controller Hub Diode ?? 40 | - *Tp0C* - Power Supply 41 | - *TW0P* - Wireless Module 42 | - *F0Ac* - Internal Fan (Actual Speed) 43 | 44 | ####Macmini6,1 / Macmini6,2 45 | - *TA0P* - Ambient Air 1 46 | - *TA1P* - Ambient Air 2 47 | - *TC0D* - CPU A Diode 48 | - *TC0P* - CPU A Proximity 49 | - *TI0P* - Thunderbolt 1 Proximity 50 | - *TI1P* - Thunderbolt 2 Proximity 51 | - *TM0S* - Memory Slot 1 52 | - *TM0P* - Memory Slots Proximity 53 | - *TP0P* - Platform Controller Hub Proximity 54 | - *TPCD* - Platform Controller Hub Diode ?? 55 | - *Tp0C* - Power Supply 56 | - *TW0P* - Wireless Module 57 | - *F0Ac* - Internal Fan (Actual Speed) 58 | 59 | ####Macpro1,1 60 | - *TA0P* - Ambient Air 61 | - *TC0C* - CPU A Core 1 62 | - *TC1C* - CPU A Core 2 63 | - *TC2C* - CPU B Core 1 64 | - *TC3C* - CPU B Core 2 65 | - *TCAH* - CPU A Heatsink 66 | - *TCBH* - CPU B Heatsink 67 | - *TH0P* - Drive Bay 1 68 | - *TH1P* - Drive Bay 2 69 | - *TH2P* - Drive Bay 3 70 | - *TH3P* - Drive Bay 4 71 | - *TN0H* - Memory Controller Heatsink 72 | - *Tp0C* - Power Supply Inlet 73 | - *Tp1C* - Power Supply Secondary 74 | - *F0Ac* - CPU/RAM Fan (Actual Speed) 75 | - *F1Ac* - Exhaust Fan (Actual Speed) 76 | - *F2Ac* - Expansion Fan (Actual Speed) 77 | - *F3Ac* - Power Supply Fan (Actual Speed) 78 | -------------------------------------------------------------------------------- /notify_by_pushover.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Notify by Pushover 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.2.1 - 17 Mar 2013 8 | # Now parses title and message for sound processing. 9 | 10 | # v1.2 - 18 Dec 2012 11 | # Added parsing of title for specific warning, critical, and OK sounds. 12 | 13 | # v1.1 - 02 Dec 2012 14 | # Added notification sounds. 15 | 16 | # v1.0 - 21 Aug 2012 17 | # Initial release. 18 | 19 | # This script sends a Pushover (http://pushover.net/) notification to your account. I use it in a Nagios setup 20 | # to send network monitoring notifications, but it could be used or adapted for nearly any scenario. 21 | 22 | # IMPORTANT 23 | # You will need to create a Pushover 'Application' for this script in your account, and use the provided API key 24 | # as an argument. You can register an app once logged into Pushover at the follwing link: 25 | # https://pushover.net/apps/build 26 | 27 | # Takes the following REQUIRED arguments: 28 | 29 | # -u Your Pushover user key. 30 | # -a Your Pushover application key. 31 | # -t The notification title. 32 | # -m The notification body. 33 | 34 | # and the following OPTIONAL arguments: 35 | 36 | # -p Notification priority. Set to 1 to ignore quiet times. 37 | # -s Notification sound. You must use one of the parameters listed at https://pushover.net/api#sounds. 38 | # -w Warning notification sound. The script will look for the text 'WARNING' in the notification title, and use this sound if found. 39 | # -c Critical notification sound. The script will look for the text 'CRITICAL' in the notification title, and use this sound if found. 40 | # -o OK notification sound. The script will look for the text 'OK' in the notification title, and use this sound if found. 41 | 42 | # Example: 43 | # ./notify_by_pushover.sh -u r5j7mjYjd -a noZ9KuR5T -s 'spacealarm' -t "server.pretendco.com" -m "DISK WARNING - free space: /dev/disk0s2 4784 MB" 44 | 45 | 46 | while getopts "u:a:t:m:p:s:w:c:o:" optionName; do 47 | case "$optionName" in 48 | u) userKey=( "$OPTARG" );; 49 | a) appToken=( "$OPTARG" );; 50 | t) title=( "$OPTARG" );; 51 | m) message=( "$OPTARG" );; 52 | p) priority=( "$OPTARG" );; 53 | s) sound=( "$OPTARG" );; 54 | w) warnSound=( "$OPTARG" );; 55 | c) critSound=( "$OPTARG" );; 56 | o) okSound=( "$OPTARG" );; 57 | 58 | esac 59 | done 60 | 61 | if [ "$priority" != "" ]; then 62 | priorityString="priority=$priority" 63 | else 64 | priorityString="priority=0" 65 | fi 66 | 67 | if echo $title $message | grep -q 'WARNING' && [ "$warnSound" != "" ] ;then 68 | sound=$warnSound 69 | elif echo $title $message | grep -q 'CRITICAL' && [ "$critSound" != "" ] ;then 70 | sound=$critSound 71 | elif echo $title $message | grep -q 'OK' && [ "$okSound" != "" ] ;then 72 | sound=$okSound 73 | fi 74 | 75 | curl -F "token=$appToken" \ 76 | -F "user=$userKey" \ 77 | -F "title=$title" \ 78 | -F "message=$message" \ 79 | -F "sound=$sound" \ 80 | -F "$priorityString" \ 81 | https://api.pushover.net/1/messages 82 | 83 | exit 0 -------------------------------------------------------------------------------- /check_radius.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check FreeRADIUS Server Status 4 | # by Dan Barrett 5 | # http://yesdevnull.net 6 | 7 | # v1.0 - 24 August 2013 8 | # Initial Release 9 | 10 | # v1.1 - 27 October 2013 11 | # Updated for OS X Mavericks 12 | 13 | # This script does a number of checks to verify that the FreeRADIUS server is running. 14 | # Please ensure you have a valid user account to check the full status of the server. 15 | 16 | # Arguments: 17 | # -u Username to test authentication 18 | # -p Password for the above user 19 | # -h The host for the FreeRADIUS server (usually localhost) 20 | # -a The port for the FreeRADIUS server (usually 1812) 21 | # -s The shared secret for the IP address you're connecting from (testing123 if testing on localhost) 22 | 23 | # Example: 24 | # ./check_radius.sh -u fakeuser -p fakepass -h localhost -a 1812 -s fake_shared_secret 25 | 26 | # Supports: 27 | # * OS X 10.8 Mountain Lion, Server 2.2.x 28 | # * OS X 10.9 Mavericks, Server 3.0 29 | 30 | # We need to run this as root because FreeRADIUS requires it, plus we write a temp log file 31 | if [[ $EUID -ne 0 ]] 32 | then 33 | echo "ERROR - This script must be run as root." 34 | exit 1 35 | fi 36 | 37 | # Set up the basic variables 38 | username="" 39 | password="" 40 | host="" 41 | port="" 42 | secret="" 43 | 44 | while getopts "u:p:h:a:s:" opt 45 | do 46 | case $opt in 47 | u ) username=$OPTARG;; 48 | p ) password=$OPTARG;; 49 | h ) host=$OPTARG;; 50 | a ) port=$OPTARG;; 51 | s ) secret=$OPTARG;; 52 | esac 53 | done 54 | 55 | # Check to see if we're running Mavericks Server as RADIUS runs a little differently 56 | osVersion=`sw_vers -productVersion | grep -E -o "[0-9]+\.[0-9]"` 57 | isMavericks=`echo $osVersion '< 10.9' | bc -l` 58 | 59 | if [ $isMavericks -eq 0 ] 60 | then 61 | # 10.9+ Check 62 | # Quick check to see if FreeRADIUS is even running 63 | if [ "`ps -ef | grep radiusd`" == "" ] 64 | then 65 | echo "CRITICAL - RADIUS is not running!" 66 | exit 2 67 | fi 68 | else 69 | # < 10.9 Check 70 | # Quick check to see if FreeRADIUS is even running 71 | if [ "`ps aux -o tty | grep "/usr/sbin/radius"`" == "" ] 72 | then 73 | echo "CRITICAL - RADIUS is not running!" 74 | exit 2 75 | fi 76 | fi 77 | 78 | # Attempt to authenticate with the FreeRADIUS server, using the credentials and details above, then send stderr to a temp log file 79 | authAttempt=`echo "User-Name=$username,User-Password=$password,Framed-Protocol=PPP " | radclient -x -r 1 -t 2 $host:$port auth $secret 2> /tmp/radius_error` 80 | # Assign the stderr log file to a variable 81 | radiusStderr=$( /dev/null 68 | if [ $? == 7 ]; then 69 | printf "CRITICAL - Could not connect to the Software Update service port ($swupdateServicePort). | mirroredPkgs=$numOfMirroredPkg; enabledPkgs=$numOfEnabledPkg; sizeOfUpdates=$sizeOfUpdatesDocRoot;\n" 70 | exit 2 71 | fi 72 | 73 | printf "OK - Software Update service appears to be running OK. | mirroredPkgs=$numOfMirroredPkg; enabledPkgs=$numOfEnabledPkg; sizeOfUpdates=$sizeOfUpdatesDocRoot;\n" 74 | exit 0 -------------------------------------------------------------------------------- /check_osx_smc/check_osx_smc/smc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Apple System Management Control (SMC) Tool 3 | * Copyright (C) 2006 devnull 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #ifndef __SMC_H__ 24 | #define __SMC_H__ 25 | #endif 26 | 27 | #define OP_NONE 0 28 | #define OP_LIST 1 29 | #define OP_READ 2 30 | #define OP_READ_FAN 3 31 | #define OP_WRITE 4 32 | 33 | #define KERNEL_INDEX_SMC 2 34 | 35 | #define SMC_CMD_READ_BYTES 5 36 | #define SMC_CMD_WRITE_BYTES 6 37 | #define SMC_CMD_READ_INDEX 8 38 | #define SMC_CMD_READ_KEYINFO 9 39 | #define SMC_CMD_READ_PLIMIT 11 40 | #define SMC_CMD_READ_VERS 12 41 | 42 | #define DATATYPE_FPE2 "fpe2" 43 | #define DATATYPE_UINT8 "ui8 " 44 | #define DATATYPE_UINT16 "ui16" 45 | #define DATATYPE_UINT32 "ui32" 46 | #define DATATYPE_SP78 "sp78" 47 | 48 | // key values 49 | #define SMC_KEY_CPU_TEMP "TG0P" 50 | #define SMC_KEY_FAN0_RPM_MIN "F0Mn" 51 | #define SMC_KEY_FAN1_RPM_MIN "F1Mn" 52 | #define SMC_KEY_FAN0_RPM_CUR "F0Ac" 53 | #define SMC_KEY_FAN1_RPM_CUR "F1Ac" 54 | 55 | 56 | typedef struct { 57 | char major; 58 | char minor; 59 | char build; 60 | char reserved[1]; 61 | uint16_t release; 62 | } SMCKeyData_vers_t; 63 | 64 | typedef struct { 65 | uint16_t version; 66 | uint16_t length; 67 | uint32_t cpuPLimit; 68 | uint32_t gpuPLimit; 69 | uint32_t memPLimit; 70 | } SMCKeyData_pLimitData_t; 71 | 72 | typedef struct { 73 | uint32_t dataSize; 74 | uint32_t dataType; 75 | char dataAttributes; 76 | } SMCKeyData_keyInfo_t; 77 | 78 | typedef char SMCBytes_t[32]; 79 | 80 | typedef struct { 81 | uint32_t key; 82 | SMCKeyData_vers_t vers; 83 | SMCKeyData_pLimitData_t pLimitData; 84 | SMCKeyData_keyInfo_t keyInfo; 85 | char result; 86 | char status; 87 | char data8; 88 | uint32_t data32; 89 | SMCBytes_t bytes; 90 | } SMCKeyData_t; 91 | 92 | typedef char UInt32Char_t[5]; 93 | 94 | typedef struct { 95 | UInt32Char_t key; 96 | uint32_t dataSize; 97 | UInt32Char_t dataType; 98 | SMCBytes_t bytes; 99 | } SMCVal_t; 100 | 101 | 102 | // prototypes 103 | double SMCGetTemperature(char *key); 104 | kern_return_t SMCSetFanRpm(char *key, int rpm); 105 | int SMCGetFanRPM(char *key); 106 | kern_return_t SMCOpen(void); 107 | kern_return_t SMCClose(void); 108 | -------------------------------------------------------------------------------- /check_ssl_certificate_expiry.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check SSL Certificate Expiry 4 | # by Dan Barrett 5 | # http://yesdevnull.net 6 | 7 | # v1.0 - 29 November 2013 8 | # Initial release. 9 | 10 | # Checks the specified certificate and warns you if the certificate is going 11 | # to expire soon, or if it has already expired, or if it isn't valid yet. 12 | 13 | # Arguments: 14 | # -h Host address 15 | # -p Port of SSL service 16 | # -e Expiry in days 17 | 18 | # Example: 19 | # ./check_ssl_certificate.expiry -h apple.com -p 443 -e 7 20 | 21 | # Set up our blank variables 22 | host="" 23 | port="" 24 | expiryInDays="" 25 | 26 | while getopts "h:p:e:" opt 27 | do 28 | case $opt in 29 | h ) host=$OPTARG;; 30 | p ) port=$OPTARG;; 31 | e ) expiryInDays=$OPTARG;; 32 | esac 33 | done 34 | 35 | if [ ! "$host" ] 36 | then 37 | printf "ERROR - Please ensure you have entered a hostname with -h!\n" 38 | exit 3 39 | fi 40 | 41 | if [ ! "$port" ] 42 | then 43 | printf "ERROR - Please add a port with -p\n" 44 | exit 3 45 | fi 46 | 47 | if [ ! "$expiryInDays" ] 48 | then 49 | printf "ERROR - Please add an expiry in days with -e\n" 50 | exit 3 51 | fi 52 | 53 | currentDateInEpoch=`date +%s` 54 | expiryDays=$(( $expiryInDays * 86400 )) 55 | 56 | # Quick function to tidy up output results in days 57 | numberOfDays() { 58 | dayDiff=`printf "%.0f" $( echo "scale=0; $1 / 60 / 60 / 24" | bc -l )` 59 | dayDiff=`echo $dayDiff | sed 's/-//g'` 60 | 61 | dayName="days" 62 | 63 | if [ "$dayDiff" -eq "1" ] 64 | then 65 | dayName="day" 66 | fi 67 | 68 | echo "$dayDiff $dayName" 69 | } 70 | 71 | beforeExpiry=`echo "QUIT" | openssl s_client -connect $host:$port 2>/dev/null | openssl x509 -noout -startdate 2>/dev/null` 72 | afterExpiry=`echo "QUIT" | openssl s_client -connect $host:$port 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null` 73 | commonName=`echo "QUIT" | openssl s_client -connect $host:$port 2>/dev/null | openssl x509 -subject -noout 2>/dev/null | sed -E 's/.+CN=([^/]*)?/\1/'` 74 | 75 | # If the stdout of the date results is null, throw a critical(2) 76 | if [ -z "$beforeExpiry" ] || [ -z "$afterExpiry" ] 77 | then 78 | printf "CRITICAL - Unable to read certificate for $host.\n" 79 | exit 2 80 | fi 81 | 82 | notBefore=`echo $beforeExpiry | grep -C 0 "notBefore" | grep -E -o "[A-Za-z]{3,4} [0-9]{1,2} [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{3,4} [A-Z]{2,3}"` 83 | notBeforeExpiry=`date -j -f "%b %d %H:%M:%S %Y %Z" "$notBefore" "+%s"` 84 | 85 | diff=$(( $currentDateInEpoch - $notBeforeExpiry )) 86 | 87 | # Is certificate not valid until the future? If so, throw a critical(2) 88 | if [ "$diff" -lt "0" ] 89 | then 90 | printf "CRITICAL - Certificate $commonName is not valid for $( numberOfDays $diff )!\n" 91 | exit 2 92 | fi 93 | 94 | notAfter=`echo $afterExpiry | grep -C 0 "notAfter" | grep -E -o "[A-Za-z]{3,4} [0-9]{1,2} [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{3,4} [A-Z]{2,3}"` 95 | notAfterExpiry=`date -j -f "%b %d %H:%M:%S %Y %Z" "$notAfter" "+%s"` 96 | 97 | diff=$(( $notAfterExpiry - $currentDateInEpoch )) 98 | 99 | # If the differential is less than 0, the certificate has already expired, throw a critical(2) 100 | if [ "$diff" -lt "0" ] 101 | then 102 | printf "CRITICAL - Certificate $commonName expired $( numberOfDays $diff ) ago!\n" 103 | exit 2 104 | fi 105 | 106 | # If the differential is less than the expiry days, throw a warning(1) 107 | if [ "$diff" -lt "$expiryDays" ] 108 | then 109 | printf "WARNING - Certificate $commonName will expire in less than $( numberOfDays $diff ).\n" 110 | exit 1 111 | fi 112 | 113 | # All OK(0) 114 | printf "OK - Certificate $commonName expires in $( numberOfDays $diff ).\n" 115 | exit 0 -------------------------------------------------------------------------------- /check_ssl_certificate_expiry_gnu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check SSL Certificate Expiry [GNU] 4 | # by Dan Barrett 5 | # http://yesdevnull.net 6 | 7 | # v1.0 - 19 December 2013 8 | # Initial release. 9 | 10 | # Checks the specified certificate and warns you if the certificate is going 11 | # to expire soon, or if it has already expired, or if it isn't valid yet. 12 | 13 | # Supports Ubuntu GNU Linux (other GNU distros should be fine too) 14 | 15 | # Arguments: 16 | # -h Host address 17 | # -p Port of SSL service 18 | # -e Expiry in days 19 | 20 | # Example: 21 | # ./check_ssl_certificate.expiry -h apple.com -p 443 -e 7 22 | 23 | # Set up our blank variables 24 | host="" 25 | port="" 26 | expiryInDays="" 27 | 28 | while getopts "h:p:e:" opt 29 | do 30 | case $opt in 31 | h ) host=$OPTARG;; 32 | p ) port=$OPTARG;; 33 | e ) expiryInDays=$OPTARG;; 34 | esac 35 | done 36 | 37 | if [ ! "$host" ] 38 | then 39 | printf "ERROR - Please ensure you have entered a hostname with -h!\n" 40 | exit 3 41 | fi 42 | 43 | if [ ! "$port" ] 44 | then 45 | printf "ERROR - Please add a port with -p\n" 46 | exit 3 47 | fi 48 | 49 | if [ ! "$expiryInDays" ] 50 | then 51 | printf "ERROR - Please add an expiry in days with -e\n" 52 | exit 3 53 | fi 54 | 55 | currentDateInEpoch=`date +%s` 56 | expiryDays=$(( $expiryInDays * 86400 )) 57 | 58 | # Quick function to tidy up output results in days 59 | numberOfDays() { 60 | dayDiff=`printf "%.0f" $( echo "scale=0; $1 / 60 / 60 / 24" | bc -l )` 61 | dayDiff=`echo $dayDiff | sed 's/-//g'` 62 | 63 | dayName="days" 64 | 65 | if [ "$dayDiff" -eq "1" ] 66 | then 67 | dayName="day" 68 | fi 69 | 70 | echo "$dayDiff $dayName" 71 | } 72 | 73 | beforeExpiry=`echo "QUIT" | openssl s_client -connect $host:$port 2>/dev/null | openssl x509 -noout -startdate 2>/dev/null` 74 | afterExpiry=`echo "QUIT" | openssl s_client -connect $host:$port 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null` 75 | commonName=`echo "QUIT" | openssl s_client -connect $host:$port 2>/dev/null | openssl x509 -subject -noout 2>/dev/null | sed -E 's/.+CN=([^/]*)?/\1/'` 76 | 77 | # If the stdout of the date results is null, throw a critical(2) 78 | if [ -z "$beforeExpiry" ] || [ -z "$afterExpiry" ] 79 | then 80 | printf "CRITICAL - Unable to read certificate for $host.\n" 81 | exit 2 82 | fi 83 | 84 | notBefore=`echo $beforeExpiry | grep -C 0 "notBefore" | grep -E -o "[A-Za-z]{3,4} [0-9]{1,2} [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{3,4} [A-Z]{2,3}"` 85 | notBeforeExpiry=`date --date="$notBefore" +%s` 86 | 87 | diff=$(( $currentDateInEpoch - $notBeforeExpiry )) 88 | 89 | # Is certificate not valid until the future? If so, throw a critical(2) 90 | if [ "$diff" -lt "0" ] 91 | then 92 | printf "CRITICAL - Certificate $commonName is not valid for $( numberOfDays $diff )!\n" 93 | exit 2 94 | fi 95 | 96 | notAfter=`echo $afterExpiry | grep -C 0 "notAfter" | grep -E -o "[A-Za-z]{3,4} [0-9]{1,2} [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{3,4} [A-Z]{2,3}"` 97 | notAfterExpiry=`date --date="$notAfter" +%s` 98 | 99 | diff=$(( $notAfterExpiry - $currentDateInEpoch )) 100 | 101 | # If the differential is less than 0, the certificate has already expired, throw a critical(2) 102 | if [ "$diff" -lt "0" ] 103 | then 104 | printf "CRITICAL - Certificate $commonName expired $( numberOfDays $diff ) ago!\n" 105 | exit 2 106 | fi 107 | 108 | # If the differential is less than the expiry days, throw a warning(1) 109 | if [ "$diff" -lt "$expiryDays" ] 110 | then 111 | printf "WARNING - Certificate $commonName will expire in less than $( numberOfDays $diff ).\n" 112 | exit 1 113 | fi 114 | 115 | # All OK(0) 116 | printf "OK - Certificate $commonName expires in $( numberOfDays $diff ).\n" 117 | exit 0 118 | -------------------------------------------------------------------------------- /check_osx_launchd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check launchd Tasks 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.0 - 1 Aug 2012 8 | # Initial release. 9 | 10 | # This script calls `launchctl list` and parses the output to report non-zero exit codes for tasks. This is very useful in 11 | # finding tasks that cannot launch and are 'Throttling respawn', as well as locating bad exit codes for scheduled tasks. 12 | 13 | # !! IMPORTANT: It is important that the script is run as a super user so that system tasks are included - otherwise you are just monitoring 14 | # tasks in the 'local' domain, which is unlikely to be anything you care about. 15 | 16 | # The preset_exceptions array below exists because some tasks exit with non-zero codes as standard, such as Apple's XProtect 17 | # anti-malware tool, which exits with a code of 252 when there are no new definitions on Apple's server. The execptions allow 18 | # for these kind of known tasks whose exit status is not pertinent to the monitoring of the system. 19 | 20 | # The -e flag allows you to supply extra exceptions as an argument. This is a comma delimited list of identifiers (see example below). 21 | 22 | # The -c flag allows you to supply critical processes as an argument. This is a comma delimited list of identifiers (see example below). 23 | # The default return for finding a process with a non-zero exit code is WARNING. This allows you to define processes that 24 | # will return CRITICAL. 25 | 26 | # The script takes the above arguments like this: 27 | # ./check_osx_launchd.sh -e com.apple.iCloudHelper,com.apple.NotesMigratorService -c com.apple.servermgrd 28 | 29 | preset_exceptions="com.apple.printuitool.agent,com.apple.coreservices.appleid.authentication,com.apple.afpstat-qfa,com.apple.mrt.uiagent,com.apple.printtool.agent,com.apple.accountsd,com.apple.xprotectupdater,com.apple.pfctl" 30 | preset_criticals="org.postgresql.postgres" 31 | 32 | # don't edit below this line unless you know what to do 33 | 34 | provided_exceptions="" 35 | provided_criticals="" 36 | non_zero=0 37 | critical=0 38 | non_zero_label_array=( ) 39 | 40 | while getopts "e:c:" optionName; do 41 | case "$optionName" in 42 | e) provided_exceptions=( $OPTARG );; 43 | c) provided_criticals=( $OPTARG );; 44 | esac 45 | done 46 | 47 | exceptions=$preset_exceptions","$provided_exceptions 48 | criticals=$preset_criticals","$provided_criticals 49 | 50 | # list all launchd processes, and look at exit codes 51 | launchctl list | { while read line ; do 52 | ld_pid=`echo $line | cut -d ' ' -f 1` 53 | ld_exit=`echo $line | cut -d ' ' -f 2` 54 | ld_label=`echo $line | cut -d ' ' -f 3` 55 | 56 | # skip exceptions 57 | case "${exceptions[@]}" in *"$ld_label"*) continue ;; esac 58 | # check tasks 59 | if [ "$ld_pid" != "-" ]; then 60 | # task is active 61 | let active++ 62 | #echo "$ld_label is active" 63 | else 64 | # task is inactive 65 | let inactive++ 66 | # look at last exit code 67 | if [ "$ld_exit" != "0" ]; then 68 | case "${criticals[@]}" in *"$ld_label"*) critical=1 ;; esac 69 | let non_zero++ 70 | non_zero_label_array[${#non_zero_label_array[*]}]="$ld_label" 71 | 72 | fi 73 | 74 | fi 75 | done 76 | 77 | non_zero_labels=`printf ",%s" "${non_zero_label_array[@]}" | cut -c2-` 78 | 79 | if [ $non_zero -gt 0 ] && [ $critical == 0 ]; then 80 | printf "WARNING - daemon/s ($non_zero_labels) exited with a non-zero code! | active=$active; inactive=$inactive; error=$non_zero;\n" 81 | exit 1 82 | elif [ $non_zero -gt 0 ] && [ $critical == 1 ]; then 83 | printf "CRITICAL - critical daemon/s ($non_zero_labels) exited with a non-zero code! | active=$active; inactive=$inactive; error=$non_zero;\n" 84 | exit 2 85 | else 86 | printf "OK - All daemons are active or exited successfully. | active=$active; inactive=$inactive; error=$non_zero;\n" 87 | exit 0 88 | fi 89 | 90 | } -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/xcuserdata/jedda.xcuserdatad/xcschemes/Release.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 76 | 82 | 83 | 84 | 85 | 87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/xcuserdata/jedda.xcuserdatad/xcschemes/check_osx_mem.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 76 | 82 | 83 | 84 | 85 | 87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /check_kerio_connect_stats.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Kerio Connect Statistics 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.1 - 27 Mar 2012 8 | # Added some timing padding to ensure reset occurs. 9 | 10 | # v1.0 - 26 Mar 2012 11 | # Initial release. 12 | 13 | # This script checks the stats.dat file in your kerio connect mailstore and lets you know if counters have passed warn/crit thresholds. 14 | # It returns full performance data on the requested counters, and finishes by using the Kerio Admin API to reset your statistics. 15 | # 16 | # You will need to fill in a few variables below to get this working. 17 | 18 | # The script takes the following arguments: 19 | # -n Quoted list (space delimited) of counter names you want to query. 20 | # -n Quoted list (space delimited) (same order) of warning thresholds for the counters. 21 | # -c Quoted list (space delimited) (same order) of critical thresholds for the counters. 22 | # 23 | # Examples: 24 | # 25 | # ./check_kerio_connect_stats.sh -n "mtaLargestSize" -w "4000" -c "10000" 26 | # returns: 27 | # OK | mtaLargestSize=3394; 28 | # 29 | # ./check_kerio_connect_stats.sh -n "mtaReceivedMessages mtaTransmittedMessages" -w "5 35" -c "25 48" 30 | # returns: 31 | # WARNING: mtaReceivedMessages is 8 | mtaReceivedMessages=8;mtaTransmittedMessages=11; 32 | 33 | # START CONFIG SECTION 34 | # the local path to your kerio connect mailstore. change if different 35 | kerioStore="/usr/local/kerio/mailserver" 36 | # put your kerio admin url, username and password below. this is used to reset your kerio stats after we are done. 37 | kerioAdminURL="https://your.server.url:4040" 38 | kerioAdminUser="Admin" 39 | kerioAdminPass="*YourPassword*" 40 | # END CONFIG SECTION 41 | 42 | # from here below is the script - don't change variables unless you know what you are doing 43 | function resetKerioStatistics() { 44 | login=`curl --cookie /tmp/tempcookies --cookie-jar /tmp/tempcookies -k -X POST -H "Content-type: application/json" \ 45 | -d '{"jsonrpc": "2.0","id": 1,"method": "Session.login","params": {"userName": "'$kerioAdminUser'","password": "'$kerioAdminPass'","application": {"name": "Statistics Reset","vendor": "jedda.me","version": "1.0.0"}}} 46 | ' -silent $kerioAdminURL'/admin/api/jsonrpc'` 47 | token=`echo $login | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w token | awk -F '|' '{ print $3 }'` 48 | reset=`curl --cookie /tmp/tempcookies -k -X POST -H "Content-type: application/json" -H "X-Token: $token" -d '{"jsonrpc":"2.0","id":1,"method":"Statistics.reset","params":{}}' -silent $kerioAdminURL'/admin/api/jsonrpc'` 49 | sleep 3 50 | logout=`curl --cookie /tmp/tempcookies -k -X POST -H "Content-type: application/json" -H "X-Token: $token" -d '{"jsonrpc": "2.0","id": 1, "method": "Session.logout"}' -silent $kerioAdminURL'/admin/api/jsonrpc'` 51 | } 52 | 53 | nameList="" 54 | warnList="" 55 | critList="" 56 | performance="" 57 | warnString="" 58 | critString="" 59 | i=0 60 | 61 | while getopts "n:w:c:" optionName; do 62 | case "$optionName" in 63 | n) nameList=( $OPTARG );; 64 | w) warnList=( $OPTARG );; 65 | c) critList=( $OPTARG );; 66 | esac 67 | done 68 | 69 | for counter in ${nameList[*]} 70 | do 71 | match=`grep $counter $kerioStore/stats.dat | tr -d '\t' ` 72 | value=`echo $match | awk -F '[>,<]' '{ print $3 }'` 73 | performance="$performance${nameList[$i]}=$value;" 74 | if [ $value -ge ${critList[$i]} ]; then 75 | critString="CRITICAL: ${nameList[$i]} is $value" 76 | fi 77 | if [ $value -ge ${warnList[$i]} ]; then 78 | warnString="WARNING: ${nameList[$i]} is $value" 79 | fi 80 | i=$((i+1)) 81 | done 82 | 83 | resetKerioStatistics & 84 | sleep 2 85 | 86 | if [ "$critString" != "" ]; then 87 | printf "$critString | $performance\n" 88 | exit 2 89 | elif [ "$warnString" != "" ]; then 90 | printf "$warnString | $performance\n" 91 | exit 1 92 | else 93 | printf "OK | $performance\n" 94 | exit 0 95 | fi 96 | 97 | 98 | -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | #import 6 | #import 7 | 8 | // check_osx_mem 9 | // by Jedda Wignall 10 | // http://jedda.me 11 | 12 | // v1.1 - 12 Mar 2012 13 | // Fixed issue with performance data. 14 | 15 | // v1.0 - 12 Mar 2012 16 | // Initial release. 17 | 18 | // Tool to report OSX memory utilization to nagios and Groundwork server. 19 | // Requires -w and -c values as percentage utilization. Returns lots of performance data. 20 | // ./check_osx_mem -w 65.00 -c 85.00 21 | 22 | 23 | int main (int argc, const char * argv[]) { 24 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 25 | 26 | BOOL warn = FALSE, crit = FALSE; 27 | NSNumber *warningThreshold, *criticalThreshold; 28 | 29 | // get our warning value 30 | if ([[[NSProcessInfo processInfo] arguments] containsObject:@"-w"]) { 31 | warningThreshold = [NSNumber numberWithFloat: [[[[NSProcessInfo processInfo] arguments] objectAtIndex: [[[NSProcessInfo processInfo] arguments] indexOfObject:@"-w"] + 1 ] floatValue] ]; 32 | //NSLog(@"Warning threshold is: %@", warningThreshold); 33 | } else { 34 | // no warning threshold defined. error out. 35 | NSLog(@"No warning threshold defined. You must set a warning threshold with -w!"); 36 | return 1; 37 | } 38 | 39 | // get our critical value 40 | if ([[[NSProcessInfo processInfo] arguments] containsObject:@"-c"]) { 41 | criticalThreshold = [NSNumber numberWithFloat: [[[[NSProcessInfo processInfo] arguments] objectAtIndex: [[[NSProcessInfo processInfo] arguments] indexOfObject:@"-c"] + 1 ] floatValue] ]; 42 | //NSLog(@"Warning threshold is: %@", criticalThreshold); 43 | } else { 44 | // no warning threshold defined. error out. 45 | NSLog(@"No critical threshold defined. You must set a critical threshold with -c!"); 46 | return 1; 47 | } 48 | 49 | mach_port_t host = mach_host_self(); 50 | if (!host) { 51 | NSLog(@"Could not get mach reference."); 52 | return 2; 53 | } 54 | 55 | vm_statistics_data_t vmStats; 56 | mach_msg_type_number_t vmCount = HOST_VM_INFO_COUNT; 57 | if (host_statistics(host, HOST_VM_INFO, (host_info_t)&vmStats, &vmCount) != KERN_SUCCESS) { 58 | NSLog(@"Could not get mach reference."); 59 | return 2; 60 | } 61 | 62 | NSInteger active = (NSInteger)((natural_t)vmStats.active_count) * (NSInteger)((natural_t)vm_page_size); 63 | NSInteger inactive = (NSInteger)((natural_t)vmStats.inactive_count) * (NSInteger)((natural_t)vm_page_size); 64 | NSInteger wired = (NSInteger)((natural_t)vmStats.wire_count) * (NSInteger)((natural_t)vm_page_size); 65 | NSInteger free = (NSInteger)((natural_t)vmStats.free_count) * (NSInteger)((natural_t)vm_page_size); 66 | NSInteger used = active + wired; 67 | NSInteger total = active + inactive + free + wired; 68 | 69 | // work out our memory percentage 70 | double percentage = ((double)used/(double)total) * 100.00 ; 71 | 72 | // build our performance data string 73 | NSString *performance = [NSString stringWithFormat:@"active=%f; wired=%f; inactive=%f; free=%f; total=%f; utilization=%f;\r\n", (double)(active/1048576), (double)(wired/1048576), (double)(inactive/1048576), (double)(free/1048576), (double)(total/1048576), (double)percentage]; 74 | 75 | // check critical 76 | if ([criticalThreshold compare:[NSNumber numberWithFloat:percentage]] == NSOrderedAscending) { 77 | printf([[NSString stringWithFormat:@"CRITICAL: %f percent memory utilization | %@", percentage, performance] cString]); 78 | [pool drain]; 79 | return 2; 80 | } 81 | 82 | // check warning 83 | if ([warningThreshold compare:[NSNumber numberWithFloat:percentage]] == NSOrderedAscending) { 84 | printf([[NSString stringWithFormat:@"WARNING: %f percent memory utilization | %@", percentage, performance] cString]); 85 | [pool drain]; 86 | return 1; 87 | } 88 | 89 | printf([[NSString stringWithFormat:@"OK: %f percent memory utilization | %@", percentage, performance] cString]); 90 | 91 | [pool drain]; 92 | return 0; 93 | } 94 | -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/jedda.pbxuser: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | 0419064013862DEB007FB1D0 /* check_osx_mem.m:106 */ = { 4 | isa = PBXFileBreakpoint; 5 | actions = ( 6 | ); 7 | breakpointStyle = 0; 8 | continueAfterActions = 0; 9 | countType = 0; 10 | delayBeforeContinue = 0; 11 | fileReference = 08FB7796FE84155DC02AAC07 /* check_osx_mem.m */; 12 | functionName = "main()"; 13 | hitCount = 0; 14 | ignoreCount = 0; 15 | lineNumber = 106; 16 | modificationTime = 327561740.423528; 17 | state = 0; 18 | }; 19 | 041906711386321E007FB1D0 /* PBXTextBookmark */ = { 20 | isa = PBXTextBookmark; 21 | fRef = 08FB7796FE84155DC02AAC07 /* check_osx_mem.m */; 22 | name = "check_osx_mem.m: 128"; 23 | rLen = 0; 24 | rLoc = 4598; 25 | rType = 0; 26 | vrLen = 947; 27 | vrLoc = 3651; 28 | }; 29 | 041A04F41512CCF6008AB8B2 /* PBXTextBookmark */ = { 30 | isa = PBXTextBookmark; 31 | fRef = 08FB7796FE84155DC02AAC07 /* check_osx_mem.m */; 32 | name = "check_osx_mem.m: 129"; 33 | rLen = 0; 34 | rLoc = 4598; 35 | rType = 0; 36 | vrLen = 1650; 37 | vrLoc = 0; 38 | }; 39 | 04B5E45A1386168F00A80C15 /* check_osx_mem */ = { 40 | isa = PBXExecutable; 41 | activeArgIndices = ( 42 | ); 43 | argumentStrings = ( 44 | ); 45 | autoAttachOnCrash = 1; 46 | breakpointsEnabled = 1; 47 | configStateDict = { 48 | }; 49 | customDataFormattersEnabled = 1; 50 | debuggerPlugin = GDBDebugging; 51 | disassemblyDisplayState = 0; 52 | dylibVariantSuffix = ""; 53 | enableDebugStr = 1; 54 | environmentEntries = ( 55 | ); 56 | executableSystemSymbolLevel = 0; 57 | executableUserSymbolLevel = 0; 58 | libgmallocEnabled = 0; 59 | name = check_osx_mem; 60 | savedGlobals = { 61 | }; 62 | sourceDirectories = ( 63 | ); 64 | variableFormatDictionary = { 65 | }; 66 | }; 67 | 04B5E465138616A200A80C15 /* Source Control */ = { 68 | isa = PBXSourceControlManager; 69 | fallbackIsa = XCSourceControlManager; 70 | isSCMEnabled = 0; 71 | scmConfiguration = { 72 | repositoryNamesForRoots = { 73 | "" = ""; 74 | }; 75 | }; 76 | }; 77 | 04B5E466138616A200A80C15 /* Code sense */ = { 78 | isa = PBXCodeSenseManager; 79 | indexTemplatePath = ""; 80 | }; 81 | 08FB7793FE84155DC02AAC07 /* Project object */ = { 82 | activeBuildConfigurationName = Debug; 83 | activeExecutable = 04B5E45A1386168F00A80C15 /* check_osx_mem */; 84 | activeSDKPreference = macosx10.5; 85 | activeTarget = 8DD76F960486AA7600D96B5E /* check_osx_mem */; 86 | breakpoints = ( 87 | 0419064013862DEB007FB1D0 /* check_osx_mem.m:106 */, 88 | ); 89 | codeSenseManager = 04B5E466138616A200A80C15 /* Code sense */; 90 | executables = ( 91 | 04B5E45A1386168F00A80C15 /* check_osx_mem */, 92 | ); 93 | perUserDictionary = { 94 | "PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = { 95 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 96 | PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID; 97 | PBXFileTableDataSourceColumnWidthsKey = ( 98 | 20, 99 | 20, 100 | 198, 101 | 20, 102 | 99, 103 | 99, 104 | 29, 105 | 20, 106 | ); 107 | PBXFileTableDataSourceColumnsKey = ( 108 | PBXBreakpointsDataSource_ActionID, 109 | PBXBreakpointsDataSource_TypeID, 110 | PBXBreakpointsDataSource_BreakpointID, 111 | PBXBreakpointsDataSource_UseID, 112 | PBXBreakpointsDataSource_LocationID, 113 | PBXBreakpointsDataSource_ConditionID, 114 | PBXBreakpointsDataSource_IgnoreCountID, 115 | PBXBreakpointsDataSource_ContinueID, 116 | ); 117 | }; 118 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { 119 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; 120 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; 121 | PBXFileTableDataSourceColumnWidthsKey = ( 122 | 20, 123 | 1084, 124 | 20, 125 | 48, 126 | 43, 127 | 43, 128 | 20, 129 | ); 130 | PBXFileTableDataSourceColumnsKey = ( 131 | PBXFileDataSource_FiletypeID, 132 | PBXFileDataSource_Filename_ColumnID, 133 | PBXFileDataSource_Built_ColumnID, 134 | PBXFileDataSource_ObjectSize_ColumnID, 135 | PBXFileDataSource_Errors_ColumnID, 136 | PBXFileDataSource_Warnings_ColumnID, 137 | PBXFileDataSource_Target_ColumnID, 138 | ); 139 | }; 140 | PBXPerProjectTemplateStateSaveDate = 353553617; 141 | PBXWorkspaceStateSaveDate = 353553617; 142 | }; 143 | perUserProjectItems = { 144 | 041906711386321E007FB1D0 /* PBXTextBookmark */ = 041906711386321E007FB1D0 /* PBXTextBookmark */; 145 | 041A04F41512CCF6008AB8B2 /* PBXTextBookmark */ = 041A04F41512CCF6008AB8B2 /* PBXTextBookmark */; 146 | }; 147 | sourceControlManager = 04B5E465138616A200A80C15 /* Source Control */; 148 | userBuildSettings = { 149 | }; 150 | }; 151 | 08FB7796FE84155DC02AAC07 /* check_osx_mem.m */ = { 152 | uiCtxt = { 153 | sepNavIntBoundsRect = "{{0, 0}, {1262, 1806}}"; 154 | sepNavSelRange = "{4598, 0}"; 155 | sepNavVisRange = "{0, 1650}"; 156 | }; 157 | }; 158 | 8DD76F960486AA7600D96B5E /* check_osx_mem */ = { 159 | activeExec = 0; 160 | executables = ( 161 | 04B5E45A1386168F00A80C15 /* check_osx_mem */, 162 | ); 163 | }; 164 | } 165 | -------------------------------------------------------------------------------- /check_od_status.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check Open Directory Status 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.2 - 7 Dec 2012 8 | # Added performance data for slapd connections. 9 | # 10 | # v1.1 - 2 Dec 2012 11 | # Re-release to fix Mountain Lion issues. Script now runs on 10.8, and will 'fall back' to further checks on 10.7 and earlier. 12 | # 13 | # v1.0 - 30 Nov 2012 14 | # Initial release. 15 | 16 | # Script that uses status elements from serveradmin to report the status of LDAP, PasswordServer, and Kerberos 17 | # as Mac OS X Server understands them. As this script uses the serveradmin tool, it requires root priveleges. 18 | 19 | # The script will run with no arguments, and will check to ensure serveradmin sees Open Directory as RUNNING. 20 | # On 10.7 and earlier, it will also check individual OD components. In a production environment, I recommend 21 | # usage of the optional arguments below to ensure your config remains sound and unchanged. 22 | 23 | # Optional Arguments: 24 | # -t Expected server type to check against. The two main options here are 'master', and 'replica'. 25 | # -s Expected LDAP search base to check against. 26 | # -r Expected Kerberos realm to check against. 27 | 28 | # Example: 29 | # ./check_od_status.sh -t 'master' -s 'dc=odm,dc=pretendco,dc=com'-r 'ODM.PRETENDCO.COM' 30 | 31 | # Performance Data - this script returns the followng Nagios performance data: 32 | # slapdConn - Number of tcp connections to slapd LDAP daemon. 33 | 34 | # We use this on our client's monitored servers to ensure that no changes have been made to OD configurations, and that 35 | # those configs have come up clean across reboots, ect. 36 | 37 | # Compatibility - this script has been tested on and functions on the following stock OSes: 38 | # 10.5 Server 39 | # 10.6 Server 40 | # 10.7 Server 41 | # 10.8 Server 42 | # 10.9 Server 43 | 44 | if [[ $EUID -ne 0 ]]; then 45 | printf "ERROR - This script must be run as root.\n" 46 | exit 1 47 | fi 48 | 49 | expectedServerType="" 50 | expectedSearchBase="" 51 | expectedKerberosRealm="" 52 | 53 | while getopts "t:s:r:" optionName; do 54 | case "$optionName" in 55 | t) expectedServerType=( "$OPTARG" );; 56 | s) expectedSearchBase=( "$OPTARG" );; 57 | r) expectedKerberosRealm=( "$OPTARG" );; 58 | esac 59 | done 60 | 61 | # check od status 62 | odStatusString=`serveradmin fullstatus dirserv | grep 'dirserv:state' | sed -E 's/dirserv:state.+"(.+)"/\1/'` 63 | if [ "$odStatusString" != "RUNNING" ]; then 64 | printf "CRITICAL - Open Directory does not appear to be running!\n" 65 | exit 2 66 | fi 67 | 68 | if sw_vers | grep -q '10.5' || sw_vers | grep -q '10.6' || sw_vers | grep -q '10.7'; then 69 | 70 | # we can get specific statuses on od components in 10.5-7 71 | 72 | # check kerberos kdc status 73 | kdcStatusString=`serveradmin fullstatus dirserv | grep 'dirserv:kdcStatus' | sed -E 's/dirserv:kdcStatus.+"(.+)"/\1/'` 74 | if [ "$kdcStatusString" != "RUNNING" ]; then 75 | printf "CRITICAL - Kerberos KDC does not appear to be running!\n" 76 | exit 2 77 | fi 78 | 79 | # check password server status 80 | passStatusString=`serveradmin fullstatus dirserv | grep 'dirserv:passwordServiceState' | sed -E 's/dirserv:passwordServiceState.+"(.+)"/\1/'` 81 | if [ "$passStatusString" != "RUNNING" ]; then 82 | printf "CRITICAL - Password Server does not appear to be running!\n" 83 | exit 2 84 | fi 85 | 86 | # check ldap status 87 | ldapdStatusString=`serveradmin fullstatus dirserv | grep 'dirserv:ldapdState' | sed -E 's/dirserv:ldapdState.+"(.+)"/\1/'` 88 | if [ "$ldapdStatusString" != "RUNNING" ]; then 89 | printf "CRITICAL - LDAP Server does not appear to be running!\n" 90 | exit 2 91 | fi 92 | 93 | fi 94 | 95 | # check how many tcp connections slapd currently has 96 | slapdConnections=`sudo lsof -i tcp:389 | grep slapd | wc -l | grep -E -o "[0-9]+"` 97 | 98 | serverTypeString=`serveradmin fullstatus dirserv | grep 'dirserv:LDAPServerType' | sed -E 's/dirserv:LDAPServerType.+"(.+)"/\1/'` 99 | if [ "$expectedServerType" != "" ]; then 100 | # we are going to check against our expected server type 101 | if [ "$serverTypeString" != "$expectedServerType" ]; then 102 | printf "CRITICAL - OD server type does not match expected! We expected $expectedServerType, but reported type was $serverTypeString. | slapdConn=$slapdConnections;\n" 103 | exit 2 104 | fi 105 | fi 106 | 107 | if [ "$expectedSearchBase" != "" ]; then 108 | # we are going to check against our expected search base 109 | searchBaseString=`serveradmin fullstatus dirserv | grep 'dirserv:ldapSearchBase' | sed -E 's/dirserv:ldapSearchBase.+"(.+)"/\1/'` 110 | if [ "$searchBaseString" != "$expectedSearchBase" ]; then 111 | printf "CRITICAL - LDAP search base does not match expected! We expected $expectedSearchBase, but reported type was $searchBaseString. | slapdConn=$slapdConnections;\n" 112 | exit 2 113 | fi 114 | fi 115 | 116 | if [ "$expectedKerberosRealm" != "" ]; then 117 | # we are going to check against our expected kerberos realm 118 | kerberosRealmString=`serveradmin fullstatus dirserv | grep 'dirserv:kdcHostedRealm' | sed -E 's/dirserv:kdcHostedRealm.+"(.+)"/\1/'` 119 | if [ "$kerberosRealmString" != "$expectedKerberosRealm" ]; then 120 | printf "CRITICAL - Kerberos realm does not match expected! We expected $expectedKerberosRealm, but reported type was $kerberosRealmString. | slapdConn=$slapdConnections;\n" 121 | exit 2 122 | fi 123 | fi 124 | 125 | printf "OK - Server reports that the components of this OD $serverTypeString are running OK. | slapdConn=$slapdConnections;\n" 126 | exit 0 -------------------------------------------------------------------------------- /check_smart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check S.M.A.R.T. (check_smart.sh) 4 | # by Dan Barrett 5 | # http://yesdevnull.net 6 | 7 | # v1.0 - 9 Aug 2013 8 | # Initial release. 9 | 10 | # Read S.M.A.R.T. data from the specified disk using smartmontools 11 | # (http://sourceforge.net/apps/trac/smartmontools/wiki) 12 | 13 | # Arguments: 14 | # -d Drive BSD name (disk0/disk1 etc) 15 | # -g Graph item(s) 16 | 17 | # Example: 18 | # ./check_smart.sh -d disk0 -g "badSectors tempCelcius" 19 | # OR 20 | # ./check_smart.sh -d disk1 21 | 22 | # Performance Data 23 | # * badSectors Number of bad sectors on disk 24 | # * reallocSectors Number of re-allocated sectors on disk 25 | # * powerOnHours Number of hours the disk has been powered on for 26 | # * tempCelcius Temperature in celcius of the disk (internal) 27 | # * retiredBlockCount Number of retired blocks 28 | # * lifetimeWrites Number of lifetime writes (in GiB) 29 | # * lifetimeReads Number of lifetime read (in GiB) 30 | 31 | # Supports: 32 | # * OS X 10.8.x 33 | # * OS X 10.9 34 | 35 | disk="" 36 | graphs="" 37 | graphString="" 38 | 39 | badSectors=0 40 | reallocSectors=0 41 | 42 | # Get the flags! 43 | while getopts "d:g:" opt 44 | do 45 | case $opt in 46 | d ) disk=$OPTARG;; 47 | g ) graphs=$OPTARG;; 48 | esac 49 | done 50 | 51 | # enable SMART on the drive if it is not already 52 | smartoncmd=`/opt/local/libexec/nagios/smartctl --smart=on --saveauto=on $disk` 53 | 54 | resultString=`/opt/local/libexec/nagios/smartctl -H $disk` 55 | 56 | if echo $graphs | grep -q -E "[A-Za-z ]+" 57 | then 58 | graphString="|" 59 | fi 60 | 61 | # Did user want badSectors graph? 62 | if echo $graphs | grep -q "badSectors" 63 | then 64 | badSectors=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Reallocated_Sector_Ct' | grep -E -o "[0-9]+" | tail -1 ` 65 | graphString="$graphString badSectors=$badSectors;" 66 | fi 67 | 68 | # Did user want reallocSectors graph? 69 | if echo $graphs | grep -q "reallocSectors" 70 | then 71 | reallocSectors=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Reallocated_Event_Count' | grep -E -o "[0-9]+" | tail -1` 72 | graphString="$graphString reallocSectors=$reallocSectors;" 73 | fi 74 | 75 | # Did user want powerOnHours graph? 76 | if echo $graphs | grep -q "powerOnHours" 77 | then 78 | powerOnHours=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Power_On_Hours' | grep -E -o "[0-9]+" | tail -1` 79 | graphString="$graphString powerOnHours=$powerOnHours;" 80 | fi 81 | 82 | # Did user want tempCelcius graph? 83 | if echo $graphs | grep -q "tempCelcius" 84 | then 85 | internalTemp=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Temperature_Celsius' | grep -E -o "[0-9]+[^0-9/\)]" | sed 's/ //g' | tail -1` 86 | graphString="$graphString tempCelcius=$internalTemp;" 87 | fi 88 | 89 | # Did user want retiredBlockCount graph? 90 | if echo $graphs | grep -q "retiredBlockCount" 91 | then 92 | retiredBlockCount=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Retired_Block_Count' | grep -E -o "[0-9]+" | tail -1` 93 | graphString="$graphString retiredBlockCount=$retiredBlockCount;" 94 | fi 95 | 96 | # Did user want lifetimeWrites graph? 97 | if echo $graphs | grep -q "lifetimeWrites" 98 | then 99 | lifetimeWrites=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Lifetime_Writes_GiB' | grep -E -o "[0-9]+" | tail -1` 100 | graphString="$graphString lifetimeWrites=$lifetimeWrites;" 101 | fi 102 | 103 | # Did user want lifetimeReads graph? 104 | if echo $graphs | grep -q "lifetimeReads" 105 | then 106 | lifetimeReads=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Lifetime_Reads_GiB' | grep -E -o "[0-9]+" | tail -1` 107 | graphString="$graphString lifetimeReads=$lifetimeReads;" 108 | fi 109 | 110 | if echo $resultString | grep -q "PASSED" 111 | then 112 | printf "OK - All S.M.A.R.T. attributes passed $graphString\n" 113 | exit 0 114 | else 115 | # Check to see if there's been many seek error rates 116 | seekErrorRateRaw=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Seek_Error_Rate' | grep -E -o "[0-9]+" | tail -1` 117 | if [ $seekErrorRateRaw -gt 50 ] 118 | then 119 | printf "CRITICAL - Drive is having constant read errors! $graphString\n" 120 | exit 2 121 | fi 122 | 123 | if [ $seekErrorRateRaw -gt 25 ] 124 | then 125 | printf "WARNING - Drive has had multiple read errors! $graphString\n" 126 | exit 1 127 | fi 128 | 129 | # Make sure the drive isn't hitting its maximum temperature! 130 | tempRaw=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Temperature_Celsius' | grep -E -o "[0-9]+" | tail -1` 131 | if [ $tempRaw -gt 65 ] 132 | then 133 | printf "CRITICAL - Drive is maxing out its maximum designed temperature! $graphString\n" 134 | exit 2 135 | fi 136 | 137 | if [ $tempRaw -gt 60 ] 138 | then 139 | printf "WARNING - Drive is close to its maximum designed temperature! $graphString\n" 140 | exit 1 141 | fi 142 | 143 | # Get the first line that is FAILING_NOW 144 | failString=`echo $resultString | grep -C 0 'FAILING_NOW'` 145 | # Now we make a human readable error message 146 | if echo $failString | grep -q "Reallocated_Sector_Ct\|Reallocated_Event_Count" 147 | then 148 | printf "CRITICAL - Drive has bad sectors! $graphString\n" 149 | exit 2 150 | elif echo $failString | grep -q "Command_Timeout" 151 | then 152 | printf "CRITICAL - Drive is having constant timeout issues, check any power sources! $graphString\n" 153 | exit 2 154 | elif echo $failString | grep -q "Temperature_Celsius" 155 | then 156 | printf "CRITICAL - Drive is exposed to extreme temperatures! $graphString\n" 157 | exit 2 158 | elif echo $failString | grep -q "Seek_Error_Rate\|Raw_Read_Error_Rate" 159 | then 160 | printf "CRITICAL - Drive is having constant read errors! $graphString\n" 161 | exit 2 162 | else 163 | printf "WARNING - Drive has failing S.M.A.R.T. attributes! $graphString\n" 164 | exit 1 165 | fi 166 | fi -------------------------------------------------------------------------------- /check_osx_smc/check_osx_smc/smc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Apple System Management Control (SMC) Tool 3 | * Copyright (C) 2006 devnull 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include "smc.h" 24 | 25 | static io_connect_t conn; 26 | 27 | uint32_t _strtoul(char *str, int size, int base) 28 | { 29 | uint32_t total = 0; 30 | int i; 31 | 32 | for (i = 0; i < size; i++) 33 | { 34 | if (base == 16) 35 | total += str[i] << (size - 1 - i) * 8; 36 | else 37 | total += (unsigned char) (str[i] << (size - 1 - i) * 8); 38 | } 39 | return total; 40 | } 41 | 42 | void _ultostr(char *str, UInt32 val) 43 | { 44 | str[0] = '\0'; 45 | sprintf(str, "%c%c%c%c", 46 | (unsigned int) val >> 24, 47 | (unsigned int) val >> 16, 48 | (unsigned int) val >> 8, 49 | (unsigned int) val); 50 | } 51 | 52 | float _strtof(char *str, int size, int e) { 53 | float total = 0; 54 | int i; 55 | 56 | for (i = 0; i < size; i++) { 57 | if (i == (size - 1)) 58 | total += (str[i] & 0xff) >> e; 59 | else 60 | total += str[i] << (size - 1 - i) * (8 - e); 61 | } 62 | 63 | return total; 64 | } 65 | 66 | kern_return_t SMCOpen(void) 67 | { 68 | kern_return_t result; 69 | mach_port_t masterPort; 70 | io_iterator_t iterator; 71 | io_object_t device; 72 | 73 | result = IOMasterPort(MACH_PORT_NULL, &masterPort); 74 | 75 | CFMutableDictionaryRef matchingDictionary = IOServiceMatching("AppleSMC"); 76 | result = IOServiceGetMatchingServices(masterPort, matchingDictionary, &iterator); 77 | if (result != kIOReturnSuccess) 78 | { 79 | printf("Error: IOServiceGetMatchingServices() = %08x\n", result); 80 | return 1; 81 | } 82 | 83 | device = IOIteratorNext(iterator); 84 | IOObjectRelease(iterator); 85 | if (device == 0) 86 | { 87 | printf("Error: no SMC found\n"); 88 | return 1; 89 | } 90 | 91 | result = IOServiceOpen(device, mach_task_self(), 0, &conn); 92 | IOObjectRelease(device); 93 | if (result != kIOReturnSuccess) 94 | { 95 | printf("Error: IOServiceOpen() = %08x\n", result); 96 | return 1; 97 | } 98 | 99 | return kIOReturnSuccess; 100 | } 101 | 102 | kern_return_t SMCClose() 103 | { 104 | return IOServiceClose(conn); 105 | } 106 | 107 | 108 | kern_return_t SMCCall(int index, SMCKeyData_t *inputStructure, SMCKeyData_t *outputStructure) 109 | { 110 | size_t structureInputSize; 111 | size_t structureOutputSize; 112 | 113 | structureInputSize = sizeof(SMCKeyData_t); 114 | structureOutputSize = sizeof(SMCKeyData_t); 115 | 116 | #if MAC_OS_X_VERSION_10_5 117 | return IOConnectCallStructMethod( conn, index, 118 | // inputStructure 119 | inputStructure, structureInputSize, 120 | // ouputStructure 121 | outputStructure, &structureOutputSize ); 122 | #else 123 | return IOConnectMethodStructureIStructureO( conn, index, 124 | structureInputSize, /* structureInputSize */ 125 | &structureOutputSize, /* structureOutputSize */ 126 | inputStructure, /* inputStructure */ 127 | outputStructure); /* ouputStructure */ 128 | #endif 129 | 130 | } 131 | 132 | kern_return_t SMCReadKey(UInt32Char_t key, SMCVal_t *val) 133 | { 134 | kern_return_t result; 135 | SMCKeyData_t inputStructure; 136 | SMCKeyData_t outputStructure; 137 | 138 | memset(&inputStructure, 0, sizeof(SMCKeyData_t)); 139 | memset(&outputStructure, 0, sizeof(SMCKeyData_t)); 140 | memset(val, 0, sizeof(SMCVal_t)); 141 | 142 | inputStructure.key = _strtoul(key, 4, 16); 143 | inputStructure.data8 = SMC_CMD_READ_KEYINFO; 144 | 145 | result = SMCCall(KERNEL_INDEX_SMC, &inputStructure, &outputStructure); 146 | if (result != kIOReturnSuccess) 147 | return result; 148 | 149 | val->dataSize = outputStructure.keyInfo.dataSize; 150 | _ultostr(val->dataType, outputStructure.keyInfo.dataType); 151 | inputStructure.keyInfo.dataSize = val->dataSize; 152 | inputStructure.data8 = SMC_CMD_READ_BYTES; 153 | 154 | result = SMCCall(KERNEL_INDEX_SMC, &inputStructure, &outputStructure); 155 | if (result != kIOReturnSuccess) 156 | return result; 157 | 158 | memcpy(val->bytes, outputStructure.bytes, sizeof(outputStructure.bytes)); 159 | 160 | return kIOReturnSuccess; 161 | } 162 | 163 | double SMCGetTemperature(char *key) 164 | { 165 | SMCVal_t val; 166 | kern_return_t result; 167 | 168 | result = SMCReadKey(key, &val); 169 | if (result == kIOReturnSuccess) { 170 | // read succeeded - check returned value 171 | if (val.dataSize > 0) { 172 | if (strcmp(val.dataType, DATATYPE_SP78) == 0) { 173 | // convert fp78 value to temperature 174 | int intValue = (val.bytes[0] * 256 + val.bytes[1]) >> 2; 175 | return intValue / 64.0; 176 | } 177 | } 178 | } 179 | // read failed 180 | return 0.0; 181 | } 182 | 183 | int SMCGetFanRPM(char *key) 184 | { 185 | SMCVal_t val; 186 | kern_return_t result; 187 | 188 | result = SMCReadKey(key, &val); 189 | if (result == kIOReturnSuccess) { 190 | // read succeeded - check returned value 191 | if (val.dataSize > 0) { 192 | if (strcmp(val.dataType, DATATYPE_FPE2) == 0) { 193 | // convert FPE2 value to int value 194 | return (int)_strtof(val.bytes, val.dataSize, 2); 195 | } 196 | } 197 | } 198 | // read failed 199 | return 0.0; 200 | } 201 | 202 | -------------------------------------------------------------------------------- /check_osx_caching.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check OS X Caching Server 4 | # by Jedda Wignall 5 | # http://jedda.me 6 | 7 | # v1.2 - 04 Nov 2013 8 | # Added specific port checking 9 | 10 | # v1.1 - 17 Mar 2013 11 | # Fixed quotation marks in databasePath (line 72) so that custom paths with spacing will work. 12 | 13 | # v1.0 - 17 Dec 2012 14 | # Initial release. 15 | 16 | # Script that uses serveradmin to check that the OS X Caching service is listed as running. 17 | # If all is OK, it returns performance data for the size and limits of cached content, number of cached packages and 18 | # bytes requested by and returned from the service. 19 | # Also checks to see if the Caching service is running on the port that is set in caching:Port 20 | 21 | # Example: 22 | # ./check_osx_caching.sh 23 | 24 | # Performance Data - this script returns the followng Nagios performance data: 25 | # reservedSpace - Space reserved by the caching service for cache use. 26 | # cacheUsed - Space currently used by all cached content. 27 | # cacheFree - Space available for new cached content. 28 | # cacheLimit - User defined limit for cache in Server.app. If unlimited, free space on the selected volume. 29 | # bytesRequested - Bytes requested FROM APPLE for content. (Downloads from Apple's servers). 30 | # bytesReturned - Bytes returned TO CLIENTS for content. (Cached content, as well as real-time downloads from Apple's servers). 31 | # numberOfPkgs - Number of packages currently cached by the service. 32 | 33 | # Additional Mavericks Performance Data: 34 | # macAppsUsage - Space used by App Store downloads 35 | # iosAppsUsage - Space used by iOS apps and updates 36 | # ibooksUsage - Space used by iBooks downloads 37 | # moviesUsage - Space used by Movies downloads 38 | # musicUsage - Space used by Music downloads 39 | # otherUsage - Space used by Misc downloads 40 | 41 | # Compatibility - this script has been tested on and functions on the following stock OSes: 42 | # 10.8.2+ Server with Server.app 2.2+ 43 | # 10.9+ Server with Server.app 3+ 44 | 45 | if [[ $EUID -ne 0 ]]; then 46 | printf "ERROR - This script must be run as root.\n" 47 | exit 1 48 | fi 49 | 50 | # Check that the caching service is running 51 | cachingStatus=`serveradmin fullstatus caching | grep 'caching:state' | sed -E 's/caching:state.+"(.+)"/\1/'` 52 | if [ "$cachingStatus" != "RUNNING" ]; then 53 | printf "CRITICAL - Caching service is not running!\n" 54 | exit 2 55 | fi 56 | 57 | # Check that the caching service has registered with Apple 58 | cachingRegistrationStatus=`serveradmin fullstatus caching | grep 'caching:RegistrationStatus ' | grep -E -o "[0-9]+$"` 59 | if [ "$cachingRegistrationStatus" != "1" ]; then 60 | printf "CRITICAL - Caching service has not yet registered with Apple!\n" 61 | exit 2 62 | fi 63 | 64 | 65 | # Check that the caching service is active, and that has fully started up. 66 | cachingActive=`serveradmin fullstatus caching | grep 'caching:Active ' | grep -E -o "[a-z]+$"` 67 | cachingStartupStatus=`serveradmin fullstatus caching | grep 'caching:StartupStatus' | sed -E 's/caching:StartupStatus.+"(.+)"/\1/'` 68 | if [ "$cachingActive" != "yes" ] || [ "$cachingStartupStatus" != "OK" ]; then 69 | printf "WARNING - Caching service is running, but has not fully started up.\n" 70 | exit 1 71 | fi 72 | 73 | specifiedCachingPort=`serveradmin settings caching | grep 'caching:Port ' | grep -E -o "[0-9]+$"` 74 | currentCachingPort=`serveradmin fullstatus caching | grep 'caching:Port ' | grep -E -o "[0-9]+$"` 75 | if [ $specifiedCachingPort != "0" ] 76 | then 77 | if [ "$currentCachingPort" != "$specifiedCachingPort" ] 78 | then 79 | printf "WARNING - Caching Server is running on port $currentCachingPort and not $specifiedCachingPort as required.\n" 80 | exit 1 81 | fi 82 | fi 83 | 84 | # Check that the cache itself reports as OK 85 | cachingStatus=`serveradmin fullstatus caching | grep 'caching:CacheStatus' | sed -E 's/caching:CacheStatus.+"(.+)"/\1/'` 86 | if [ "$cachingStatus" != "OK" ]; then 87 | printf "WARNING - Caching service reported a problem with its data cache.\n" 88 | exit 1 89 | fi 90 | 91 | # Check to see if we're running Mavericks Server as there's a bit more usage verbosity 92 | osVersion=`sw_vers -productVersion | grep -E -o "[0-9]+\.[0-9]"` 93 | isMavericks=`echo $osVersion '< 10.9' | bc -l` 94 | mavericksPerfData='' 95 | 96 | if [ $isMavericks -eq 0 ] 97 | then 98 | macAppsUsage=`serveradmin fullstatus caching | grep 'caching:CacheDetails:_array_index:0:BytesUsed' | grep -E -o "[0-9]+$"` 99 | iosAppsUsage=`serveradmin fullstatus caching | grep 'caching:CacheDetails:_array_index:1:BytesUsed' | grep -E -o "[0-9]+$"` 100 | ibooksUsage=`serveradmin fullstatus caching | grep 'caching:CacheDetails:_array_index:2:BytesUsed' | grep -E -o "[0-9]+$"` 101 | moviesUsage=`serveradmin fullstatus caching | grep 'caching:CacheDetails:_array_index:3:BytesUsed' | grep -E -o "[0-9]+$"` 102 | musicUsage=`serveradmin fullstatus caching | grep 'caching:CacheDetails:_array_index:4:BytesUsed' | grep -E -o "[0-9]+$"` 103 | otherUsage=`serveradmin fullstatus caching | grep 'caching:CacheDetails:_array_index:5:BytesUsed' | grep -E -o "[0-9]+$"` 104 | 105 | mavericksPerfData="macAppsUsage=$macAppsUsage; iosAppsUsage=$iosAppsUsage; ibooksUsage=$ibooksUsage; moviesUsage=$moviesUsage; musicUsage=$musicUsage; otherUsage=$otherUsage;" 106 | fi 107 | 108 | # Grab our performance data 109 | reservedSpace=`serveradmin settings caching | grep 'caching:ReservedVolumeSpace ' | grep -E -o "[0-9]+$"` 110 | cacheUsed=`serveradmin fullstatus caching | grep 'caching:CacheUsed ' | grep -E -o "[0-9]+$"` 111 | cacheFree=`serveradmin fullstatus caching | grep 'caching:CacheFree ' | grep -E -o "[0-9]+$"` 112 | cacheLimit=`serveradmin fullstatus caching | grep 'caching:CacheLimit ' | grep -E -o "[0-9]+$"` 113 | bytesRequested=`serveradmin fullstatus caching | grep 'caching:TotalBytesRequested' | grep -E -o "[0-9]+$"` 114 | bytesReturned=`serveradmin fullstatus caching | grep 'caching:TotalBytesReturned' | grep -E -o "[0-9]+$"` 115 | databasePath="`serveradmin settings caching | grep 'caching:DataPath' | sed -E 's/caching:DataPath.+"(.+)"/\1/'`/AssetInfo.db" 116 | numberOfPkgs=`sqlite3 "$databasePath" 'SELECT count(*) from ZASSET;'` 117 | 118 | # Lastly, make sure that we can connect to the service port 119 | cachingServicePort=`serveradmin fullstatus caching | grep 'caching:Port' | grep -E -o "[0-9]+$"` 120 | curl -silent localhost:$cachingServicePort > /dev/null 121 | if [ $? == 7 ]; then 122 | printf "CRITICAL - Could not connect to the Caching service port ($cachingServicePort)!\n" 123 | exit 2 124 | fi 125 | 126 | printf "OK - Caching service appears to be running OK. | reservedSpace=$reservedSpace; cacheUsed=$cacheUsed; cacheFree=$cacheFree; cacheLimit=$cacheLimit; bytesRequested=$bytesRequested; bytesReturned=$bytesReturned; numberOfPkgs=$numberOfPkgs; $mavericksPerfData\n" 127 | exit 0 -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8DD76F9A0486AA7600D96B5E /* check_osx_mem.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* check_osx_mem.m */; settings = {ATTRIBUTES = (); }; }; 11 | 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXCopyFilesBuildPhase section */ 15 | 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { 16 | isa = PBXCopyFilesBuildPhase; 17 | buildActionMask = 8; 18 | dstPath = /usr/share/man/man1/; 19 | dstSubfolderSpec = 0; 20 | files = ( 21 | ); 22 | runOnlyForDeploymentPostprocessing = 1; 23 | }; 24 | /* End PBXCopyFilesBuildPhase section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 08FB7796FE84155DC02AAC07 /* check_osx_mem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = check_osx_mem.m; sourceTree = ""; }; 28 | 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 29 | 32A70AAB03705E1F00C91783 /* check_osx_mem_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = check_osx_mem_Prefix.pch; sourceTree = ""; }; 30 | 8DD76FA10486AA7600D96B5E /* check_osx_mem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = check_osx_mem; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 08FB7794FE84155DC02AAC07 /* check_osx_mem */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | 08FB7795FE84155DC02AAC07 /* Source */, 49 | 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, 50 | 1AB674ADFE9D54B511CA2CBB /* Products */, 51 | ); 52 | name = check_osx_mem; 53 | sourceTree = ""; 54 | }; 55 | 08FB7795FE84155DC02AAC07 /* Source */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 32A70AAB03705E1F00C91783 /* check_osx_mem_Prefix.pch */, 59 | 08FB7796FE84155DC02AAC07 /* check_osx_mem.m */, 60 | ); 61 | name = Source; 62 | sourceTree = ""; 63 | }; 64 | 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 08FB779EFE84155DC02AAC07 /* Foundation.framework */, 68 | ); 69 | name = "External Frameworks and Libraries"; 70 | sourceTree = ""; 71 | }; 72 | 1AB674ADFE9D54B511CA2CBB /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 8DD76FA10486AA7600D96B5E /* check_osx_mem */, 76 | ); 77 | name = Products; 78 | sourceTree = ""; 79 | }; 80 | /* End PBXGroup section */ 81 | 82 | /* Begin PBXNativeTarget section */ 83 | 8DD76F960486AA7600D96B5E /* check_osx_mem */ = { 84 | isa = PBXNativeTarget; 85 | buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "check_osx_mem" */; 86 | buildPhases = ( 87 | 8DD76F990486AA7600D96B5E /* Sources */, 88 | 8DD76F9B0486AA7600D96B5E /* Frameworks */, 89 | 8DD76F9E0486AA7600D96B5E /* CopyFiles */, 90 | ); 91 | buildRules = ( 92 | ); 93 | dependencies = ( 94 | ); 95 | name = check_osx_mem; 96 | productInstallPath = "$(HOME)/bin"; 97 | productName = check_osx_mem; 98 | productReference = 8DD76FA10486AA7600D96B5E /* check_osx_mem */; 99 | productType = "com.apple.product-type.tool"; 100 | }; 101 | /* End PBXNativeTarget section */ 102 | 103 | /* Begin PBXProject section */ 104 | 08FB7793FE84155DC02AAC07 /* Project object */ = { 105 | isa = PBXProject; 106 | attributes = { 107 | LastUpgradeCheck = 0440; 108 | }; 109 | buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "check_osx_mem" */; 110 | compatibilityVersion = "Xcode 3.2"; 111 | developmentRegion = English; 112 | hasScannedForEncodings = 1; 113 | knownRegions = ( 114 | English, 115 | Japanese, 116 | French, 117 | German, 118 | ); 119 | mainGroup = 08FB7794FE84155DC02AAC07 /* check_osx_mem */; 120 | projectDirPath = ""; 121 | projectRoot = ""; 122 | targets = ( 123 | 8DD76F960486AA7600D96B5E /* check_osx_mem */, 124 | ); 125 | }; 126 | /* End PBXProject section */ 127 | 128 | /* Begin PBXSourcesBuildPhase section */ 129 | 8DD76F990486AA7600D96B5E /* Sources */ = { 130 | isa = PBXSourcesBuildPhase; 131 | buildActionMask = 2147483647; 132 | files = ( 133 | 8DD76F9A0486AA7600D96B5E /* check_osx_mem.m in Sources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXSourcesBuildPhase section */ 138 | 139 | /* Begin XCBuildConfiguration section */ 140 | 1DEB927508733DD40010E9CD /* Debug */ = { 141 | isa = XCBuildConfiguration; 142 | buildSettings = { 143 | ALWAYS_SEARCH_USER_PATHS = NO; 144 | COPY_PHASE_STRIP = NO; 145 | GCC_DYNAMIC_NO_PIC = NO; 146 | GCC_MODEL_TUNING = G5; 147 | GCC_OPTIMIZATION_LEVEL = 0; 148 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 149 | GCC_PREFIX_HEADER = check_osx_mem_Prefix.pch; 150 | INSTALL_PATH = /usr/local/bin; 151 | PRODUCT_NAME = check_osx_mem; 152 | SDKROOT = macosx10.7; 153 | }; 154 | name = Debug; 155 | }; 156 | 1DEB927608733DD40010E9CD /* Release */ = { 157 | isa = XCBuildConfiguration; 158 | buildSettings = { 159 | ALWAYS_SEARCH_USER_PATHS = NO; 160 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 161 | GCC_MODEL_TUNING = G5; 162 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 163 | GCC_PREFIX_HEADER = check_osx_mem_Prefix.pch; 164 | INSTALL_PATH = /usr/local/bin; 165 | PRODUCT_NAME = check_osx_mem; 166 | SDKROOT = macosx10.7; 167 | }; 168 | name = Release; 169 | }; 170 | 1DEB927908733DD40010E9CD /* Debug */ = { 171 | isa = XCBuildConfiguration; 172 | buildSettings = { 173 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 174 | GCC_C_LANGUAGE_STANDARD = gnu99; 175 | GCC_OPTIMIZATION_LEVEL = 0; 176 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 177 | GCC_WARN_UNUSED_VARIABLE = YES; 178 | ONLY_ACTIVE_ARCH = YES; 179 | SDKROOT = macosx; 180 | }; 181 | name = Debug; 182 | }; 183 | 1DEB927A08733DD40010E9CD /* Release */ = { 184 | isa = XCBuildConfiguration; 185 | buildSettings = { 186 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 187 | GCC_C_LANGUAGE_STANDARD = gnu99; 188 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 189 | GCC_WARN_UNUSED_VARIABLE = YES; 190 | SDKROOT = macosx; 191 | }; 192 | name = Release; 193 | }; 194 | /* End XCBuildConfiguration section */ 195 | 196 | /* Begin XCConfigurationList section */ 197 | 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "check_osx_mem" */ = { 198 | isa = XCConfigurationList; 199 | buildConfigurations = ( 200 | 1DEB927508733DD40010E9CD /* Debug */, 201 | 1DEB927608733DD40010E9CD /* Release */, 202 | ); 203 | defaultConfigurationIsVisible = 0; 204 | defaultConfigurationName = Release; 205 | }; 206 | 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "check_osx_mem" */ = { 207 | isa = XCConfigurationList; 208 | buildConfigurations = ( 209 | 1DEB927908733DD40010E9CD /* Debug */, 210 | 1DEB927A08733DD40010E9CD /* Release */, 211 | ); 212 | defaultConfigurationIsVisible = 0; 213 | defaultConfigurationName = Release; 214 | }; 215 | /* End XCConfigurationList section */ 216 | }; 217 | rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; 218 | } 219 | -------------------------------------------------------------------------------- /check_osx_smc/check_osx_smc.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 049E13BE173890970090C502 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 049E13BD173890970090C502 /* Foundation.framework */; }; 11 | 049E13C1173890970090C502 /* check_osx_smc.m in Sources */ = {isa = PBXBuildFile; fileRef = 049E13C0173890970090C502 /* check_osx_smc.m */; }; 12 | 049E13CD173890F30090C502 /* smc.c in Sources */ = {isa = PBXBuildFile; fileRef = 049E13CB173890F30090C502 /* smc.c */; }; 13 | 049E13D0173891520090C502 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 049E13CF173891520090C502 /* IOKit.framework */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXCopyFilesBuildPhase section */ 17 | 049E13B8173890970090C502 /* CopyFiles */ = { 18 | isa = PBXCopyFilesBuildPhase; 19 | buildActionMask = 2147483647; 20 | dstPath = /usr/share/man/man1/; 21 | dstSubfolderSpec = 0; 22 | files = ( 23 | ); 24 | runOnlyForDeploymentPostprocessing = 1; 25 | }; 26 | /* End PBXCopyFilesBuildPhase section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 049E13BA173890970090C502 /* check_osx_smc */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = check_osx_smc; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 049E13BD173890970090C502 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 31 | 049E13C0173890970090C502 /* check_osx_smc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = check_osx_smc.m; sourceTree = ""; }; 32 | 049E13CB173890F30090C502 /* smc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smc.c; sourceTree = ""; }; 33 | 049E13CC173890F30090C502 /* smc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smc.h; sourceTree = ""; }; 34 | 049E13CF173891520090C502 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 049E13B7173890970090C502 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | 049E13D0173891520090C502 /* IOKit.framework in Frameworks */, 43 | 049E13BE173890970090C502 /* Foundation.framework in Frameworks */, 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | 049E13B1173890970090C502 = { 51 | isa = PBXGroup; 52 | children = ( 53 | 049E13BF173890970090C502 /* check_osx_smc */, 54 | 049E13BC173890970090C502 /* Frameworks */, 55 | 049E13BB173890970090C502 /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | 049E13BB173890970090C502 /* Products */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 049E13BA173890970090C502 /* check_osx_smc */, 63 | ); 64 | name = Products; 65 | sourceTree = ""; 66 | }; 67 | 049E13BC173890970090C502 /* Frameworks */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 049E13CF173891520090C502 /* IOKit.framework */, 71 | 049E13BD173890970090C502 /* Foundation.framework */, 72 | ); 73 | name = Frameworks; 74 | sourceTree = ""; 75 | }; 76 | 049E13BF173890970090C502 /* check_osx_smc */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 049E13C0173890970090C502 /* check_osx_smc.m */, 80 | 049E13C2173890970090C502 /* Supporting Files */, 81 | ); 82 | path = check_osx_smc; 83 | sourceTree = ""; 84 | }; 85 | 049E13C2173890970090C502 /* Supporting Files */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 049E13CE173891160090C502 /* SMC Tool */, 89 | ); 90 | name = "Supporting Files"; 91 | sourceTree = ""; 92 | }; 93 | 049E13CE173891160090C502 /* SMC Tool */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 049E13CB173890F30090C502 /* smc.c */, 97 | 049E13CC173890F30090C502 /* smc.h */, 98 | ); 99 | name = "SMC Tool"; 100 | sourceTree = ""; 101 | }; 102 | /* End PBXGroup section */ 103 | 104 | /* Begin PBXNativeTarget section */ 105 | 049E13B9173890970090C502 /* check_osx_smc */ = { 106 | isa = PBXNativeTarget; 107 | buildConfigurationList = 049E13C8173890970090C502 /* Build configuration list for PBXNativeTarget "check_osx_smc" */; 108 | buildPhases = ( 109 | 049E13B6173890970090C502 /* Sources */, 110 | 049E13B7173890970090C502 /* Frameworks */, 111 | 049E13B8173890970090C502 /* CopyFiles */, 112 | ); 113 | buildRules = ( 114 | ); 115 | dependencies = ( 116 | ); 117 | name = check_osx_smc; 118 | productName = check_osx_smc; 119 | productReference = 049E13BA173890970090C502 /* check_osx_smc */; 120 | productType = "com.apple.product-type.tool"; 121 | }; 122 | /* End PBXNativeTarget section */ 123 | 124 | /* Begin PBXProject section */ 125 | 049E13B2173890970090C502 /* Project object */ = { 126 | isa = PBXProject; 127 | attributes = { 128 | LastUpgradeCheck = 0460; 129 | ORGANIZATIONNAME = jedda; 130 | }; 131 | buildConfigurationList = 049E13B5173890970090C502 /* Build configuration list for PBXProject "check_osx_smc" */; 132 | compatibilityVersion = "Xcode 3.2"; 133 | developmentRegion = English; 134 | hasScannedForEncodings = 0; 135 | knownRegions = ( 136 | en, 137 | ); 138 | mainGroup = 049E13B1173890970090C502; 139 | productRefGroup = 049E13BB173890970090C502 /* Products */; 140 | projectDirPath = ""; 141 | projectRoot = ""; 142 | targets = ( 143 | 049E13B9173890970090C502 /* check_osx_smc */, 144 | ); 145 | }; 146 | /* End PBXProject section */ 147 | 148 | /* Begin PBXSourcesBuildPhase section */ 149 | 049E13B6173890970090C502 /* Sources */ = { 150 | isa = PBXSourcesBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | 049E13C1173890970090C502 /* check_osx_smc.m in Sources */, 154 | 049E13CD173890F30090C502 /* smc.c in Sources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXSourcesBuildPhase section */ 159 | 160 | /* Begin XCBuildConfiguration section */ 161 | 049E13C6173890970090C502 /* Debug */ = { 162 | isa = XCBuildConfiguration; 163 | buildSettings = { 164 | ALWAYS_SEARCH_USER_PATHS = NO; 165 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 166 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 167 | CLANG_CXX_LIBRARY = "libc++"; 168 | CLANG_ENABLE_OBJC_ARC = YES; 169 | CLANG_WARN_CONSTANT_CONVERSION = YES; 170 | CLANG_WARN_EMPTY_BODY = YES; 171 | CLANG_WARN_ENUM_CONVERSION = YES; 172 | CLANG_WARN_INT_CONVERSION = YES; 173 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 174 | COPY_PHASE_STRIP = NO; 175 | DEBUG_INFORMATION_FORMAT = dwarf; 176 | GCC_C_LANGUAGE_STANDARD = gnu99; 177 | GCC_DYNAMIC_NO_PIC = NO; 178 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 179 | GCC_OPTIMIZATION_LEVEL = 0; 180 | GCC_PREPROCESSOR_DEFINITIONS = ( 181 | "DEBUG=1", 182 | "$(inherited)", 183 | ); 184 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 185 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 186 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 187 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 188 | GCC_WARN_UNUSED_VARIABLE = YES; 189 | MACOSX_DEPLOYMENT_TARGET = 10.7; 190 | ONLY_ACTIVE_ARCH = YES; 191 | OTHER_CFLAGS = ""; 192 | SDKROOT = macosx10.7; 193 | }; 194 | name = Debug; 195 | }; 196 | 049E13C7173890970090C502 /* Release */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 201 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 202 | CLANG_CXX_LIBRARY = "libc++"; 203 | CLANG_ENABLE_OBJC_ARC = YES; 204 | CLANG_WARN_CONSTANT_CONVERSION = YES; 205 | CLANG_WARN_EMPTY_BODY = YES; 206 | CLANG_WARN_ENUM_CONVERSION = YES; 207 | CLANG_WARN_INT_CONVERSION = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | COPY_PHASE_STRIP = YES; 210 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 211 | GCC_C_LANGUAGE_STANDARD = gnu99; 212 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 213 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 214 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 215 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 216 | GCC_WARN_UNUSED_VARIABLE = YES; 217 | MACOSX_DEPLOYMENT_TARGET = 10.7; 218 | OTHER_CFLAGS = ""; 219 | SDKROOT = macosx10.7; 220 | }; 221 | name = Release; 222 | }; 223 | 049E13C9173890970090C502 /* Debug */ = { 224 | isa = XCBuildConfiguration; 225 | buildSettings = { 226 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 227 | GCC_PRECOMPILE_PREFIX_HEADER = NO; 228 | GCC_PREFIX_HEADER = ""; 229 | OTHER_CFLAGS = ""; 230 | PRODUCT_NAME = "$(TARGET_NAME)"; 231 | SDKROOT = macosx10.7; 232 | }; 233 | name = Debug; 234 | }; 235 | 049E13CA173890970090C502 /* Release */ = { 236 | isa = XCBuildConfiguration; 237 | buildSettings = { 238 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 239 | GCC_PRECOMPILE_PREFIX_HEADER = NO; 240 | GCC_PREFIX_HEADER = ""; 241 | OTHER_CFLAGS = ""; 242 | PRODUCT_NAME = "$(TARGET_NAME)"; 243 | SDKROOT = macosx10.7; 244 | }; 245 | name = Release; 246 | }; 247 | /* End XCBuildConfiguration section */ 248 | 249 | /* Begin XCConfigurationList section */ 250 | 049E13B5173890970090C502 /* Build configuration list for PBXProject "check_osx_smc" */ = { 251 | isa = XCConfigurationList; 252 | buildConfigurations = ( 253 | 049E13C6173890970090C502 /* Debug */, 254 | 049E13C7173890970090C502 /* Release */, 255 | ); 256 | defaultConfigurationIsVisible = 0; 257 | defaultConfigurationName = Release; 258 | }; 259 | 049E13C8173890970090C502 /* Build configuration list for PBXNativeTarget "check_osx_smc" */ = { 260 | isa = XCConfigurationList; 261 | buildConfigurations = ( 262 | 049E13C9173890970090C502 /* Debug */, 263 | 049E13CA173890970090C502 /* Release */, 264 | ); 265 | defaultConfigurationIsVisible = 0; 266 | defaultConfigurationName = Release; 267 | }; 268 | /* End XCConfigurationList section */ 269 | }; 270 | rootObject = 049E13B2173890970090C502 /* Project object */; 271 | } 272 | -------------------------------------------------------------------------------- /check_osx_smc/check_osx_smc/check_osx_smc.m: -------------------------------------------------------------------------------- 1 | // check_osx_mem 2 | // by Jedda Wignall 3 | // http://jedda.me 4 | 5 | // v1.0 - 07 May 2013 6 | // Initial release. 7 | 8 | // Nagios plugin to read and report SMC readings (temperature, fan speed) on Apple hardware. 9 | // Part of the Mac OS X Monitoring Tools project [https://github.com/jedda/OSX-Monitoring-Tools] 10 | // https://github.com/jedda/OSX-Monitoring-Tools/tree/master/check_osx_smc 11 | 12 | #import 13 | #include 14 | #include "smc.h" 15 | 16 | #define VERSION "1.0" 17 | 18 | int main(int argc, const char * argv[]) 19 | { 20 | @autoreleasepool { 21 | 22 | // do we need to print help? 23 | if ([[[NSProcessInfo processInfo] arguments] containsObject:@"-h"] || [[[NSProcessInfo processInfo] arguments] count] == 1) { 24 | printf("check_smc_osx version "); 25 | printf(VERSION); 26 | printf("\n"); 27 | printf("by Jedda Wignall (http://jedda.me)"); 28 | printf("\n\n"); 29 | printf("Nagios plugin to read and report SMC readings (temperature, fan speed) on Apple hardware."); 30 | printf("\n\n"); 31 | printf("Usage: "); 32 | printf([[[[NSProcessInfo processInfo] arguments] objectAtIndex:0] cString]); 33 | printf(" [options]"); 34 | printf("\n\n"); 35 | printf("Options:\n"); 36 | printf("-r [required] : comma delimited list of smc registers to read\n"); 37 | printf("-w [required] : comma delimited list of warning thresholds\n"); 38 | printf("-c [required] : comma delimited list of critical thresholds\n"); 39 | printf("-s [required] : temperature scale to use. c for celcius, f for fahrenheit\n"); 40 | printf("-h : display this help\n"); 41 | printf("\n"); 42 | printf("Example:\n"); 43 | printf("./check_osx_smc -r TA0P,TC0D,F0Ac -w 75,85,3800 -c 85,100,5200 -s c\n\n"); 44 | printf("This example on a 2011 Mac mini Server would check TA0P (Ambient Air 1), TC0D (CPU Diode), and F0Ac (Primary Fan Speed). It would return values in degrees Celcius, return warning status on values above values of 75,85,3800 respectively, and return critical status above values of 85,100,5200 respectively.\n\n"); 45 | printf("SMC Registers:\n"); 46 | printf("This plugin currently accepts and processes SMC registers for temperature and fan speed. There are plans in the future to implement power values too. It is up to the end user to provide register keys to the script, but a list of known values for current hardware is located at: https://github.com/jedda/OSX-Monitoring-Tools/blob/master/check_osx_smc/known-registers.md\n\n"); 47 | printf("Source Code & Licensing:\n"); 48 | printf("The source code of this plugin is available at: https://github.com/jedda/OSX-Monitoring-Tools/blob/master/check_osx_smc/\n"); 49 | printf("This plugin includes and makes use of 'Apple System Management Control (SMC) Tool' by devnull, which is licensed under the GNU General Public License. All other parts of this plugin are made available under an unlicense, and is free and unencumbered software released into the public domain. Please refer to the LICENSE for further details: https://github.com/jedda/OSX-Monitoring-Tools/blob/master/LICENSE.\n\n"); 50 | printf("Support, Bugs & Issues:\n"); 51 | printf("This plugin is free and open-source, and as such, support is limited - queries can be directed to http://jedda.me/contact-jedda/. Any issues or bugs should be registered on GitHub here: https://github.com/jedda/OSX-Monitoring-Tools/issues\n"); 52 | return 3; 53 | } 54 | 55 | BOOL warn = FALSE, crit = FALSE; 56 | NSArray *smcRegisters, *warnThresholds, *critThresholds; 57 | NSMutableArray *performance = [NSMutableArray array]; 58 | NSMutableArray *status = [NSMutableArray array]; 59 | NSString *scale; 60 | 61 | NSNumberFormatter *tempFormatter = [[NSNumberFormatter alloc] init]; 62 | tempFormatter.format = @"#0.0"; 63 | NSNumberFormatter *fanFormatter = [[NSNumberFormatter alloc] init]; 64 | fanFormatter.format = @"#"; 65 | NSNumberFormatter *performanceFormatter = [[NSNumberFormatter alloc] init]; 66 | performanceFormatter.format = @"#0.0000"; 67 | 68 | // get our smc registers 69 | if ([[[NSProcessInfo processInfo] arguments] containsObject:@"-r"]) { 70 | NSString* regString = [[[NSProcessInfo processInfo] arguments] objectAtIndex: [[[NSProcessInfo processInfo] arguments] indexOfObject:@"-r"] + 1 ]; 71 | smcRegisters = [regString componentsSeparatedByString:@","]; 72 | } else { 73 | // no smc registers defined. error out. 74 | printf("No SMC registers defined. You must supply at least one register with -r! Use -h to view help."); 75 | return 3; 76 | } 77 | 78 | // get our warning thresholds 79 | if ([[[NSProcessInfo processInfo] arguments] containsObject:@"-w"]) { 80 | NSString* warnString = [[[NSProcessInfo processInfo] arguments] objectAtIndex: [[[NSProcessInfo processInfo] arguments] indexOfObject:@"-w"] + 1 ]; 81 | warnThresholds = [warnString componentsSeparatedByString:@","]; 82 | } else { 83 | // no warning threshold defined. error out. 84 | printf("No warning threshold defined. You must set a warning threshold with -w! Use -h to view help."); 85 | return 3; 86 | } 87 | 88 | // get our crtitical thresholds 89 | if ([[[NSProcessInfo processInfo] arguments] containsObject:@"-c"]) { 90 | NSString* critString = [[[NSProcessInfo processInfo] arguments] objectAtIndex: [[[NSProcessInfo processInfo] arguments] indexOfObject:@"-c"] + 1 ]; 91 | critThresholds = [critString componentsSeparatedByString:@","]; 92 | } else { 93 | // no critical threshold defined. error out. 94 | printf("No critical threshold defined. You must set a critical threshold with -c! Use -h to view help."); 95 | return 3; 96 | } 97 | 98 | // get our temperature scale 99 | if ([[[NSProcessInfo processInfo] arguments] containsObject:@"-s"]) { 100 | scale = [[[NSProcessInfo processInfo] arguments] objectAtIndex: [[[NSProcessInfo processInfo] arguments] indexOfObject:@"-s"] + 1 ]; 101 | } else { 102 | // no temperature scale defined. error out. 103 | printf("No temperature scale defined. You must supply a value to -s of either c (Celsius) or f (Fahrenheit)! Use -h to view help."); 104 | return 3; 105 | } 106 | 107 | // ensure that registers and thresholds have been evenly defined 108 | if (smcRegisters.count != warnThresholds.count || warnThresholds.count != critThresholds.count) { 109 | printf("The number of supplied SMC registers and warning/critical thresholds does not match. Please ensure you are supplying the same number of each."); 110 | return 3; 111 | } 112 | 113 | // read the smc registers 114 | 115 | SMCOpen(); 116 | 117 | for (NSString *registerKey in smcRegisters) { 118 | 119 | double value = 0.0; 120 | double warnThreshold = [[warnThresholds objectAtIndex:[smcRegisters indexOfObject:registerKey]] doubleValue]; 121 | double critThreshold = [[critThresholds objectAtIndex:[smcRegisters indexOfObject:registerKey]] doubleValue]; 122 | 123 | if ([registerKey hasPrefix:@"T"]) { 124 | // this is a temperature sensor 125 | value = SMCGetTemperature([registerKey cStringUsingEncoding:NSUTF8StringEncoding]); 126 | // do we need to convert to fahrenheit? 127 | if ([scale isEqualToString:@"f"]) { 128 | value = ((9.0 / 5.0) * value) + 32; 129 | } 130 | if (value >= critThreshold || value == 0.0) { 131 | crit = TRUE; 132 | [status addObject:[NSString stringWithFormat:@"%@ is %@%@", registerKey, [tempFormatter stringFromNumber:[NSNumber numberWithDouble:value]] , [scale uppercaseString]]]; 133 | } else if (value >= warnThreshold) { 134 | warn = TRUE; 135 | [status addObject:[NSString stringWithFormat:@"%@ is %@%@", registerKey, [tempFormatter stringFromNumber:[NSNumber numberWithDouble:value]] , [scale uppercaseString]]]; 136 | } 137 | } else if ([registerKey hasPrefix:@"F"]) { 138 | // this is a fan sensor 139 | value = (double)SMCGetFanRPM([registerKey cStringUsingEncoding:NSUTF8StringEncoding]); 140 | if (value >= critThreshold || value == 0.0) { 141 | crit = TRUE; 142 | [status addObject:[NSString stringWithFormat:@"%@ at %@rpm", registerKey, [fanFormatter stringFromNumber:[NSNumber numberWithDouble:value]]]]; 143 | } else if (value >= warnThreshold) { 144 | warn = TRUE; 145 | [status addObject:[NSString stringWithFormat:@"%@ at %@rpm", registerKey, [fanFormatter stringFromNumber:[NSNumber numberWithDouble:value]]]]; 146 | } 147 | } 148 | 149 | // add to our array of performance data 150 | [performance addObject:[NSString stringWithFormat:@"%@=%@;%@;%@;", registerKey, [performanceFormatter stringFromNumber:[NSNumber numberWithDouble:value]], [performanceFormatter stringFromNumber:[NSNumber numberWithDouble:warnThreshold]], [performanceFormatter stringFromNumber:[NSNumber numberWithDouble:critThreshold]]]]; 151 | 152 | } 153 | 154 | SMCClose(); 155 | 156 | if (crit == TRUE) { 157 | printf([[NSString stringWithFormat:@"CRITICAL - %@ | %@\n", [status componentsJoinedByString:@", "], [performance componentsJoinedByString:@" "]] cString]); 158 | return 2; 159 | } else if (warn == TRUE) { 160 | printf([[NSString stringWithFormat:@"WARNING - %@ | %@\n", [status componentsJoinedByString:@", "], [performance componentsJoinedByString:@" "]] cString]); 161 | return 1; 162 | } else { 163 | printf([[NSString stringWithFormat:@"OK - All sensors within threshold! | %@\n", [performance componentsJoinedByString:@" "]] cString]); 164 | return 0; 165 | } 166 | 167 | 168 | } 169 | } 170 | 171 | -------------------------------------------------------------------------------- /check_osx_mem/check_osx_mem.xcodeproj/jedda.mode1v3: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ActivePerspectiveName 6 | Project 7 | AllowedModules 8 | 9 | 10 | BundleLoadPath 11 | 12 | MaxInstances 13 | n 14 | Module 15 | PBXSmartGroupTreeModule 16 | Name 17 | Groups and Files Outline View 18 | 19 | 20 | BundleLoadPath 21 | 22 | MaxInstances 23 | n 24 | Module 25 | PBXNavigatorGroup 26 | Name 27 | Editor 28 | 29 | 30 | BundleLoadPath 31 | 32 | MaxInstances 33 | n 34 | Module 35 | XCTaskListModule 36 | Name 37 | Task List 38 | 39 | 40 | BundleLoadPath 41 | 42 | MaxInstances 43 | n 44 | Module 45 | XCDetailModule 46 | Name 47 | File and Smart Group Detail Viewer 48 | 49 | 50 | BundleLoadPath 51 | 52 | MaxInstances 53 | 1 54 | Module 55 | PBXBuildResultsModule 56 | Name 57 | Detailed Build Results Viewer 58 | 59 | 60 | BundleLoadPath 61 | 62 | MaxInstances 63 | 1 64 | Module 65 | PBXProjectFindModule 66 | Name 67 | Project Batch Find Tool 68 | 69 | 70 | BundleLoadPath 71 | 72 | MaxInstances 73 | n 74 | Module 75 | XCProjectFormatConflictsModule 76 | Name 77 | Project Format Conflicts List 78 | 79 | 80 | BundleLoadPath 81 | 82 | MaxInstances 83 | n 84 | Module 85 | PBXBookmarksModule 86 | Name 87 | Bookmarks Tool 88 | 89 | 90 | BundleLoadPath 91 | 92 | MaxInstances 93 | n 94 | Module 95 | PBXClassBrowserModule 96 | Name 97 | Class Browser 98 | 99 | 100 | BundleLoadPath 101 | 102 | MaxInstances 103 | n 104 | Module 105 | PBXCVSModule 106 | Name 107 | Source Code Control Tool 108 | 109 | 110 | BundleLoadPath 111 | 112 | MaxInstances 113 | n 114 | Module 115 | PBXDebugBreakpointsModule 116 | Name 117 | Debug Breakpoints Tool 118 | 119 | 120 | BundleLoadPath 121 | 122 | MaxInstances 123 | n 124 | Module 125 | XCDockableInspector 126 | Name 127 | Inspector 128 | 129 | 130 | BundleLoadPath 131 | 132 | MaxInstances 133 | n 134 | Module 135 | PBXOpenQuicklyModule 136 | Name 137 | Open Quickly Tool 138 | 139 | 140 | BundleLoadPath 141 | 142 | MaxInstances 143 | 1 144 | Module 145 | PBXDebugSessionModule 146 | Name 147 | Debugger 148 | 149 | 150 | BundleLoadPath 151 | 152 | MaxInstances 153 | 1 154 | Module 155 | PBXDebugCLIModule 156 | Name 157 | Debug Console 158 | 159 | 160 | BundleLoadPath 161 | 162 | MaxInstances 163 | n 164 | Module 165 | XCSnapshotModule 166 | Name 167 | Snapshots Tool 168 | 169 | 170 | BundlePath 171 | /Volumes/Backup/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources 172 | Description 173 | DefaultDescriptionKey 174 | DockingSystemVisible 175 | 176 | Extension 177 | mode1v3 178 | FavBarConfig 179 | 180 | PBXProjectModuleGUID 181 | 04B5E462138616A200A80C15 182 | XCBarModuleItemNames 183 | 184 | XCBarModuleItems 185 | 186 | 187 | FirstTimeWindowDisplayed 188 | 189 | Identifier 190 | com.apple.perspectives.project.mode1v3 191 | MajorVersion 192 | 33 193 | MinorVersion 194 | 0 195 | Name 196 | Default 197 | Notifications 198 | 199 | OpenEditors 200 | 201 | PerspectiveWidths 202 | 203 | -1 204 | -1 205 | 206 | Perspectives 207 | 208 | 209 | ChosenToolbarItems 210 | 211 | active-combo-popup 212 | action 213 | NSToolbarFlexibleSpaceItem 214 | debugger-enable-breakpoints 215 | build-and-go 216 | com.apple.ide.PBXToolbarStopButton 217 | get-info 218 | NSToolbarFlexibleSpaceItem 219 | com.apple.pbx.toolbar.searchfield 220 | 221 | ControllerClassBaseName 222 | 223 | IconName 224 | WindowOfProjectWithEditor 225 | Identifier 226 | perspective.project 227 | IsVertical 228 | 229 | Layout 230 | 231 | 232 | ContentConfiguration 233 | 234 | PBXBottomSmartGroupGIDs 235 | 236 | 1C37FBAC04509CD000000102 237 | 1C37FAAC04509CD000000102 238 | 1C37FABC05509CD000000102 239 | 1C37FABC05539CD112110102 240 | E2644B35053B69B200211256 241 | 1C37FABC04509CD000100104 242 | 1CC0EA4004350EF90044410B 243 | 1CC0EA4004350EF90041110B 244 | 245 | PBXProjectModuleGUID 246 | 1CE0B1FE06471DED0097A5F4 247 | PBXProjectModuleLabel 248 | Files 249 | PBXProjectStructureProvided 250 | yes 251 | PBXSmartGroupTreeModuleColumnData 252 | 253 | PBXSmartGroupTreeModuleColumnWidthsKey 254 | 255 | 186 256 | 257 | PBXSmartGroupTreeModuleColumnsKey_v4 258 | 259 | MainColumn 260 | 261 | 262 | PBXSmartGroupTreeModuleOutlineStateKey_v7 263 | 264 | PBXSmartGroupTreeModuleOutlineStateExpansionKey 265 | 266 | 08FB7794FE84155DC02AAC07 267 | 1C37FABC05509CD000000102 268 | 269 | PBXSmartGroupTreeModuleOutlineStateSelectionKey 270 | 271 | 272 | 0 273 | 274 | 275 | PBXSmartGroupTreeModuleOutlineStateVisibleRectKey 276 | {{0, 0}, {186, 838}} 277 | 278 | PBXTopSmartGroupGIDs 279 | 280 | XCIncludePerspectivesSwitch 281 | 282 | XCSharingToken 283 | com.apple.Xcode.GFSharingToken 284 | 285 | GeometryConfiguration 286 | 287 | Frame 288 | {{0, 0}, {203, 856}} 289 | GroupTreeTableConfiguration 290 | 291 | MainColumn 292 | 186 293 | 294 | RubberWindowFrame 295 | -9 95 1531 897 0 0 1280 1002 296 | 297 | Module 298 | PBXSmartGroupTreeModule 299 | Proportion 300 | 203pt 301 | 302 | 303 | Dock 304 | 305 | 306 | BecomeActive 307 | 308 | ContentConfiguration 309 | 310 | PBXProjectModuleGUID 311 | 1CE0B20306471E060097A5F4 312 | PBXProjectModuleLabel 313 | check_osx_mem.m 314 | PBXSplitModuleInNavigatorKey 315 | 316 | Split0 317 | 318 | PBXProjectModuleGUID 319 | 1CE0B20406471E060097A5F4 320 | PBXProjectModuleLabel 321 | check_osx_mem.m 322 | _historyCapacity 323 | 0 324 | bookmark 325 | 041A04F41512CCF6008AB8B2 326 | history 327 | 328 | 041906711386321E007FB1D0 329 | 330 | 331 | SplitCount 332 | 1 333 | 334 | StatusBarVisibility 335 | 336 | 337 | GeometryConfiguration 338 | 339 | Frame 340 | {{0, 0}, {1323, 680}} 341 | RubberWindowFrame 342 | -9 95 1531 897 0 0 1280 1002 343 | 344 | Module 345 | PBXNavigatorGroup 346 | Proportion 347 | 680pt 348 | 349 | 350 | ContentConfiguration 351 | 352 | PBXProjectModuleGUID 353 | 1CE0B20506471E060097A5F4 354 | PBXProjectModuleLabel 355 | Detail 356 | 357 | GeometryConfiguration 358 | 359 | Frame 360 | {{0, 685}, {1323, 171}} 361 | RubberWindowFrame 362 | -9 95 1531 897 0 0 1280 1002 363 | 364 | Module 365 | XCDetailModule 366 | Proportion 367 | 171pt 368 | 369 | 370 | Proportion 371 | 1323pt 372 | 373 | 374 | Name 375 | Project 376 | ServiceClasses 377 | 378 | XCModuleDock 379 | PBXSmartGroupTreeModule 380 | XCModuleDock 381 | PBXNavigatorGroup 382 | XCDetailModule 383 | 384 | TableOfContents 385 | 386 | 041A04F51512CCF6008AB8B2 387 | 1CE0B1FE06471DED0097A5F4 388 | 041A04F61512CCF6008AB8B2 389 | 1CE0B20306471E060097A5F4 390 | 1CE0B20506471E060097A5F4 391 | 392 | ToolbarConfigUserDefaultsMinorVersion 393 | 2 394 | ToolbarConfiguration 395 | xcode.toolbar.config.defaultV3 396 | 397 | 398 | ControllerClassBaseName 399 | 400 | IconName 401 | WindowOfProject 402 | Identifier 403 | perspective.morph 404 | IsVertical 405 | 0 406 | Layout 407 | 408 | 409 | BecomeActive 410 | 1 411 | ContentConfiguration 412 | 413 | PBXBottomSmartGroupGIDs 414 | 415 | 1C37FBAC04509CD000000102 416 | 1C37FAAC04509CD000000102 417 | 1C08E77C0454961000C914BD 418 | 1C37FABC05509CD000000102 419 | 1C37FABC05539CD112110102 420 | E2644B35053B69B200211256 421 | 1C37FABC04509CD000100104 422 | 1CC0EA4004350EF90044410B 423 | 1CC0EA4004350EF90041110B 424 | 425 | PBXProjectModuleGUID 426 | 11E0B1FE06471DED0097A5F4 427 | PBXProjectModuleLabel 428 | Files 429 | PBXProjectStructureProvided 430 | yes 431 | PBXSmartGroupTreeModuleColumnData 432 | 433 | PBXSmartGroupTreeModuleColumnWidthsKey 434 | 435 | 186 436 | 437 | PBXSmartGroupTreeModuleColumnsKey_v4 438 | 439 | MainColumn 440 | 441 | 442 | PBXSmartGroupTreeModuleOutlineStateKey_v7 443 | 444 | PBXSmartGroupTreeModuleOutlineStateExpansionKey 445 | 446 | 29B97314FDCFA39411CA2CEA 447 | 1C37FABC05509CD000000102 448 | 449 | PBXSmartGroupTreeModuleOutlineStateSelectionKey 450 | 451 | 452 | 0 453 | 454 | 455 | PBXSmartGroupTreeModuleOutlineStateVisibleRectKey 456 | {{0, 0}, {186, 337}} 457 | 458 | PBXTopSmartGroupGIDs 459 | 460 | XCIncludePerspectivesSwitch 461 | 1 462 | XCSharingToken 463 | com.apple.Xcode.GFSharingToken 464 | 465 | GeometryConfiguration 466 | 467 | Frame 468 | {{0, 0}, {203, 355}} 469 | GroupTreeTableConfiguration 470 | 471 | MainColumn 472 | 186 473 | 474 | RubberWindowFrame 475 | 373 269 690 397 0 0 1440 878 476 | 477 | Module 478 | PBXSmartGroupTreeModule 479 | Proportion 480 | 100% 481 | 482 | 483 | Name 484 | Morph 485 | PreferredWidth 486 | 300 487 | ServiceClasses 488 | 489 | XCModuleDock 490 | PBXSmartGroupTreeModule 491 | 492 | TableOfContents 493 | 494 | 11E0B1FE06471DED0097A5F4 495 | 496 | ToolbarConfiguration 497 | xcode.toolbar.config.default.shortV3 498 | 499 | 500 | PerspectivesBarVisible 501 | 502 | ShelfIsVisible 503 | 504 | SourceDescription 505 | file at '/Volumes/Backup/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec' 506 | StatusbarIsVisible 507 | 508 | TimeStamp 509 | 0.0 510 | ToolbarConfigUserDefaultsMinorVersion 511 | 2 512 | ToolbarDisplayMode 513 | 1 514 | ToolbarIsVisible 515 | 516 | ToolbarSizeMode 517 | 1 518 | Type 519 | Perspectives 520 | UpdateMessage 521 | The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? 522 | WindowJustification 523 | 5 524 | WindowOrderList 525 | 526 | /Users/jedda/Desktop/check_osx_mem/check_osx_mem.xcodeproj 527 | 528 | WindowString 529 | -9 95 1531 897 0 0 1280 1002 530 | WindowToolsV3 531 | 532 | 533 | FirstTimeWindowDisplayed 534 | 535 | Identifier 536 | windowTool.build 537 | IsVertical 538 | 539 | Layout 540 | 541 | 542 | Dock 543 | 544 | 545 | ContentConfiguration 546 | 547 | PBXProjectModuleGUID 548 | 1CD0528F0623707200166675 549 | PBXProjectModuleLabel 550 | 551 | StatusBarVisibility 552 | 553 | 554 | GeometryConfiguration 555 | 556 | Frame 557 | {{0, 0}, {500, 218}} 558 | RubberWindowFrame 559 | 587 501 500 500 0 0 1920 1178 560 | 561 | Module 562 | PBXNavigatorGroup 563 | Proportion 564 | 218pt 565 | 566 | 567 | ContentConfiguration 568 | 569 | PBXProjectModuleGUID 570 | XCMainBuildResultsModuleGUID 571 | PBXProjectModuleLabel 572 | Build 573 | XCBuildResultsTrigger_Collapse 574 | 1021 575 | XCBuildResultsTrigger_Open 576 | 1011 577 | 578 | GeometryConfiguration 579 | 580 | Frame 581 | {{0, 223}, {500, 236}} 582 | RubberWindowFrame 583 | 587 501 500 500 0 0 1920 1178 584 | 585 | Module 586 | PBXBuildResultsModule 587 | Proportion 588 | 236pt 589 | 590 | 591 | Proportion 592 | 459pt 593 | 594 | 595 | Name 596 | Build Results 597 | ServiceClasses 598 | 599 | PBXBuildResultsModule 600 | 601 | StatusbarIsVisible 602 | 603 | TableOfContents 604 | 605 | 04B5E463138616A200A80C15 606 | 04190668138631E5007FB1D0 607 | 1CD0528F0623707200166675 608 | XCMainBuildResultsModuleGUID 609 | 610 | ToolbarConfiguration 611 | xcode.toolbar.config.buildV3 612 | WindowContentMinSize 613 | 486 300 614 | WindowString 615 | 587 501 500 500 0 0 1920 1178 616 | WindowToolGUID 617 | 04B5E463138616A200A80C15 618 | WindowToolIsVisible 619 | 620 | 621 | 622 | FirstTimeWindowDisplayed 623 | 624 | Identifier 625 | windowTool.debugger 626 | IsVertical 627 | 628 | Layout 629 | 630 | 631 | Dock 632 | 633 | 634 | ContentConfiguration 635 | 636 | Debugger 637 | 638 | HorizontalSplitView 639 | 640 | _collapsingFrameDimension 641 | 0.0 642 | _indexOfCollapsedView 643 | 0 644 | _percentageOfCollapsedView 645 | 0.0 646 | isCollapsed 647 | yes 648 | sizes 649 | 650 | {{0, 0}, {316, 201}} 651 | {{316, 0}, {378, 201}} 652 | 653 | 654 | VerticalSplitView 655 | 656 | _collapsingFrameDimension 657 | 0.0 658 | _indexOfCollapsedView 659 | 0 660 | _percentageOfCollapsedView 661 | 0.0 662 | isCollapsed 663 | yes 664 | sizes 665 | 666 | {{0, 0}, {694, 201}} 667 | {{0, 201}, {694, 180}} 668 | 669 | 670 | 671 | LauncherConfigVersion 672 | 8 673 | PBXProjectModuleGUID 674 | 1C162984064C10D400B95A72 675 | PBXProjectModuleLabel 676 | Debug - GLUTExamples (Underwater) 677 | 678 | GeometryConfiguration 679 | 680 | DebugConsoleVisible 681 | None 682 | DebugConsoleWindowFrame 683 | {{200, 200}, {500, 300}} 684 | DebugSTDIOWindowFrame 685 | {{200, 200}, {500, 300}} 686 | Frame 687 | {{0, 0}, {694, 381}} 688 | PBXDebugSessionStackFrameViewKey 689 | 690 | DebugVariablesTableConfiguration 691 | 692 | Name 693 | 120 694 | Value 695 | 85 696 | Summary 697 | 148 698 | 699 | Frame 700 | {{316, 0}, {378, 201}} 701 | RubberWindowFrame 702 | 755 733 694 422 0 0 1920 1178 703 | 704 | RubberWindowFrame 705 | 755 733 694 422 0 0 1920 1178 706 | 707 | Module 708 | PBXDebugSessionModule 709 | Proportion 710 | 381pt 711 | 712 | 713 | Proportion 714 | 381pt 715 | 716 | 717 | Name 718 | Debugger 719 | ServiceClasses 720 | 721 | PBXDebugSessionModule 722 | 723 | StatusbarIsVisible 724 | 725 | TableOfContents 726 | 727 | 1CD10A99069EF8BA00B06720 728 | 0419063713862DEA007FB1D0 729 | 1C162984064C10D400B95A72 730 | 0419063813862DEA007FB1D0 731 | 0419063913862DEA007FB1D0 732 | 0419063A13862DEA007FB1D0 733 | 0419063B13862DEA007FB1D0 734 | 0419063C13862DEA007FB1D0 735 | 736 | ToolbarConfiguration 737 | xcode.toolbar.config.debugV3 738 | WindowString 739 | 755 733 694 422 0 0 1920 1178 740 | WindowToolGUID 741 | 1CD10A99069EF8BA00B06720 742 | WindowToolIsVisible 743 | 744 | 745 | 746 | Identifier 747 | windowTool.find 748 | Layout 749 | 750 | 751 | Dock 752 | 753 | 754 | Dock 755 | 756 | 757 | ContentConfiguration 758 | 759 | PBXProjectModuleGUID 760 | 1CDD528C0622207200134675 761 | PBXProjectModuleLabel 762 | <No Editor> 763 | PBXSplitModuleInNavigatorKey 764 | 765 | Split0 766 | 767 | PBXProjectModuleGUID 768 | 1CD0528D0623707200166675 769 | 770 | SplitCount 771 | 1 772 | 773 | StatusBarVisibility 774 | 1 775 | 776 | GeometryConfiguration 777 | 778 | Frame 779 | {{0, 0}, {781, 167}} 780 | RubberWindowFrame 781 | 62 385 781 470 0 0 1440 878 782 | 783 | Module 784 | PBXNavigatorGroup 785 | Proportion 786 | 781pt 787 | 788 | 789 | Proportion 790 | 50% 791 | 792 | 793 | BecomeActive 794 | 1 795 | ContentConfiguration 796 | 797 | PBXProjectModuleGUID 798 | 1CD0528E0623707200166675 799 | PBXProjectModuleLabel 800 | Project Find 801 | 802 | GeometryConfiguration 803 | 804 | Frame 805 | {{8, 0}, {773, 254}} 806 | RubberWindowFrame 807 | 62 385 781 470 0 0 1440 878 808 | 809 | Module 810 | PBXProjectFindModule 811 | Proportion 812 | 50% 813 | 814 | 815 | Proportion 816 | 428pt 817 | 818 | 819 | Name 820 | Project Find 821 | ServiceClasses 822 | 823 | PBXProjectFindModule 824 | 825 | StatusbarIsVisible 826 | 1 827 | TableOfContents 828 | 829 | 1C530D57069F1CE1000CFCEE 830 | 1C530D58069F1CE1000CFCEE 831 | 1C530D59069F1CE1000CFCEE 832 | 1CDD528C0622207200134675 833 | 1C530D5A069F1CE1000CFCEE 834 | 1CE0B1FE06471DED0097A5F4 835 | 1CD0528E0623707200166675 836 | 837 | WindowString 838 | 62 385 781 470 0 0 1440 878 839 | WindowToolGUID 840 | 1C530D57069F1CE1000CFCEE 841 | WindowToolIsVisible 842 | 0 843 | 844 | 845 | Identifier 846 | MENUSEPARATOR 847 | 848 | 849 | FirstTimeWindowDisplayed 850 | 851 | Identifier 852 | windowTool.debuggerConsole 853 | IsVertical 854 | 855 | Layout 856 | 857 | 858 | Dock 859 | 860 | 861 | BecomeActive 862 | 863 | ContentConfiguration 864 | 865 | PBXProjectModuleGUID 866 | 1C78EAAC065D492600B07095 867 | PBXProjectModuleLabel 868 | Debugger Console 869 | 870 | GeometryConfiguration 871 | 872 | Frame 873 | {{0, 0}, {758, 514}} 874 | RubberWindowFrame 875 | 873 585 758 555 0 0 1920 1178 876 | 877 | Module 878 | PBXDebugCLIModule 879 | Proportion 880 | 514pt 881 | 882 | 883 | Proportion 884 | 514pt 885 | 886 | 887 | Name 888 | Debugger Console 889 | ServiceClasses 890 | 891 | PBXDebugCLIModule 892 | 893 | StatusbarIsVisible 894 | 895 | TableOfContents 896 | 897 | 1C78EAAD065D492600B07095 898 | 041905BC13861CA3007FB1D0 899 | 1C78EAAC065D492600B07095 900 | 901 | ToolbarConfiguration 902 | xcode.toolbar.config.consoleV3 903 | WindowString 904 | 873 585 758 555 0 0 1920 1178 905 | WindowToolGUID 906 | 1C78EAAD065D492600B07095 907 | WindowToolIsVisible 908 | 909 | 910 | 911 | Identifier 912 | windowTool.snapshots 913 | Layout 914 | 915 | 916 | Dock 917 | 918 | 919 | Module 920 | XCSnapshotModule 921 | Proportion 922 | 100% 923 | 924 | 925 | Proportion 926 | 100% 927 | 928 | 929 | Name 930 | Snapshots 931 | ServiceClasses 932 | 933 | XCSnapshotModule 934 | 935 | StatusbarIsVisible 936 | Yes 937 | ToolbarConfiguration 938 | xcode.toolbar.config.snapshots 939 | WindowString 940 | 315 824 300 550 0 0 1440 878 941 | WindowToolIsVisible 942 | Yes 943 | 944 | 945 | Identifier 946 | windowTool.scm 947 | Layout 948 | 949 | 950 | Dock 951 | 952 | 953 | ContentConfiguration 954 | 955 | PBXProjectModuleGUID 956 | 1C78EAB2065D492600B07095 957 | PBXProjectModuleLabel 958 | <No Editor> 959 | PBXSplitModuleInNavigatorKey 960 | 961 | Split0 962 | 963 | PBXProjectModuleGUID 964 | 1C78EAB3065D492600B07095 965 | 966 | SplitCount 967 | 1 968 | 969 | StatusBarVisibility 970 | 1 971 | 972 | GeometryConfiguration 973 | 974 | Frame 975 | {{0, 0}, {452, 0}} 976 | RubberWindowFrame 977 | 743 379 452 308 0 0 1280 1002 978 | 979 | Module 980 | PBXNavigatorGroup 981 | Proportion 982 | 0pt 983 | 984 | 985 | BecomeActive 986 | 1 987 | ContentConfiguration 988 | 989 | PBXProjectModuleGUID 990 | 1CD052920623707200166675 991 | PBXProjectModuleLabel 992 | SCM 993 | 994 | GeometryConfiguration 995 | 996 | ConsoleFrame 997 | {{0, 259}, {452, 0}} 998 | Frame 999 | {{0, 7}, {452, 259}} 1000 | RubberWindowFrame 1001 | 743 379 452 308 0 0 1280 1002 1002 | TableConfiguration 1003 | 1004 | Status 1005 | 30 1006 | FileName 1007 | 199 1008 | Path 1009 | 197.0950012207031 1010 | 1011 | TableFrame 1012 | {{0, 0}, {452, 250}} 1013 | 1014 | Module 1015 | PBXCVSModule 1016 | Proportion 1017 | 262pt 1018 | 1019 | 1020 | Proportion 1021 | 266pt 1022 | 1023 | 1024 | Name 1025 | SCM 1026 | ServiceClasses 1027 | 1028 | PBXCVSModule 1029 | 1030 | StatusbarIsVisible 1031 | 1 1032 | TableOfContents 1033 | 1034 | 1C78EAB4065D492600B07095 1035 | 1C78EAB5065D492600B07095 1036 | 1C78EAB2065D492600B07095 1037 | 1CD052920623707200166675 1038 | 1039 | ToolbarConfiguration 1040 | xcode.toolbar.config.scm 1041 | WindowString 1042 | 743 379 452 308 0 0 1280 1002 1043 | 1044 | 1045 | FirstTimeWindowDisplayed 1046 | 1047 | Identifier 1048 | windowTool.breakpoints 1049 | IsVertical 1050 | 1051 | Layout 1052 | 1053 | 1054 | Dock 1055 | 1056 | 1057 | ContentConfiguration 1058 | 1059 | PBXBottomSmartGroupGIDs 1060 | 1061 | 1C77FABC04509CD000000102 1062 | 1063 | PBXProjectModuleGUID 1064 | 1CE0B1FE06471DED0097A5F4 1065 | PBXProjectModuleLabel 1066 | Files 1067 | PBXProjectStructureProvided 1068 | no 1069 | PBXSmartGroupTreeModuleColumnData 1070 | 1071 | PBXSmartGroupTreeModuleColumnWidthsKey 1072 | 1073 | 168 1074 | 1075 | PBXSmartGroupTreeModuleColumnsKey_v4 1076 | 1077 | MainColumn 1078 | 1079 | 1080 | PBXSmartGroupTreeModuleOutlineStateKey_v7 1081 | 1082 | PBXSmartGroupTreeModuleOutlineStateExpansionKey 1083 | 1084 | 1C77FABC04509CD000000102 1085 | 1086 | PBXSmartGroupTreeModuleOutlineStateSelectionKey 1087 | 1088 | 1089 | 0 1090 | 1091 | 1092 | PBXSmartGroupTreeModuleOutlineStateVisibleRectKey 1093 | {{0, 0}, {168, 350}} 1094 | 1095 | PBXTopSmartGroupGIDs 1096 | 1097 | XCIncludePerspectivesSwitch 1098 | 1099 | 1100 | GeometryConfiguration 1101 | 1102 | Frame 1103 | {{0, 0}, {185, 368}} 1104 | GroupTreeTableConfiguration 1105 | 1106 | MainColumn 1107 | 168 1108 | 1109 | RubberWindowFrame 1110 | 30 734 744 409 0 0 1920 1178 1111 | 1112 | Module 1113 | PBXSmartGroupTreeModule 1114 | Proportion 1115 | 185pt 1116 | 1117 | 1118 | BecomeActive 1119 | 1120 | ContentConfiguration 1121 | 1122 | PBXProjectModuleGUID 1123 | 1CA1AED706398EBD00589147 1124 | PBXProjectModuleLabel 1125 | Detail 1126 | 1127 | GeometryConfiguration 1128 | 1129 | Frame 1130 | {{190, 0}, {554, 368}} 1131 | RubberWindowFrame 1132 | 30 734 744 409 0 0 1920 1178 1133 | 1134 | Module 1135 | XCDetailModule 1136 | Proportion 1137 | 554pt 1138 | 1139 | 1140 | Proportion 1141 | 368pt 1142 | 1143 | 1144 | MajorVersion 1145 | 3 1146 | MinorVersion 1147 | 0 1148 | Name 1149 | Breakpoints 1150 | ServiceClasses 1151 | 1152 | PBXSmartGroupTreeModule 1153 | XCDetailModule 1154 | 1155 | StatusbarIsVisible 1156 | 1157 | TableOfContents 1158 | 1159 | 0419063D13862DEA007FB1D0 1160 | 0419063E13862DEA007FB1D0 1161 | 1CE0B1FE06471DED0097A5F4 1162 | 1CA1AED706398EBD00589147 1163 | 1164 | ToolbarConfiguration 1165 | xcode.toolbar.config.breakpointsV3 1166 | WindowString 1167 | 30 734 744 409 0 0 1920 1178 1168 | WindowToolGUID 1169 | 0419063D13862DEA007FB1D0 1170 | WindowToolIsVisible 1171 | 1172 | 1173 | 1174 | Identifier 1175 | windowTool.debugAnimator 1176 | Layout 1177 | 1178 | 1179 | Dock 1180 | 1181 | 1182 | Module 1183 | PBXNavigatorGroup 1184 | Proportion 1185 | 100% 1186 | 1187 | 1188 | Proportion 1189 | 100% 1190 | 1191 | 1192 | Name 1193 | Debug Visualizer 1194 | ServiceClasses 1195 | 1196 | PBXNavigatorGroup 1197 | 1198 | StatusbarIsVisible 1199 | 1 1200 | ToolbarConfiguration 1201 | xcode.toolbar.config.debugAnimatorV3 1202 | WindowString 1203 | 100 100 700 500 0 0 1280 1002 1204 | 1205 | 1206 | Identifier 1207 | windowTool.bookmarks 1208 | Layout 1209 | 1210 | 1211 | Dock 1212 | 1213 | 1214 | Module 1215 | PBXBookmarksModule 1216 | Proportion 1217 | 100% 1218 | 1219 | 1220 | Proportion 1221 | 100% 1222 | 1223 | 1224 | Name 1225 | Bookmarks 1226 | ServiceClasses 1227 | 1228 | PBXBookmarksModule 1229 | 1230 | StatusbarIsVisible 1231 | 0 1232 | WindowString 1233 | 538 42 401 187 0 0 1280 1002 1234 | 1235 | 1236 | Identifier 1237 | windowTool.projectFormatConflicts 1238 | Layout 1239 | 1240 | 1241 | Dock 1242 | 1243 | 1244 | Module 1245 | XCProjectFormatConflictsModule 1246 | Proportion 1247 | 100% 1248 | 1249 | 1250 | Proportion 1251 | 100% 1252 | 1253 | 1254 | Name 1255 | Project Format Conflicts 1256 | ServiceClasses 1257 | 1258 | XCProjectFormatConflictsModule 1259 | 1260 | StatusbarIsVisible 1261 | 0 1262 | WindowContentMinSize 1263 | 450 300 1264 | WindowString 1265 | 50 850 472 307 0 0 1440 877 1266 | 1267 | 1268 | Identifier 1269 | windowTool.classBrowser 1270 | Layout 1271 | 1272 | 1273 | Dock 1274 | 1275 | 1276 | BecomeActive 1277 | 1 1278 | ContentConfiguration 1279 | 1280 | OptionsSetName 1281 | Hierarchy, all classes 1282 | PBXProjectModuleGUID 1283 | 1CA6456E063B45B4001379D8 1284 | PBXProjectModuleLabel 1285 | Class Browser - NSObject 1286 | 1287 | GeometryConfiguration 1288 | 1289 | ClassesFrame 1290 | {{0, 0}, {374, 96}} 1291 | ClassesTreeTableConfiguration 1292 | 1293 | PBXClassNameColumnIdentifier 1294 | 208 1295 | PBXClassBookColumnIdentifier 1296 | 22 1297 | 1298 | Frame 1299 | {{0, 0}, {630, 331}} 1300 | MembersFrame 1301 | {{0, 105}, {374, 395}} 1302 | MembersTreeTableConfiguration 1303 | 1304 | PBXMemberTypeIconColumnIdentifier 1305 | 22 1306 | PBXMemberNameColumnIdentifier 1307 | 216 1308 | PBXMemberTypeColumnIdentifier 1309 | 97 1310 | PBXMemberBookColumnIdentifier 1311 | 22 1312 | 1313 | PBXModuleWindowStatusBarHidden2 1314 | 1 1315 | RubberWindowFrame 1316 | 385 179 630 352 0 0 1440 878 1317 | 1318 | Module 1319 | PBXClassBrowserModule 1320 | Proportion 1321 | 332pt 1322 | 1323 | 1324 | Proportion 1325 | 332pt 1326 | 1327 | 1328 | Name 1329 | Class Browser 1330 | ServiceClasses 1331 | 1332 | PBXClassBrowserModule 1333 | 1334 | StatusbarIsVisible 1335 | 0 1336 | TableOfContents 1337 | 1338 | 1C0AD2AF069F1E9B00FABCE6 1339 | 1C0AD2B0069F1E9B00FABCE6 1340 | 1CA6456E063B45B4001379D8 1341 | 1342 | ToolbarConfiguration 1343 | xcode.toolbar.config.classbrowser 1344 | WindowString 1345 | 385 179 630 352 0 0 1440 878 1346 | WindowToolGUID 1347 | 1C0AD2AF069F1E9B00FABCE6 1348 | WindowToolIsVisible 1349 | 0 1350 | 1351 | 1352 | Identifier 1353 | windowTool.refactoring 1354 | IncludeInToolsMenu 1355 | 0 1356 | Layout 1357 | 1358 | 1359 | Dock 1360 | 1361 | 1362 | BecomeActive 1363 | 1 1364 | GeometryConfiguration 1365 | 1366 | Frame 1367 | {0, 0}, {500, 335} 1368 | RubberWindowFrame 1369 | {0, 0}, {500, 335} 1370 | 1371 | Module 1372 | XCRefactoringModule 1373 | Proportion 1374 | 100% 1375 | 1376 | 1377 | Proportion 1378 | 100% 1379 | 1380 | 1381 | Name 1382 | Refactoring 1383 | ServiceClasses 1384 | 1385 | XCRefactoringModule 1386 | 1387 | WindowString 1388 | 200 200 500 356 0 0 1920 1200 1389 | 1390 | 1391 | 1392 | 1393 | --------------------------------------------------------------------------------