This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Thursday, April 19, 2018

Facter command in Linux

Facter command is used to Collect and display facts about the current server. The library behind Facter is easy to expand, making Facter an easy way to collect information about a system information such as hardware details, network settings, virtualization type and kernel/OS information from within the shell or within Ruby. If no facts are specifically asked for, then all facts will be displayed.

If we want to use facter command, we need to install facter rpm.

Display all facts

[root@testserver manifests]# facter
architecture => x86_64
augeasversion => 1.1.0
bios_release_date => 01/06/2018
bios_vendor => Xen
bios_version => 4.4.4OVM
blockdevice_xvda_size => 53687091200
blockdevices => xvda
domain =>
facterversion => 2.4.4
filesystems => ext4,iso9660
fqdn =>
gid => root
hardwareisa => x86_64
uptime_days => 62
uptime_hours => 1491
uptime_seconds => 5368909
uuid => 0004FB00-0006-0000-7071-48CB71E70F8A
virtual => xenhvm

Display a single fact

[root@testserver ~]#  facter interfaces

Facts format as JSON

[root@testserver ~]# facter --json architecture kernel  uptime timezone puppetversion bios_vendor
  "timezone": "CAT",
  "uptime": "62 days",
  "architecture": "x86_64",
  "kernel": "Linux",
  "bios_vendor": "Xen",
  "puppetversion": "3.8.1"

Facts format as YAML

[root@testserver  ~]# facter --yaml architecture kernel  uptime timezone puppetversion bios_vendor
bios_vendor: Xen
kernel: Linux
uptime: 62 days
timezone: CAT
architecture: x86_64
puppetversion: 3.8.1

Facter will produce output by below format.
c. Plaintext

No comments:

Post a Comment