Projet

Général

Profil

Révision 1acb0665

ID1acb0665e8b90c485f4781382aa5371d9fdef480
Parent c04775f8
Enfant e1bc7ad6

Ajouté par Alejandro Suarez il y a plus de 5 ans

Added suggestion made by @sumpfralle

Voir les différences:

plugins/router/snmp__mikrotik_flash
2 2
#
3 3
# Copyright (C) 2019 Alejandro Suarez (teconecta.es)
4 4
#
5
# Munin plugin to monitor Mikrotik routers RAM utilization.
5
# Munin plugin to monitor Mikrotik routers Falsh disk utilization.
6 6
# Based on snmp__if_  plugin.
7 7
#
8 8
# This program is free software; you can redistribute it and/or
......
55 55
    die "# Error: couldn't understand what I'm supposed to monitor.";
56 56
}
57 57

  
58
my $sysRAMUsage     = "1.3.6.1.2.1.25.2.3.1.6.131072";
59
my $sysRAMTotal     = "1.3.6.1.2.1.25.2.3.1.5.131072";
58
my $sysFalshUsage     = "1.3.6.1.2.1.25.2.3.1.6.131072";
59
my $sysFalshTotal     = "1.3.6.1.2.1.25.2.3.1.5.131072";
60 60

  
61 61
my ($session, $error) = Net::SNMP->session(
62 62
                -hostname  => $host,
......
74 74
if ($ARGV[0] and $ARGV[0] eq "config")
75 75
{
76 76
    print "host_name $host\n";
77
    if (!defined ($response = $session->get_request($sysRAMTotal)))
77
    if (!defined ($response = $session->get_request($sysFalshTotal)))
78 78
    {
79 79
        die "Croaking: " . $session->error();
80 80
    }
81
#    print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
82
    print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysRAMTotal} * 1024) . "\n";
81
    print "graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit " . ($response->{$sysFalshTotal} * 1024) . "\n";
83 82
    print "graph_title Flash disk usage\n";
84 83
    print "graph_category system\n";
85 84
    print "graph_info This graph shows the router's flash disk usage.\n";
86 85
    print "graph_order Total Used\n";
87 86
    print "graph_vlabel bytes\n";
88
    print "sysRAMTotal.label Total Memory\n";
89
    print "sysRAMTotal.draw AREA\n";
90
    print "sysRAMUsage.label Used Memory\n";
91
    print "sysRAMUsage.draw AREA\n";
87
    print "sysFalshTotal.label Total Memory\n";
88
    print "sysFalshTotal.draw AREA\n";
89
    print "sysFalshUsage.label Used Memory\n";
90
    print "sysFalshUsage.draw AREA\n";
92 91
    exit 0;
93 92
}
94 93

  
95 94

  
96
if (defined ($response = $session->get_request(-varbindlist => [$sysRAMUsage, $sysRAMTotal])))
95
if (defined ($response = $session->get_request(-varbindlist => [$sysFalshUsage, $sysFalshTotal])))
97 96
{
98
        print "sysRAMUsage.value ", $response->{$sysRAMUsage}*1024, "\n";
99
        print "sysRAMTotal.value ", $response->{$sysRAMTotal}*1024, "\n";
97
        print "sysFalshUsage.value ", $response->{$sysFalshUsage}*1024, "\n";
98
        print "sysFalshTotal.value ", $response->{$sysFalshTotal}*1024, "\n";
100 99
}
101 100
else
102 101
{
103
        print "sysRAMUsage.value U\n";
102
        print "sysFalshUsage.value U\n";
103
        print "sysFalshTotal.value U\n";
104 104
}
105 105

  
106 106
# vim:syntax=perl

Formats disponibles : Unified diff