ajout de tout ce qui est nécessaire pour munin
This commit is contained in:
@@ -1,56 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
###############################################################################
|
|
||||||
#use diagnostics;
|
|
||||||
use Net::SNMP;
|
|
||||||
#use strict;
|
|
||||||
#use warnings;
|
|
||||||
###############################################################################
|
|
||||||
my $Voltage = ".1.3.6.1.4.1.14988.1.1.3.8.0";
|
|
||||||
my $SNMPCommunity = "public";
|
|
||||||
my $SNMPPort = "161";
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
## Determine Hostname
|
|
||||||
my $Host = undef;
|
|
||||||
$0 =~ /mikrotikvoltage_(.+)*$/;
|
|
||||||
unless ($Host = $1) {
|
|
||||||
exit 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
## Initiate SNMP Session
|
|
||||||
my ($Session, $Error) = Net::SNMP->session (-hostname => $Host,
|
|
||||||
-community => $SNMPCommunity,
|
|
||||||
-port => $SNMPPort,
|
|
||||||
-timeout => 10,
|
|
||||||
-retries => 3,
|
|
||||||
-version => 1);
|
|
||||||
if (!defined($Session)) {
|
|
||||||
die "Croaking: $Error";
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
## Configuration
|
|
||||||
if ($ARGV[0] && $ARGV[0] eq "config") {
|
|
||||||
my $Result = $Session->get_request(-varbindlist => [$Voltage]);
|
|
||||||
print "host_name " . $Host . "\n";
|
|
||||||
print "graph_args -l 0 -r --vertical-label volts --lower-limit 10 --upper-limit 30\n";
|
|
||||||
print "graph_title Voltage usage\n";
|
|
||||||
print "graph_category system\n";
|
|
||||||
print "graph_info This graph shows the router's voltage usage.\n";
|
|
||||||
print "graph_order Total\n";
|
|
||||||
print "graph_vlabel volts\n";
|
|
||||||
print "graph_scale no\n";
|
|
||||||
print "Total.label Total Voltage\n";
|
|
||||||
print "Total.draw AREA\n";
|
|
||||||
$Session->close;
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
## Execution
|
|
||||||
if (my $Result = $Session->get_request(-varbindlist => [$Voltage])) {
|
|
||||||
print "Total.value " . ($Result->{$Voltage} / 10) . "\n";
|
|
||||||
$Session->close;
|
|
||||||
exit;
|
|
||||||
}
|
|
@@ -65,24 +65,8 @@
|
|||||||
when: "'pgsqlservers' in group_names"
|
when: "'pgsqlservers' in group_names"
|
||||||
|
|
||||||
# For Munin servers
|
# For Munin servers
|
||||||
- name: deploy mikrotik unitary scripts
|
- name: execute specific tasks for munin servers
|
||||||
copy:
|
include_tasks: mikrotik.yml
|
||||||
src: "./files/{{ item.0 }}"
|
|
||||||
dest: "/etc/munin/plugins/{{ item.0 }}{{ item.1.name }}"
|
|
||||||
mode: 0755
|
|
||||||
loop: "{{ mikrotik_unitary_scripts|product(mikrotik_hosts)|list }}"
|
|
||||||
notify:
|
|
||||||
- restart munin-node
|
|
||||||
when: "'muninservers' in group_names"
|
|
||||||
|
|
||||||
- name: deploy mikrotik per iface scripts
|
|
||||||
copy:
|
|
||||||
src: "./files/{{ item.1 }}"
|
|
||||||
dest: "/etc/munin/plugins/{{ item.1 }}{{ item.0.0.name }}_{{ item.0.1 }}"
|
|
||||||
mode: 0755
|
|
||||||
loop: "{{ mikrotik_hosts|subelements('ifaces')|product(mikrotik_periface_scripts) }}"
|
|
||||||
notify:
|
|
||||||
- restart munin-node
|
|
||||||
when: "'muninservers' in group_names"
|
when: "'muninservers' in group_names"
|
||||||
|
|
||||||
# for NUT (UPS) servers
|
# for NUT (UPS) servers
|
||||||
|
Reference in New Issue
Block a user