From: ivan Date: Thu, 21 Aug 2008 23:22:04 +0000 (+0000) Subject: add the client-side reporting for MCP mode X-Git-Tag: root_of_webpay_support~425 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=c1297541457bdfce910e7013cd6dc24254347852 add the client-side reporting for MCP mode --- diff --git a/FS/FS/Yori.pm b/FS/FS/Yori.pm new file mode 100644 index 000000000..01f36b1c0 --- /dev/null +++ b/FS/FS/Yori.pm @@ -0,0 +1,65 @@ +package FS::Yori; +# a reporting program, to report information to the MCP + +use strict; +use base 'Exporter'; + +our @EXPORT_OK = qw( reports report ); + +sub reports { #should be autogenerated i guess + qw( freeside_version debian_version pg_version + apache_version apache_mpm + ); + #ssh_vulnkey +} + +sub report { + my $report = shift; + $report =~ /^(\w+)$/ or die; + eval "report_$report();"; +} + +sub report_all { + foreach my $report ( reports() ) { + print "$report: ". report($report). "\n"; + } +} + +sub report_freeside_version { + chomp( my $fs_version = + `grep '^VERSION=' /home/ivan/freeside/Makefile | cut -d= -f2` + ); + $fs_version; +} + +sub report_debian_version { + chomp( my $deb_version = `cat /etc/debian_version` ); + $deb_version; +} + +sub report_pg_version { + chomp( my $pg_version = `echo 'show server_version' | psql -t freeside` ); + chomp($pg_version); #two? + $pg_version =~ s/^ +//; + $pg_version; +} + +sub report_apache_version { + chomp( my $apache_version = + `/usr/sbin/apache2 -v | head -1 | cut -d: -f2 | cut -d/ -f2 | cut -d' ' -f1` + ); + $apache_version; +} + +sub report_apache_mpm { + chomp( my $apache_mpm = + `/usr/sbin/apache2 -V | grep '^Server MPM' | cut -d: -f2` + ); + $apache_mpm =~ s/^ +//; + $apache_mpm; +} + +#sub report_ssh_vulnkey{ +# my $ssh_vulnkey = `ssh-vulnkey -a | grep COMPROMISED`; +# $ssh_vulnkey; +#} diff --git a/FS/MANIFEST b/FS/MANIFEST index aa07d01ce..d83bf1daa 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -417,3 +417,4 @@ FS/pkg_category.pm t/pkg_category.t FS/phone_avail.pm t/phone_avail.t +FS/Yori.pm diff --git a/FS/bin/freeside-yori b/FS/bin/freeside-yori new file mode 100644 index 000000000..d1137995d --- /dev/null +++ b/FS/bin/freeside-yori @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use FS::Yori qw(reports report); + +if ( @ARGV ) { + while ( my $report = shift ) { + print report($report). "\n"; + } +} else { + print join("\n", reports() ). "\n"; +} + + +1;