![]() |
|
|
Generated: 8 Jan 2009 |
00001 00007 /* 00008 * ApMon - Application Monitoring Tool 00009 * Version: 2.2.0 00010 * 00011 * Copyright (C) 2006 California Institute of Technology 00012 * 00013 * Permission is hereby granted, free of charge, to use, copy and modify 00014 * this software and its documentation (the "Software") for any 00015 * purpose, provided that existing copyright notices are retained in 00016 * all copies and that this notice is included verbatim in any distributions 00017 * or substantial portions of the Software. 00018 * This software is a part of the MonALISA framework (http://monalisa.cacr.caltech.edu). 00019 * Users of the Software are asked to feed back problems, benefits, 00020 * and/or suggestions about the software to the MonALISA Development Team 00021 * (developers@monalisa.cern.ch). Support for this software - fixing of bugs, 00022 * incorporation of new features - is done on a best effort basis. All bug 00023 * fixes and enhancements will be made available under the same terms and 00024 * conditions as the original software, 00025 00026 * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR 00027 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 00028 * OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, 00029 * EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 00031 * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 00032 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 00033 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS 00034 * PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO 00035 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 00036 * MODIFICATIONS. 00037 */ 00038 00039 #include "mon_constants.h" 00040 00041 int initSysParams(char *sysMonitorParams[]) 00042 { 00043 /* percent of the time spent by the CPU in user mode */ 00044 sysMonitorParams[SYS_CPU_USR] = (char *)"cpu_usr"; 00045 /* percent of the time spent by the CPU in system mode */ 00046 sysMonitorParams[SYS_CPU_SYS] = (char *)"cpu_sys"; 00047 /* percent of the CPU idle time */ 00048 sysMonitorParams[SYS_CPU_IDLE] = (char *)"cpu_idle"; 00049 /* percent of the time spent by the CPU in nice mode */ 00050 sysMonitorParams[SYS_CPU_NICE] = (char *)"cpu_nice"; 00051 /* CPU usage percent */ 00052 sysMonitorParams[SYS_CPU_USAGE] = (char *)"cpu_usage"; 00053 /* number of pages paged in (in the last interval) */ 00054 sysMonitorParams[SYS_PAGES_IN] = (char *)"pages_in"; 00055 /* number of pages paged out (in the last interval) */ 00056 sysMonitorParams[SYS_PAGES_OUT] = (char *)"pages_out"; 00057 /* number of swap pages brought in (in the last interval) */; 00058 sysMonitorParams[SYS_SWAP_IN] = (char *)"swap_in"; 00059 /* number of swap pages brought out (in the last interval) */; 00060 sysMonitorParams[SYS_SWAP_OUT] = (char *)"swap_out"; 00061 /* average system load over the last minute */ 00062 sysMonitorParams[SYS_LOAD1] = (char *)"load1"; 00063 /* average system load over the last 5 min */ 00064 sysMonitorParams[SYS_LOAD5] = (char *)"load5"; 00065 /* average system load over the last 15 min */; 00066 sysMonitorParams[SYS_LOAD15] = (char *)"load15"; 00067 /* amount of currently used memory, in MB */ 00068 sysMonitorParams[SYS_MEM_USED] = (char *)"mem_used"; 00069 /* amount of free memory, in MB */ 00070 sysMonitorParams[SYS_MEM_FREE] = (char *)"mem_free"; 00071 /* used system memory in percent */ 00072 sysMonitorParams[SYS_MEM_USAGE] = (char *)"mem_usage"; 00073 /* amount of currently used swap, in MB */ 00074 sysMonitorParams[SYS_SWAP_USED] = (char *)"swap_used"; 00075 /* amount of free swap, in MB */ 00076 sysMonitorParams[SYS_SWAP_FREE] = (char *)"swap_free"; 00077 /* swap usage in percent */ 00078 sysMonitorParams[SYS_SWAP_USAGE] = (char *)"swap_usage"; 00079 /* network (input) transfer in KBps */ 00080 sysMonitorParams[SYS_NET_IN] = (char *)"net_in"; 00081 /* network (output) transfer in KBps */ 00082 sysMonitorParams[SYS_NET_OUT] = (char *)"net_out"; 00083 /* number of network errors */ 00084 sysMonitorParams[SYS_NET_ERRS] = (char *)"net_errs"; 00085 /* number of processes in the system */ 00086 sysMonitorParams[SYS_PROCESSES] = (char *)"processes"; 00087 /* system uptime in days */ 00088 sysMonitorParams[SYS_UPTIME] = (char *)"uptime"; 00089 /* number of sockets */ 00090 sysMonitorParams[SYS_NET_SOCKETS] = (char *)"net_sockets"; 00091 /* number of TCP sockets in different states */ 00092 sysMonitorParams[SYS_NET_TCP_DETAILS] = (char *)"net_tcp_details"; 00093 00094 return 25; 00095 } 00096 00097 int initGenParams(char *genMonitorParams[]) 00098 { 00099 genMonitorParams[GEN_HOSTNAME] = (char *)"hostname"; 00100 genMonitorParams[GEN_IP] = (char *)"ip"; 00101 genMonitorParams[GEN_CPU_MHZ] = (char *)"cpu_MHz"; 00102 genMonitorParams[GEN_NO_CPUS] = (char *)"no_CPUs"; 00103 /* total amount of system memory in MB */ 00104 genMonitorParams[GEN_TOTAL_MEM] = (char *)"total_mem"; 00105 /* total amount of swap in MB */ 00106 genMonitorParams[GEN_TOTAL_SWAP] = (char *)"total_swap"; 00107 genMonitorParams[GEN_CPU_VENDOR_ID] = (char *)"cpu_vendor_id"; 00108 genMonitorParams[GEN_CPU_FAMILY] = (char *)"cpu_family"; 00109 genMonitorParams[GEN_CPU_MODEL] = (char *)"cpu_model"; 00110 genMonitorParams[GEN_CPU_MODEL_NAME] = (char *)"cpu_model_name"; 00111 genMonitorParams[GEN_BOGOMIPS] = (char *)"bogomips"; 00112 00113 return 11; 00114 } 00115 00116 int initJobParams(char *jobMonitorParams[]) 00117 { 00118 00119 /* elapsed time from the start of this job in seconds */ 00120 jobMonitorParams[JOB_RUN_TIME] = (char *)"run_time"; 00121 /* processor time spent running this job in seconds */ 00122 jobMonitorParams[JOB_CPU_TIME] = (char *)"cpu_time"; 00123 /* current percent of the processor used for this job, as reported by ps */ 00124 jobMonitorParams[JOB_CPU_USAGE] = (char *)"cpu_usage"; 00125 /* percent of the memory occupied by the job, as reported by ps */ 00126 jobMonitorParams[JOB_MEM_USAGE] = (char *)"mem_usage"; 00127 /* size in KB of the resident image size of the job, as reported by ps */ 00128 jobMonitorParams[JOB_RSS] = (char *)"rss"; 00129 /* size in KB of the virtual memory occupied by the job, as reported by ps */ 00130 jobMonitorParams[JOB_VIRTUALMEM] = (char *)"virtualmem"; 00131 /* size in MB of the working directory of the job (including the files 00132 referenced by symbolic links) */ 00133 jobMonitorParams[JOB_WORKDIR_SIZE] = (char *)"workdir_size"; 00134 /* size in MB of the disk partition containing the 00135 working directory */ 00136 jobMonitorParams[JOB_DISK_TOTAL] = (char *)"disk_total"; 00137 /* size in MB of the used disk space on the partition containing the working directory */ 00138 jobMonitorParams[JOB_DISK_USED] = (char *)"disk_used"; 00139 /* size in MB of the free disk space on the partition containing the working directory */ 00140 jobMonitorParams[JOB_DISK_FREE] = (char *)"disk_free"; 00141 /* percent of the used disk on the partition containing the working directory */ 00142 jobMonitorParams[JOB_DISK_USAGE] = (char *)"disk_usage"; 00143 00144 /* number of opened file descriptors */ 00145 jobMonitorParams[JOB_OPEN_FILES] = (char *)"open_files"; 00146 return 12; 00147 } 00148 00149 void initSocketStatesMapTCP(char *socketStatesMapTCP[]) 00150 { 00151 socketStatesMapTCP[STATE_ESTABLISHED] = (char *)"ESTABLISHED"; 00152 socketStatesMapTCP[STATE_SYN_SENT] = (char *)"SYN_SENT"; 00153 socketStatesMapTCP[STATE_SYN_RECV] = (char *)"SYN_RECV"; 00154 socketStatesMapTCP[STATE_FIN_WAIT1] = (char *)"FIN_WAIT1"; 00155 socketStatesMapTCP[STATE_FIN_WAIT2] = (char *)"FIN_WAIT2"; 00156 socketStatesMapTCP[STATE_TIME_WAIT] = (char *)"TIME_WAIT"; 00157 socketStatesMapTCP[STATE_CLOSED] = (char *)"CLOSED"; 00158 socketStatesMapTCP[STATE_CLOSE_WAIT] = (char *)"CLOSE_WAIT"; 00159 socketStatesMapTCP[STATE_LAST_ACK] = (char *)"LAST_ACK"; 00160 socketStatesMapTCP[STATE_LISTEN] = (char *)"LISTEN"; 00161 socketStatesMapTCP[STATE_CLOSING] = (char *)"CLOSING"; 00162 socketStatesMapTCP[STATE_UNKNOWN] = (char *)"UNKNOWN"; 00163 00164 }