~ubuntu-branches/ubuntu/lucid/monit/lucid

« back to all changes in this revision

Viewing changes to process/sysdep_SOLARIS.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Alfredsson
  • Date: 2009-08-18 22:49:13 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090818224913-6z5wghd0qfiuy7fh
Tags: 1:5.0.3-3
* Daemon poll interval moved to rc-file instead of defaults
  (Closes: #541425)
* Package upgraded (Closes: 453248)
* Configuration snippets are included from /etc/monit/conf.d/*
  (Closes: #296479)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C), 2000-2007 by the monit project group.
3
 
 * All Rights Reserved.
 
2
 * Copyright (C) 2009 Tildeslash Ltd. All rights reserved.
4
3
 *
5
4
 * This program is free software: you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation, either version 3 of the License, or
8
 
 * (at your option) any later version.
 
5
 * it under the terms of the GNU General Public License version 3.
9
6
 *
10
7
 * This program is distributed in the hope that it will be useful,
11
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
11
 *
15
12
 * You should have received a copy of the GNU General Public License
16
13
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
14
 *
 
15
 * In addition, as a special exception, the copyright holders give
 
16
 * permission to link the code of portions of this program with the
 
17
 * OpenSSL library under certain conditions as described in each
 
18
 * individual source file, and distribute linked combinations
 
19
 * including the two.
 
20
 *
 
21
 * You must obey the GNU General Public License in all respects
 
22
 * for all of the code used other than OpenSSL.  If you modify
 
23
 * file(s) with this exception, you may extend this exception to your
 
24
 * version of the file(s), but you are not obligated to do so.  If you
 
25
 * do not wish to do so, delete this exception statement from your
 
26
 * version.  If you delete this exception statement from all source
 
27
 * files in the program, then also delete it here.
17
28
 */
18
29
 
19
30
 
89
100
 *  @author Jan-Henrik Haukeland, <hauk@tildeslash.com>
90
101
 *  @author Christian Hopp <chopp@iei.tu-clausthal.de>
91
102
 *
92
 
 *  @version \$Id: sysdep_SOLARIS.c,v 1.21 2007/07/25 12:54:32 hauk Exp $
 
103
 *  @version \$Id: sysdep_SOLARIS.c,v 1.29 2009/05/01 16:10:11 martinp Exp $
93
104
 *
94
105
 *  @file
95
106
 */
111
122
 
112
123
  register int pagesize;
113
124
 
114
 
  num_cpus= sysconf( _SC_NPROCESSORS_ONLN);
 
125
  systeminfo.cpus= sysconf( _SC_NPROCESSORS_ONLN);
115
126
 
116
127
  pagesize = sysconf(_SC_PAGESIZE);
117
128
  pageshift = 0;
185
196
    if (!read_proc_file(buf,4096, "psinfo", pt[i].pid)) {
186
197
      
187
198
      pt[i].cputime = 0;
 
199
      pt[i].cpu_percent = 0;
188
200
      pt[i].mem_kbyte= 0;
189
201
      continue;
190
202
 
203
215
      /* and does it anyway matter? */
204
216
      
205
217
      pt[i].cputime = 0;
 
218
      pt[i].cpu_percent = 0;
206
219
      pt[i].mem_kbyte= 0;
207
220
      continue;
208
221
      
213
226
    if (!read_proc_file(buf,4096, "status", pt[i].pid)) {
214
227
      
215
228
      pt[i].cputime=0;
 
229
      pt[i].cpu_percent = 0;
216
230
      
217
231
    } else {
218
232
      
219
233
      pt[i].cputime= ( timestruc_to_tseconds(pstatus->pr_utime) +
220
234
                       timestruc_to_tseconds(pstatus->pr_stime) );
 
235
      pt[i].cpu_percent = 0;
221
236
    }
222
237
    
223
238
  }
357
372
    total += ( cpu_stat[i].cpu_sysinfo.cpu[0]+
358
373
               cpu_stat[i].cpu_sysinfo.cpu[1]+
359
374
               cpu_stat[i].cpu_sysinfo.cpu[2]+
360
 
               cpu_stat[i].cpu_sysinfo.cpu[3]+
361
 
               cpu_stat[i].cpu_sysinfo.cpu[4] );
 
375
               cpu_stat[i].cpu_sysinfo.cpu[3]);
362
376
    
363
377
  }
364
378
 
365
379
  if ( old_total == 0.0 ) {
366
380
 
367
 
    si->total_cpu_user_percent=0;
368
 
    si->total_cpu_syst_percent=0;
369
 
    si->total_cpu_wait_percent=0;
 
381
    si->total_cpu_user_percent=-10;
 
382
    si->total_cpu_syst_percent=-10;
 
383
    si->total_cpu_wait_percent=-10;
370
384
    
371
385
  } else {
372
386