[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Showing pid and ppid

From: Santiago Dobon
Subject: Showing pid and ppid
Date: Fri, 22 Apr 2005 13:33:44 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5


I have recently installed and configured monit on a Sparc-Solaris 8 machine. Monit checks some process correctly, but does not show the pid nor the ppid of those process. Does the pid file need to be written on any special format?

I have modified the file validate.c to include the line "s->inf->pid= pid" and it works OK, now showing the pid.

I still have not found out what to do for the ppid. Any idea?

Compiling the same brandnew 4.5.1 version on a PC-Linux I get the correct pid and other information such as the CPU and memory usage. What could I do to achieve this information on the Sparc-Solaris 8 machine?

Here is my check_process function:

* Validate a given process service s. Events are posted according to
* its configuration. In case of a fatal event FALSE is returned.
int check_process(Service_T s) {

pid_t  pid= -1;
Port_T pp= NULL;
Resource_T pr= NULL;


/* Test for running process */
if(!(pid= Util_isProcessRunning(s))) {
/* Reset the service info object to prevent false data in the first run */
  Event_post(s, EVENT_NONEXIST, TRUE, s->action_NONEXIST,
    "'%s' process is not running", s->name);
  return FALSE;
} else {
  Event_post(s, EVENT_NONEXIST, FALSE, s->action_NONEXIST,
    "'%s' process is running with pid %d", s->name, (int)pid);
  s->inf->pid= pid;

Thanks. Santiago.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]