Sys::S...ckStats(3pm)

πŸ“¦
version 0.66 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Sys::Statistics::Linux::SockStats β€” the perl(3pm) page, bestie edition πŸ’–

okay so this is Sys::Statistics::Linux::SockStats, straight outta the User Contributed Perl Documentation corner of your man pages. It's a lil module that goes and peeks at your Linux sockets. Yes, those sockets. The vibe? Immaculate. The data? Delicious. Let's go. ✨


🌸 NAME 🌸

Sys::Statistics::Linux::SockStats</purl> β€” literally just here to collect linux socket statistics. That's the whole job. She's focused. She's booked. She's collecting socket stats. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

use Sys::Statistics::Linux::SockStats;

my $lxs  = Sys::Statistics::Linux::SockStats->new;
my $stat = $lxs->get;

That's it. That's the whole ritual. Two lines and you're in. πŸŽ€


🌈 DESCRIPTION 🌈

So Sys::Statistics::Linux::SockStats gathers socket statistics from the virtual /proc filesystem (aka procfs). It's giving "I know what your kernel is up to." πŸ‘‘

And if you want the full lore β€” the extended cinematic universe β€” go read the docs for the front-end module Sys::Statistics::Linux. This module is like the side character that ate, fr fr.


⭐ SOCKET STATISTICS ⭐

These lil beauties are generated by /proc/net/sockstat. Not me being obsessed with a text file in /proc β€” it's just that good.

  • used β€” total number of used sockets. The whole headcount. πŸ‘―
  • tcp β€” number of tcp sockets in use.
  • udp β€” number of udp sockets in use.
  • raw β€” number of raw sockets in use. Spicy. πŸ”₯
  • ipfrag β€” number of ip fragments in use (only available by kernels > 2.2). heads up bestie: this one only shows up if your kernel is newer than 2.2, so if it ghosts you, that's why. πŸ™ˆ

πŸ’œ METHODS πŸ’œ

πŸ’– new()

Call new() to create a new object. Fresh start, new me, new SockStats. ✨

my $lxs = Sys::Statistics::Linux::SockStats->new;

And guess what β€” it's possible to set the path to the proc filesystem. Customize her. Make her yours. 🫢

Sys::Statistics::Linux::SockStats->new(
   files => {
       # This is the default
       path => '/proc',
       sockstat => 'net/sockstat',
   }
);
note the # This is the default comment right there in the code β€” /proc and net/sockstat are the defaults, so if you don't pass anything, that's what you get. no cap.

πŸŽ€ get()

Call get() to get the statistics. And get() returns the statistics as a hash reference. A whole hashref of socket tea. β˜•

my $stat = $lxs->get;

🧚 EXPORTS 🧚

No exports.</purl>

Literally none. She keeps it to herself. Boundaries! Iconic behavior. πŸ’…


🌟 SEE ALSO 🌟

Go read it, bestie. iykyk. πŸ“–


😭 REPORTING BUGS 😭

Please report all bugs to <jschulz.cpan(at)bloonix.de>.

Not some bugs. All of them. Don't be shy, don't be mysterious β€” just email. πŸ’Œ


πŸ‘‘ AUTHOR πŸ‘‘

Jonny Schulz <jschulz.cpan(at)bloonix.de>.

The mastermind. The main character. We stan. 🫢


Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

So like… slay, go forth, remix responsibly. πŸ’–


and that's the page, bestie!! πŸŽ€βœ¨ This whole thing came to you courtesy of perl v5.36.0 and it was last dated 2022-11-19, signed off at the bottom of the original as Sys::S...ckStats(3pm) (she got truncated, it happens to the best of us 😭). mwah, go collect some socket stats πŸ’…πŸ’–πŸ¦‹

πŸ“¦ where this page comes from