71 lines
1.5 KiB
Perl
Executable File
71 lines
1.5 KiB
Perl
Executable File
#!/usr/bin/perl -w
|
|
|
|
use strict;
|
|
use Cwd qw(realpath);
|
|
|
|
my $dirname;
|
|
BEGIN
|
|
{
|
|
# We use BEGIN here to calculate the dynamic path BEFORE parsing the "use lib" directive
|
|
my $real = realpath $0 || $0;
|
|
($dirname = $real) =~ s/\/[^\/]*$//;
|
|
}
|
|
# Add our custom path
|
|
use lib "$dirname";
|
|
|
|
use MyRRD;
|
|
|
|
my $rrd = '/var/lib/rrd';
|
|
my $img = '/home/www/maison.xwing.info/rrd';
|
|
|
|
my $MyRRD = new MyRRD($rrd, $img);
|
|
|
|
# system
|
|
$MyRRD->cpu();
|
|
$MyRRD->memory(16384, 8192);
|
|
$MyRRD->load();
|
|
$MyRRD->cswitch();
|
|
$MyRRD->iostat('sda');
|
|
|
|
# temps
|
|
$MyRRD->sensorstemp({
|
|
'coretemp-isa-0000' => {
|
|
'Package id 0' => {
|
|
key => 'temp1_input',
|
|
name => "CPU",
|
|
},
|
|
},
|
|
'drivetemp-scsi-0-0' => {
|
|
'temp1' => {
|
|
key => 'temp1_input',
|
|
name => "HDD",
|
|
},
|
|
},
|
|
'pch_cometlake-virtual-0' => {
|
|
'temp1' => {
|
|
key => 'temp1_input',
|
|
name => "PCH",
|
|
},
|
|
},
|
|
});
|
|
$MyRRD->sensorsfan({
|
|
'nct6798-isa-0290' => {
|
|
'fan2' => {
|
|
key => 'fan2_input',
|
|
name => "CPU",
|
|
},
|
|
'fan4' => {
|
|
key => 'fan4_input',
|
|
name => "Boîtier",
|
|
},
|
|
},
|
|
});
|
|
|
|
# serveurs
|
|
$MyRRD->nginx('http://127.0.0.1:80/server-status');
|
|
|
|
# network
|
|
$MyRRD->networkInterface('eth0', 'Interface locale');
|
|
$MyRRD->networkInterface('virbr0', 'Guest');
|
|
|