#!/usr/bin/env perl use warnings; use diagnostics; use lib "../../lib"; use HotSaNICparser; # read global settings # $MODNAME=lc HotSaNICparser::get_module_name(); %CONFIG=HotSaNICparser::get_config("../.."); $IMAGEFORMAT=$CONFIG{"IMAGEFORMAT"}; $REFRESH=$CONFIG{"REFRESH"}; $REFRESH=0 if !defined $REFRESH; # read module-specific settings # # evaluate number of CPUs # opendir DIR,"rrd"; @DBs = grep /^[^.].*/, readdir DIR; closedir DIR; foreach (@DBs) { chomp; s/\.rrd//g; push @db,$_; if (/mem/) { s/mem/swap/g; push @db,$_; } } @db=sort(@db); # build time-based .html files # foreach $index ("hour","week") { open (FILE,">index/$index.html"); print FILE "\n"; if ($REFRESH > 0) { print FILE " \n"; } print FILE "\n\n"; for (@db) { ($link_name = $_) =~ s/_/:/; print FILE "\n \n"; } print FILE "

$link_name

\n\n\n"; close FILE; } $count = 0; for (@db) { $count += 1 if /cpu/; } open (IDXFILE,">idxdata"); if ($count>1) { print IDXFILE "$count\n"; } print IDXFILE "0## ",$MODNAME,"
0## hour 0## week
0##
0## "; @res = grep /proc/, @db; for (@res) { ($link_name = $_) =~ s/_/:/; print IDXFILE " 1## 1## $link_name"; } $num=@res; for ($nn=$num;$nn<$count;$nn++) { print IDXFILE "\n1## ";} @res = grep /cpu/, @db; for (@res) { ($link_name = $_) =~ s/_/:/; print IDXFILE " 2## 2## $link_name"; } $num=@res; for ($nn=$num;$nn<$count;$nn++) { print IDXFILE "\n2## ";} @res = grep /load/, @db; for (@res) { ($link_name = $_) =~ s/_/:/; print IDXFILE " 3## 3## $link_name"; } $num=@res; for ($nn=$num;$nn<$count;$nn++) { print IDXFILE "\n3## ";} @res = grep /mem/, @db; for (@res) { ($link_name = $_) =~ s/_/:/; print IDXFILE " 4## 4## $link_name"; } $num=@res; for ($nn=$num;$nn<$count;$nn++) { print IDXFILE "\n4## ";} @res = grep /swap/, @db; for (@res) { ($link_name = $_) =~ s/_/:/; print IDXFILE " 5## 5## $link_name"; } $num=@res; for ($nn=$num;$nn<$count;$nn++) { print IDXFILE "\n5## ";} @res = grep /users/, @db; for (@res) { ($link_name = $_) =~ s/_/:/; print IDXFILE " 6## 6## $link_name"; } $num=@res; for ($nn=$num;$nn<$count;$nn++) { print IDXFILE "\n6## ";} @res = grep /irq/, @db; for (@res) { print IDXFILE " 7## 7## interrupts"; } $num=@res; for ($nn=$num;$nn<$count;$nn++) { print IDXFILE "\n7## ";} @res = grep /uptime/, @db; for (@res) { print IDXFILE " 8## 8## uptime"; } $num=@res; for ($nn=$num;$nn<$count;$nn++) { print IDXFILE "\n8## ";} close IDXFILE; foreach $index (@db) { print "writing $index\n"; open (FILE,">index/$index.html"); print FILE "\n"; if ($REFRESH > 0) { print FILE " \n"; } print FILE "\n"; if ( index ($index,"uptime") <0 ) { print FILE "\n"; } print FILE "\n"; print FILE "\n"; print FILE "\n"; print FILE "\n\n\n"; close FILE; } WebSVN - hotsanic - Blame - Rev 9 - /trunk/modules/system/makeindex.pl
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [system/] [makeindex.pl] - Blame information for rev 9

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1