--- /dev/null
+package System::Introspector::Host;
+use Moo;
+
+sub gather {
+ my ($self) = @_;
+ return {
+ hostname => $self->_gather_hostname,
+ uname => $self->_gather_uname_info,
+ };
+}
+
+my @UnameFields = qw(
+ kernel_name
+ kernel_release
+ kernel_version
+ nodename
+ machine
+ processor
+ hardware_platform
+ operating_system
+);
+
+sub _gather_uname_info {
+ my ($self) = @_;
+ my %uname;
+ for my $field (@UnameFields) {
+ (my $option = $field) =~ s{_}{-}g;
+ my $value = `uname --$option`;
+ chomp $value;
+ $uname{ $field } = $value;
+ }
+ return \%uname;
+}
+
+sub _gather_hostname {
+ my ($self) = @_;
+ open my $fh, '<', '/etc/hostname'
+ or die "Unable to read /etc/hostname: $!\n";
+ my $hostname = <$fh>;
+ chomp $hostname;
+ return $hostname;
+}
+
+1;