AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.15.221.67
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /etc/munin/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /etc/munin/plugins/fw_forwarded_local
#!/usr/bin/perl -w

=head1 NAME

fw_forwarded_local - Plugin to monitor network connections.

=head1 CONFIGURATION

This plugin must run with root privileges

=head2 CONFIGURATION EXAMPLE

/etc/munin/plugin-conf.d/global or other file in that dir must contain:

 [fw_*]
  user root

=head1 NOTES

=over

=item * forward: number of connections forwarded

=item * local: number of connections for the host itself

=back

=head1 AUTHORS

2011.09.23: Perl version by Alex Tomlins

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=cut

use strict;
use Munin::Plugin;

my $conntrack = '/usr/sbin/conntrack';
my $nf_conntrack_file = '/proc/net/nf_conntrack';
my $ip_conntrack_file = '/proc/net/ip_conntrack';

if ( defined($ARGV[0]) and $ARGV[0] eq "autoconf" ) {
    if ( -x $conntrack or -r $nf_conntrack_file or -r $ip_conntrack_file) {
        print "yes\n";
    } else {
        print "no (command $conntrack or file $nf_conntrack_file or file $ip_conntrack_file not found)\n";
    }
    exit 0;
}

if ( defined($ARGV[0]) and $ARGV[0] eq "config" ) {
    print "graph_title ipconntrack\n";
    print "graph_args -l 0 --base 1000\n";
    print "graph_vlabel established connections\n";
    print "graph_category network\n";
    print "forward.label forward\n";
    print "forward.type GAUGE\n";
    print "local.label local\n";
    print "local.type GAUGE\n";
    exit 0;
}

my $command;
if ( -x $conntrack) {
    $command = "$conntrack -L -o extended 2>/dev/null";
} elsif ( -r $nf_conntrack_file ) {
    $command = "cat $nf_conntrack_file";
} elsif (-r $ip_conntrack_file ) {
    $command = "cat $ip_conntrack_file";
} else {
    die "Can't find conntrack information\n";
}

my $local = 0;
my $forward = 0;
open CMD, "$command|";
while (<CMD>) {
    if (/ESTABLISHED\s+src=(\S+)\s+dst=(\S+)\s+sport.*src=(\S+)\s+dst=(\S+)/) {
        if ($1 eq $4) {
            $local++;
        } else {
            $forward++;
        }
    }
}
close CMD;

print "forward.value $forward\n";
print "local.value $local\n"

Anon7 - 2022
AnonSec Team