===== Solaris examples =====
Note: All of these examples are written for a Solaris box. They can vary on your box, and you may have to adopt the command / evaluation expression. \\
If you want to run them e.g. on a Linux server you have to do some research on your own ;-)\\
But that's one of the main goals of this example collection: it should awoke your interest to create your own commands.
===== Hardware related =====
=== prtdiag ===
Comment: I know that there are some prtdiag checks on [[http://nagiosexchange.org|nagiosexchange.org]]. But the output of prtdiag varies for each new hardware release and it becomes like the race between the rabbit and the hedgehog.\\
Therefore I created this neat small check which solely parses some magic words in the output of ''prtdiag -v''. This can be extended easily and works fine for me.
check_generic --ignore_rc -n prtdiag -e "/usr/platform/`uname -i`/sbin/prtdiag -v" -c "=~/error|failed|failure|fault|faulty/i"
=== CPU offline ===
Simple approach to check if all CPUs are really online. This is the classical warning check to monitor redundant ressources.
check_generic -n system_cpu_offline -e "echo \"CPU:`/usr/sbin/psrinfo|wc -l` offline:`/usr/sbin/psrinfo|grep -v on-line|wc -l`\"" -w '!~/offline: 0/'
=== Autoboot setting ===
If you want to be sure that your system really boots next time you should monitor the settings of the ''autoboot'' variable in NVRAM.\\ Note: eeprom can be executed by root only and needs sudo support
check_generic -n system_eeprom_autoboot -e "/usr/bin/sudo /usr/sbin/eeprom | grep "auto-boot\?" | awk -F= '{print \$2}'" -w 'ne "true"'
=== Boot device ===
This setting is meant to ensure the proper setting of redundant boot devices. Solstice Disk Suite does not help really much if the system only boots from disk0.\\ Note: eeprom can be executed by root only and needs sudo support
check_generic -n system_eeprom_boot_device -e "/usr/bin/sudo /usr/sbin/eeprom | grep "boot-device" | awk -F= '{print \$2}'" -w '!~/disk0.*disk1/'
=== Diag settings ===
There are multiple settings which can be monitored for the SUN diag settings. The goal is to ensure that the debug settings are as minimal as possible to achieve the minimal boot time. Sysadmins often tend to forget to restore these settings after debug sessions ;-)
== Diag switch ==
Note: eeprom can be executed by root only and needs sudo support
check_generic -n system_eeprom_diagswitch -e "/usr/bin/sudo /usr/sbin/eeprom | grep "diag-switch\?" | awk -F= '{print \$2}'" -w 'ne "false"'
== Diag level ==
Note: eeprom can be executed by root only and needs sudo support
check_generic -n system_eeprom_diaglevel -e "/usr/bin/sudo /usr/sbin/eeprom | grep "diag-level" | awk -F= '{print \$2}'" -w 'ne "min"'
=== Local MAC address ===
For the proper function of IPMP the NVRAM variable ''local-mac-address'' has to be true.\\ Note: eeprom can be executed by root only and needs sudo support
check_generic -n system_eeprom_local_mac_address -e "/usr/bin/sudo /usr/sbin/eeprom | grep "local-mac-address\?" | awk -F= '{print \$2}'" -w 'ne "true"'