ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/ihost-perl/plugins/solaris/solaris.c
(Generate patch)

Comparing projects/cms/source/host/ihost-perl/plugins/solaris/solaris.c (file contents):
Revision 1.1 by pajs, Fri Mar 8 13:24:32 2002 UTC vs.
Revision 1.2 by pajs, Fri Mar 8 14:57:28 2002 UTC

# Line 3 | Line 3
3   #include <sys/statvfs.h>
4   #include <sys/mnttab.h>
5   #include <ukcprog.h>
6 + #include <sys/utsname.h>
7 + #include <sys/loadavg.h>
8  
9   void die()
10   {
# Line 41 | Line 43 | void diskStats()
43          
44          counter++;
45       }
44  
45  
46  
46   }
47  
48 + void osStats()
49 + {
50 +   struct utsname os;
51  
52 +   if((uname(&os)) == -1)
53 +     {
54 +        errf("Failed to get os stats (%m)");
55 +        die();
56 +     }
57 +
58 +   printf("packet.os.name %s\n", os.sysname);
59 +   printf("packet.os.release %s\n" , os.release);
60 +   printf("packet.os.version %s\n", os.version);
61 +   printf("packet.os.sysname %s\n" , os.nodename);
62 +   printf("packet.os.platform %s\n", os.machine);
63 +
64 + }  
65 +  
66 + void loadStats()
67 + {
68 +  double loadav[3];
69 +  
70 +  if((getloadavg(loadav,3)) == -1)
71 +    {
72 +      errf("Failed to get load averages (%m)");
73 +      die();
74 +  
75 +  }
76 +  
77 +  printf("packet.load.load1 %.2f\n",loadav[0]);
78 +  printf("packet.load.load5 %.2f\n",loadav[1]);
79 +  printf("packet.load.load15 %.2f\n",loadav[2]);
80 + }
81 +
82   int main()
83   {
84 <   diskStats();
85 <   return 0;
84 >
85 >  diskStats();
86 >  osStats();
87 >  loadStats();
88 >  return 0;
89   }
90  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines