#!/usr/bin/perl

use strict;
use warnings;
use Date::Parse;
use Date::Format;
use PCP::LogImport;


pmiStart("gfs", 0);


pmiAddMetric("gfs.inodes",
	     PM_ID_NULL, PM_TYPE_DOUBLE, PM_INDOM_NULL,
	     PM_SEM_INSTANT, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));

open(INFILE, "<gfs_inodes.csv");
while (<INFILE>) {
  next if $. == 1;
  chomp;
  my @part = split(/,/, $_);

  pmiPutValue("gfs.inodes", "", $part[3]);

  pmiWrite(str2time($part[0] . "T" . $part[1] . ":00"), 0);
}
close(INFILE);


pmiAddMetric("gfs.fmb",
	     PM_ID_NULL, PM_TYPE_DOUBLE, PM_INDOM_NULL,
	     PM_SEM_INSTANT, pmiUnits(0,0,1,0,0,PM_COUNT_ONE));

open(INFILE, "<gfs_metadata.csv");
while (<INFILE>) {
  next if $. == 1;
  chomp;
  my @part = split(/,/, $_);

  pmiPutValue("gfs.fmb", "", $part[3]);

  pmiWrite(str2time($part[0] . "T" . $part[1] . ":00"), 0);
}
close(INFILE);


pmiEnd();
