[Nagiosplug-devel] check_procs (pst3), Solaris 10 and Zones
Masopust, Christian
christian.masopust at siemens.com
Thu Apr 15 09:28:02 CEST 2010
Hello Thomas,
ok, here it is in "diff -u" format. I think the patch can be applied without
braking anything else as it will only change things when manually define
"SOLARIS10" in Makefile (or config.h or....)
christian
root# diff -u pst3.c pst3.c-orig
--- pst3.c Wed Mar 31 14:27:50 2010
+++ pst3.c-orig Wed Mar 31 14:17:49 2010
@@ -51,9 +51,6 @@
#include <procfs.h>
#include <errno.h>
#include <sys/types32.h>
-#ifdef SOLARIS10
-#include <zone.h>
-#endif
/*
* Constants
@@ -82,9 +79,6 @@
char ps_name[ARGS];
char as_name[ARGS];
psinfo_t psinfo;
-#ifdef SOLARIS10
- zoneid_t my_zoneid;
-#endif
/* Set our program name global */
if ((szProg = strrchr(argv[0], '/')) != NULL)
@@ -105,14 +99,6 @@
exit(1);
}
-#ifdef SOLARIS10
- /* get my zone-id */
- if ((my_zoneid = getzoneid()) == -1) {
- fprintf(stderr, "%s: cannot read my zone-id\n");
- exit(1);
- }
-#endif
-
if ((procdir = opendir(PROC_DIR)) == NULL) {
fprintf(stderr, "%s: cannot open PROC directory %s\n", szProg, PROC_DIR);
exit(1);
@@ -169,13 +155,6 @@
}
close(ps_fd);
-#ifdef SOLARIS10
- /* process not running in my zone? */
- if (my_zoneid != psinfo.pr_zoneid) {
- continue;
- }
-#endif
-
/* system process, ignore since the previous version did */
if(
psinfo.pr_nlwp == 0 ||
--
"I sense much NT in you, NT leads to Blue Screen.
Blue Screen leads to downtime, downtime leads to suffering. NT is the path to the darkside."
- Unknown Unix Jedi
> -----Original Message-----
> From: Thomas Guyot-Sionnest [mailto:dermoth at aei.ca]
> Sent: Tuesday, April 13, 2010 6:34 AM
> To: Nagios Plugin Development Mailing List
> Cc: Masopust, Christian
> Subject: Re: [Nagiosplug-devel] check_procs (pst3), Solaris
> 10 and Zones
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 31/03/10 08:34 AM, Masopust, Christian wrote:
> > Hi all,
> >
> > as I had the problem that my check_procs in my Solaris 10
> global-zone
> > always also
> > counts all processes from other zones, I modified pst3.c
> the following way
> > (diff is against pst3.c from nagios-plugins 1.4.14):
> >
> > diff -w pst3.c-orig pst3.c
> > 53a54,56
> >> #ifdef SOLARIS10
> >> #include <zone.h>
> >> #endif
> > 81a85,87
> >> #ifdef SOLARIS10
> >> zoneid_t my_zoneid;
> >> #endif
> > 101a108,115
> >> #ifdef SOLARIS10
> >> /* get my zone-id */
> >> if ((my_zoneid = getzoneid()) == -1) {
> >> fprintf(stderr, "%s: cannot read my zone-id\n");
> >> exit(1);
> >> }
> >> #endif
> >>
> > 157a172,178
> >> #ifdef SOLARIS10
> >> /* process not running in my zone? */
> >> if (my_zoneid != psinfo.pr_zoneid) {
> >> continue;
> >> }
> >> #endif
> >>
> > this will cause pst3 to output only processes from the zone
> it is running.
> > (Makefile has to be modified too to define "SOLARIS10" in CFLAGS)
> >
> > maybe that's useful for some others too :-)))
>
> Thanks for the patch. Could you please re-send it in the unified diff
> format (diff -u)?
>
> I may apply it but likely as an option to check_procs, as
> making it the
> default could badly break existing checks.
>
> - --
> Thomas
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFLw/Q/6dZ+Kt5BchYRAszKAJ9Xzf1uWk0b8aAq4NIYJycECwcH7ACgh/kd
> kZ2UagDh0FV0tLS8S1y4xJc=
> =uChm
> -----END PGP SIGNATURE-----
>
More information about the Devel
mailing list