HCCServerinfo A Custom API for Cpanel Version 0.1.2 beta 11/MAY/2005 © 2003, 2005 Juan R. Pozo http://html.conclase.net/cp/scripts/ mailto:jrpozo@conclase.net Mailing list: http://www.conclase.net/mailman/listinfo/cpanel_conclase.net License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Note: a copy of the GNU General Public License is available at: http://html.conclase.net/cp/scripts/license.html Installation 1) Check if the file HCCServerinfo.pm exists in your server inside the /usr/local/cpanel/Cpanel/ directory 2) If it exists and isn't a previous version of this API please contact me. Otherwise, follow steps 3 to 8 3) switch to root user 4) # cd /usr/local/cpanel/Cpanel/ 5) # wget –N http://html.conclase.net/cp/scripts/HCCServerinfo.pm 6) # chown root.root HCCServerinfo.pm 7) # chmod 0644 HCCServerinfo.pm 8) Add the following language variables to your language files: // HCCServerinfo (English) HCCServerinfo_StatusOK=OK HCCServerinfo_StatusWarning=Warning HCCServerinfo_StatusAlert=Alert HCCServerinfo_ServiceUp=Up HCCServerinfo_ServiceDown=Down HCCServerinfo_ServiceUpIcon=/green-status.gif HCCServerinfo_ServiceDownIcon=/red-status.gif HCCServerinfo_MemoryUsed=Memory Used HCCServerinfo_MemoryIconOK=/green-status.gif HCCServerinfo_MemoryIconWarning=/yellow-status.gif HCCServerinfo_MemoryIconAlert=/red-status.gif HCCServerinfo_SwapUsed=Swap HCCServerinfo_SwapIconOK=/green-status.gif HCCServerinfo_SwapIconWarning=/yellow-status.gif HCCServerinfo_SwapIconAlert=/red-status.gif HCCServerinfo_ServerLoad=Server Load HCCServerinfo_LoadIconOK=/green-status.gif HCCServerinfo_LoadIconWarning=/yellow-status.gif HCCServerinfo_LoadIconAlert=/red-status.gif HCCServerinfo_Partition=Partition HCCServerinfo_PartitionIconOK=/green-status.gif HCCServerinfo_PartitionIconWarning=/yellow-status.gif HCCServerinfo_PartitionIconAlert=/red-status.gif // HCCServerinfo (Spanish) HCCServerinfo_StatusOK=Normal HCCServerinfo_StatusWarning=Advertencia HCCServerinfo_StatusAlert=Alerta HCCServerinfo_ServiceUp=Activo HCCServerinfo_ServiceDown=No Activo HCCServerinfo_ServiceUpIcon=/green-status.gif HCCServerinfo_ServiceDownIcon=/red-status.gif HCCServerinfo_MemoryUsed=Memoria Usada HCCServerinfo_MemoryIconOK=/green-status.gif HCCServerinfo_MemoryIconWarning=/yellow-status.gif HCCServerinfo_MemoryIconAlert=/red-status.gif HCCServerinfo_SwapUsed=Swap HCCServerinfo_SwapIconOK=/green-status.gif HCCServerinfo_SwapIconWarning=/yellow-status.gif HCCServerinfo_SwapIconAlert=/red-status.gif HCCServerinfo_ServerLoad=Carga del Servidor HCCServerinfo_LoadIconOK=/green-status.gif HCCServerinfo_LoadIconWarning=/yellow-status.gif HCCServerinfo_LoadIconAlert=/red-status.gif HCCServerinfo_Partition=Partición HCCServerinfo_PartitionIconOK=/green-status.gif HCCServerinfo_PartitionIconWarning=/yellow-status.gif HCCServerinfo_PartitionIconAlert=/red-status.gif Optionally you may upload and specify your own icons for each category. API Reference Displays the system status variables. Each option corresponds to a group of variables. This call is similar to but allows for better customization. Currently available options are: ? services. These are the services checked by the chkservd daemon. A table row is returned for each monitored service. ? load. The average server load durante the last minute. Information is extracted via cat /proc/loadavg. ? memory. Memory use, expressed in percentage. Requires the /usr/bin/free program to be in the path and to be world executable. ? swap. Swap use, expressed in percentage. Requires the /usr/bin/free program to be in the path and to be world executable. ? partitions. Hard drive partitions and their current utilization expressed in percentage. Requires the /bin/df program to be in the path and to be world executable. A table row is returned for each partition. Options can be specified in any order, and any number of options can be specified. Each table row contains three cells: resource name, a textual representation of its status, and an iconic representation of its status. Texts and icons can be customized via language files. For CSS formatting purposes, the row elements have class name hcc-service- row, and table cells have class names hcc-service-name, hcc-service-status and hcc-service-icon respectively. Example:
Changelog 0.1.2 Beta – May 11, 2005 Fixed lang function to account for Cpanel's cachelang mechanism. 0.1.1 Beta – September 23, 2003 Follow same convention for key values in language files than in the other HCC Api modules, i.e., HCCServerinfo_StatusOK instead of HCCStatusOK, etc. Uses full paths for free and df. Fixed bug by which services which were down were displayed as being up. Fixed bug by which the warning icon for server load did not appear. 0.1 Beta – May 6, 2003 First public release. Please consider making a donation today. Visit my amazon.com wishlist at: http://html.conclase.net/link/wishlist Thank you :)