GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Parse::Netstat(3) User Contributed Perl Documentation Parse::Netstat(3)

Parse::Netstat - Parse the output of "netstat" command

This document describes version 0.14 of Parse::Netstat (from Perl distribution Parse-Netstat), released on 2017-02-10.

 use Parse::Netstat qw(parse_netstat);
 my $res = parse_netstat(output => join("", `netstat -anp`), flavor=>'linux');

Usage:

 parse_netstat(%args) -> [status, msg, result, meta]

Parse the output of "netstat" command.

This program support several flavors of netstat. The default flavor is "linux". Use "--flavor" to select which flavor you want.

Since different flavors provide different fields and same-named fields might contain data in different format, and also not all kinds of possible output from a single flavor are supported, please see the sample parse output for each flavor (in corresponding "Parse::Netstat::*" per-flavor module) you want to use and adjust accordingly.

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

  • flavor => str (default: "linux")

    Flavor of netstat.

  • output* => str

    Output of netstat command.

    This function only parses program's output. You need to invoke "netstat" on your own.

  • tcp => bool (default: 1)

    Parse TCP connections.

  • udp => bool (default: 1)

    Parse UDP connections.

  • unix => bool (default: 1)

    Parse Unix socket connections.

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

Please visit the project's homepage at <https://metacpan.org/release/Parse-Netstat>.

Source repository is at <https://github.com/perlancar/perl-Parse-Netstat>.

Please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Parse-Netstat>

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

Parse::Netstat::* for per-flavor notes and sample outputs.

parse-netstat from App::ParseNetstat is a CLI for this module.

perlancar <perlancar@cpan.org>

This software is copyright (c) 2017, 2015, 2014, 2012, 2011 by perlancar@cpan.org.

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

2017-02-10 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.