Purpose ======= As a System Administrator, people somehow expect you to know everything about every computer in your organisation - down to how much L2 cache it has, and "Are there any free slots to put more RAM in?" And you should have a list of these available on hand at all times. This plugin is designed to let you do just that. How to Use this Plugin ====================== This is not a conventional plugin, in that it always returns OK. It also returns a one-line summary about the computer hardware. including: * System info * Make and Model of the motherboard * Serial number (useful for Dell/HP servers) * CPU Info * Number of CPUs installed * CPU clock speed (1st CPU only) * CPU Level-2 cache size ( " ) * CPU Front-Side-Bus speed ( " ) * Memory info * Total memory installed * Is it ECC memory * Number of free memory slots * Size of the installed memory modules * Disks * Size of the disks * Is raid being used * Which OS is installed (Windows version/Linux version) * Kernel version (running and latest installed rpm) * A select range ports and virtual IP's the server is listening on * The Dell DRAC IP or HP ILO IP The plugin is called via NRPE or NRPE_NT, and can produce csv-compatible output (useful for compiling spreadsheets of existing hardware) Usage: check_hwinfo.pl [-t csv|str] -t csv ... output one-line in csv format (quoted strings, comma-separated) -t str ... use str as separator This command must be run as the root user (dmidecode and netstat require it). ---- ---- Sample output (Regular output): [Dell Computer Corporation:PowerEdge 2850:ABCDE1S][2:Xeon:3600 MHz:2048 KB:800 MHz][4096 M:Multi-bit ECC:2048M/2048M/0/0/0/0][sda=683.1 G:MegaRAID,LD 0 RAID5 699G,521X][Red Hat Enterprise Linux Server release 5.5 (Tikanga):x86_64:2.6.18-194.11.4.el5:httpd/80/443 php mysql/3306][DRAC=192.168.12.34] [ASUSTeK Computer Inc.:P4P800:To Be Filled By O.E.M.][1:Pentium 4:2600 MHz:512 kB:200 MHz][1024 M:Non-ECC:512M/0/512M/0][sda=931.5 G / sdb=465.8 G:Linux SW RAID][CentOS release 5.6 (Final):i686:2.6.18-238.5.1.el5:httpd/80/443 php jdk samba/139/445 vsftpd squid/8080/3128 nfs dovecot/993/143 named/53@192.168.12.34/953@1 postfix/25 python][not available] Sample output (csv): "ASUSTeK Computer Inc.","P4P800","To Be Filled By O.E.M.","1","Pentium 4","2600 MHz","512 kB","200 MHz","1024 M","Non-ECC","512M/0/512M/0","sda=931.5 G / sdb=465.8 G","Linux SW RAID","CentOS release 5.6 (Final)","i686","2.6.18-238.5.1.el5","httpd/80/443 php jdk samba/139/445 vsftpd squid/8080/3128 nfs dovecot/993/143 named/53@192.168.12.34/953@1 postfix/25 python","not available" This plugin has not been tested on all Linux distributions. It does work on Red Hat ES, Mandriva, and Fedora. Client Installation (computer being monitored) ============================================== NRPE: Add to nrpe.cfg command[check_hwinfo]=/usr/bin/sudo /usr/lib/nagios/plugins/check_hwinfo.pl command[check_hwinfo_csv]=/usr/bin/sudo /usr/lib/nagios/plugins/check_hwinfo.pl -t csv Add to /etc/sudoers Defaults:nagios !requiretty nagios ALL=NOPASSWD: /usr/lib/nagios/plugins/check_hwinfo.pl "", /usr/lib/nagios/plugins/check_hwinfo.pl -t csv NRPE_NT: Add to nrpe.cfg command[check_hwinfo]=c:\windows\system32\cscript.exe //NoLogo //T:10 "C:Program Files\nrpe_nt.0.8b\bin\check_hwinfo.wsf" command[check_hwinfo_csv]=c:\windows\system32\cscript.exe //NoLogo //T:10 "C:\Program Files\nrpe_nt.0.8b\bin\check_hwinfo.wsf" /sep:csv On Windows NT, this script requires the script-o-matic software "wmicore_nt4.EXE" from Microsoft, and IE6 SP1 This is not necessary for Windows 2000 and Windows 2003 and later. On Vista and Windows Server 2008, you will also need to run the command: MSHTA.EXE C:\\ScriptomaticV2.HTA, Nagios Server Configuration =========================== Note: I'm assuming that your Nagios server is not exposed to the Internet. If it is, this plugin may disclose an uncomfortable amount of detail about your computers to unsavory people. Copy to the plugins directory (eg. /usr/lib/nagios/plugins/ ) the file: check_nrpe_hwinfo.sh Create the directory /var/www/html/hwinfo/ mkdir -p /var/www/html/hwinfo/ chown nagios /var/www/html/hwinfo/ Add the following to your nagios configuration: ########################################################## define command{ command_name check_hwinfo command_line $USER1$/check_nrpe_hwinfo.sh $HOSTNAME$ $HOSTADDRESS$ } define service { use generic-service hostgroup_name hosts_with_nrpe service_description HW Info notification_options none normal_check_interval 240 notification_interval 240 retry_check_interval 2 max_check_attempts 120 check_command check_hwinfo } define hostgroup { hostgroup_name hosts_with_nrpe alias hosts_with_nrpe } ########################################################## You will also need to add each host which has the plugin to the hostgroup hosts_with_nrpe. The best way to do this is to use the hostgroup directive in the host definition, eg. define host { use generic-host host_name example.local alias example ...more host directives here... hostgroups hosts_with_nrpe ...more host directives here... } 'generic-host' and 'generic-service' are host and service templates, respectively. Add the file hwinfo.php to your PHP-enabled web-server directory (eg. /var/www/html/ ) Done. Now, as each computer is 'checked' using the check_nrpe_hwinfo.sh script, a one-line file will be created with that hostname in the directory /var/www/html/hwinfo/ Each such file is only overwritten when the plugin returns OK, so it remains persistant, even if some hosts are down. This is very useful if you need to look up the remote access IP address (DRAC or ILO) of a server which is down at the time. The PHP script 'hwinfo.php' is used to display this information in a neat table. The table can be sorted on any column. If the PHP script encounters a file which has not been updated in the last 24 hours, this table entry is show 'greyed out'. This make it easy to identify 'stale' host-files. hwinfo.php takes 2 possible arguments: * hwinfo.php?csv ... output in CSV format * hwinfo.php?dell ...output all Dell hosts and service tags as a CSV suitable for populating 'My Systems and Perihperals' on the Dell support site. This plugin is not comprehensive. Additions are welcome (eg a Solaris or HPUX version, anyone?). The Windows version needs to be updated to bring it in-line with the Linux version. If someone asks me for the Windows version to be updated, I'll try to hasten development of this.