prometheus / node_exporter

Exporter for machine metrics
https://prometheus.io/
Apache License 2.0
11.14k stars 2.35k forks source link

Add System V semaphores and shared memory metrics #754

Open sathieu opened 6 years ago

sathieu commented 6 years ago

What did you expect to see?

Same metrics as:

# ipcs -u

------ Messages Status --------
allocated queues = 0
used headers = 0
used space = 0 bytes

------ Shared Memory Status --------
segments allocated 1117
pages allocated 1535
pages resident  1535
pages swapped   0
Swap performance: 0 attempts     0 successes

------ Semaphore Status --------
used arrays = 1006
allocated semaphores = 1006

i. e. semctl(IPC_INFO, ...):

       IPC_INFO (Linux-specific)
                 Return information about system-wide semaphore limits and parameters in the structure pointed to by arg.__buf.  This structure  is  of  type  seminfo,  defined  in
                 <sys/sem.h> if the _GNU_SOURCE feature test macro is defined:

                     struct  seminfo {
                         int semmap;  /* Number of entries in semaphore
                                         map; unused within kernel */
                         int semmni;  /* Maximum number of semaphore sets */
                         int semmns;  /* Maximum number of semaphores in all
                                         semaphore sets */
                         int semmnu;  /* System-wide maximum number of undo
                                         structures; unused within kernel */
                         int semmsl;  /* Maximum number of semaphores in a
                                         set */
                         int semopm;  /* Maximum number of operations for
                                         semop(2) */
                         int semume;  /* Maximum number of undo entries per
                                         process; unused within kernel */
                         int semusz;  /* Size of struct sem_undo */
                         int semvmx;  /* Maximum semaphore value */
                         int semaem;  /* Max. value that can be recorded for
                                         semaphore adjustment (SEM_UNDO) */
                     };

                 The semmsl, semmns, semopm, and semmni settings can be changed via /proc/sys/kernel/sem; see proc(5) for details.

We need this because Apache is consuming a lot of semaphores on some servers.

What did you see instead?

nothing

SuperQ commented 6 years ago

Great idea, I did a quick check but it looks like semctl() isn't implemented by Go syscal_linux(etc).

mdlayher commented 6 years ago

Should be easy enough to add to x/sys/unix.

gtaylor commented 6 years ago

We're looking to get some of the message queue IPC stats. Would that be covered as part of this issue, or should I create a new issue that is specifically for message queue stats?

discordianfish commented 6 years ago

@gtaylor Doesn't look like this issue here has much traction, so whatever works best for you. IPC Queue stats seem useful! Preferably the actual logic should go into the procfs lib (or even x/sys/unix, not sure about the scope though)

adiithyan commented 4 years ago

I am fairly new to Grafana-Prometheus and exporters. Is this enhancement available yet? I too stumbled upon the same requirement today and could not find semaphores and shared memory stats being exported.

discordianfish commented 4 years ago

Afaik, nothing has changed since my last comment. So to get there:

  1. Add the syscall to x/sys/unix
  2. Add the parsing for procfs
  3. Add the collector here
focabr commented 2 years ago

Hi,

Would there be somewhere else to get "ipcs -u" inside node_exporter?