[ZBXNEXT-1855] Support of setproctitle on Linux, Windows, HP-UX and Darwin OSs Created: 2013 Jun 27 Updated: 2013 Oct 28 Resolved: 2013 Oct 28 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Agent (G), Proxy (P), Server (S) |
Affects Version/s: | 2.1.0 |
Fix Version/s: | 2.1.8 |
Type: | Change Request | Priority: | Minor |
Reporter: | Alexey Pustovalov | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 5 |
Labels: | patch, usability | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() ![]() ![]() ![]() |
||||||||
Issue Links: |
|
Description |
Currently we support setproctitle only on FreeBSD OS. Would be great to support the feature on all systems. Information about setproctitle on Linux OSs: http://stupefydeveloper.blogspot.com/2008/10/linux-change-process-name.html The feature can help to determine process type and current state of processes without any additional tools (strace, log files and etc). |
Comments |
Comment by Alexey Pustovalov [ 2013 Jun 27 ] |
Please find attached setproctitle.c and patch for 2.0.7rc1. |
Comment by richlv [ 2013 Jun 27 ] |
see |
Comment by Alexey Pustovalov [ 2013 Jul 01 ] |
(1) pinger uses progname variable which modified by the patch. So all items related with PING are not processed correctly. igorsh FIXED in r38008 andris CLOSED |
Comment by Igors Homjakovs (Inactive) [ 2013 Aug 19 ] |
I have also tested new setproctitle on Solaris (patch had the implementation for Solaris), but it doesn't work well. What i experienced is that the main process had the new title set, but other processes remained with the default name. The ps documentation says: args: The command with all its arguments as a string. The implementation may truncate this value to the field width; it is implementation-dependent whether any further truncation occurs. It is unspecified whether the string represented is a version of the argument list as it was passed to the command when it started, or is a version of the arguments as they may have been modified by the application. Applications cannot depend on being able to modify their argument list and having that modification be reflected in the output of ps. The Solaris implementation limits the string to 80 bytes; the string is the version of the argument list as it was passed to the command when it started. |
Comment by Igors Homjakovs (Inactive) [ 2013 Aug 20 ] |
According to: http://www.scalingbits.com/content/solaris-11-changes-where-bsd-style-ps-command there are two types of ps command on Solaris: BSD-type (e.g. ps aux) and regular type (e.g. ps -ef). It also appears that (http://unix.stackexchange.com/questions/3934/how-can-i-get-a-full-process-list-in-solaris-without-truncated-lines) the kernel is not required to keep track of command line arguments. When a process is started through the execve call, the kernel must copy the arguments into the process memory. After that, the kernel can discard the memory used to store the initial command line arguments. The process is allowed to overwrite its copy of the arguments. So there may simply be no trace of the arguments. This happens in the the case of regular type ps command. For BSD-type ps command situation is different and it looks into the process to see the args as it sees them. So in this case we can set our process title as it is done in, for example, Linux. PostgreSQL documentaion says to use /usr/ucb/ps with -ww options to get process names instead of regular /usr/bin/ps, however most of the information are hidden by /usr/ucb/ps option as well. Additionally, the original name of the process must have a shorter process name than that provided by the application. If you fail to do all three things, the ps output for each server process will be the original command line (http://www.postgresql.org/docs/9.1/static/monitoring-ps.html). |
Comment by Igors Homjakovs (Inactive) [ 2013 Aug 23 ] |
Setproctitle will not be added to Windows platform since Task Manager displays only the main process. |
Comment by Igors Homjakovs (Inactive) [ 2013 Aug 23 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1855 |
Comment by Alexander Vladishev [ 2013 Sep 19 ] |
Related issue: |
Comment by Andris Mednis [ 2013 Sep 30 ] |
Development is being done in svn://svn.zabbix.com/branches/dev/ZBXNEXT-1855-2. |
Comment by Andris Mednis [ 2013 Oct 04 ] |
Support of setproctitle() is available in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1855-2, starting from rev. 38973. |
Comment by Andris Mednis [ 2013 Oct 08 ] |
Available in the development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1855-2. Also contains a solution for |
Comment by Andris Mednis [ 2013 Oct 08 ] |
(1) icmp pinger process always shows 0 values: wiper CLOSED |
Comment by Andris Mednis [ 2013 Oct 08 ] |
(2) icmp pinger process number is not displayed during status "pinging hosts": wiper CLOSED |
Comment by Andris Mednis [ 2013 Oct 09 ] |
Added VMware collector support in svn://svn.zabbix.com/branches/dev/ZBXNEXT-1855-2 rev. 39154. |
Comment by Andris Zeila [ 2013 Oct 10 ] |
(3) Some processes can write processing statistics to their titles, then sleep for 0 seconds and immediately overwrite statistics with messages like "[processing <something>]". In situations like this it would be better to accumulate the statistics and update title only every N seconds or when entering a sleep (N - the default sleep time of the specific process). Some processes are more susceptible to the above scenario than others - for example it's a common occurrence with unreachable pollers. The affected main loops:
andris RESOLVED in r39394. wiper reviewed, please check minor changes proposed in r39403, r39414
andris It was decided to leave main_pinger_loop() unchanged for now. It can be reorganized if requested. andris RESOLVED in r39422. wiper CLOSED |
Comment by Andris Zeila [ 2013 Oct 21 ] |
Successfully tested |
Comment by Andris Mednis [ 2013 Oct 21 ] |
Fixed in version pre-2.1.8 r39449. |
Comment by Andris Mednis [ 2013 Oct 22 ] |
Documentation at martins-v Reviewed, with slight changes to the "what's new" part: https://www.zabbix.com/documentation/2.2/manual/introduction/whatsnew220#dynamic_display_of_current_process_activity_and_statistics andris Thanks! Agree. |
Comment by richlv [ 2013 Oct 22 ] |
there are two (1)s, one of them has not been closed. let's clean this up |