# SysInfo: a set of scripts that document your system



## danger@ (Apr 8, 2009)

Hello guys,

I am developing a script that automatically documents settings of particular freebsd (currently 7.x) box from the hardware point of view to the network and services related information. 

The point of this script is to provide some descriptive information about unknown system's configuration (hardware and software) for administrator who has no idea about the given system.

I would greatly appreciate if you guys could test it in your environment and provide some feedback. It currently doesn't provide very much information, so I would really also like to hear your opinions on what kind of information would you be interested in in above described situation, which I should document.

The latest version of this script can be found at:
http://people.freebsd.org/~danger/sysinfo/

Thank you.


----------



## DutchDaemon (Apr 8, 2009)

I get an error in the part handled by the 020-mem script.


```
System memory summary
expr: illegal option -- 4
usage: expr [-e] expression
expr: illegal option -- 1
usage: expr [-e] expression
Total real memory available:	2047 MB
Logically used memory:		 MB
Logically available memory:	 MB
```

020-mem run with sh -xv:


```
cat <<EOF
Total real memory available:	$(calc_mb $physmem) MB
Logically used memory:		$(calc_mb $usedmem) MB
Logically available memory:	$(calc_mb $availmem) MB
EOF
+ cat
+ calc_mb 3203567616
+ expr 3203567616 / 1048576
+ echo 2047
+ return
+ calc_mb -465883137
+ expr -465883137 / 1048576
expr: illegal option -- 4
usage: expr [-e] expression
+ echo
+ return
+ calc_mb -1681600512
+ expr -1681600512 / 1048576
expr: illegal option -- 1
usage: expr [-e] expression
+ echo
+ return
Total real memory available:	2047 MB
Logically used memory:		 MB
Logically available memory:	 MB
```

My real mem (dmesg -a) is 3220897792 (3071 MB), btw


----------



## danger@ (Apr 8, 2009)

does http://people.freebsd.org/~rse/dist/freebsd-memory work for you well?


----------



## icer (Apr 8, 2009)

no errors and all true  

```
CPU information

Machine class:	i386
CPU Model:	Intel(R) Pentium(R) Dual  CPU  E2200  @ 2.20GHz
Number of CPUs:	2

RAM information

System memory summary
Total real memory available:	1005 MB
Logically used memory:		481 MB
Logically available memory:	523 MB

Swap information
Device          1K-blocks     Used    Avail Capacity
/dev/ad6s1b       4194304       0B     4.0G     0%

Operating system information

Operating system release:	FreeBSD 7.1-RELEASE-p2
OS architecture:		i386
Hostname:			icer.local
Kernel build dir location:	/usr/obj/usr/src/sys/WiFi
Currently booted kernel:	/boot/kernel/kernel

Currently loaded kernel modules (kldstat):
acpi.ko
linprocfs.ko
linux.ko
Storage information

Available hard drives:
da3: <Generic USB MS Reader 1.03> Removable Direct Access SCSI-0 device 
da3: 1.000MB/s transfers
da3: Attempt to query device size failed: NOT READY, Medium not present
da2: <Generic USB SM Reader 1.02> Removable Direct Access SCSI-0 device 
da2: 1.000MB/s transfers
da2: Attempt to query device size failed: NOT READY, Medium not present
da1: <Generic USB CF Reader 1.01> Removable Direct Access SCSI-0 device 
da1: 1.000MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
da0: <Generic USB SD Reader 1.00> Removable Direct Access SCSI-0 device 
da0: 1.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
acd0: DVDR <Optiarc DVD RW AD-7170A/1.03> at ata2-master UDMA66
cd0: <Optiarc DVD RW AD-7170A 1.03> Removable CD-ROM SCSI-0 device 
cd0: 66.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present
ad6: 76319MB <WDC WD800JD-60LSA5 10.01E03> at ata3-master SATA300

Currently mounted filesystems:
/dev/ad6s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad6s1e on /tmp (ufs, local, soft-updates)
/dev/ad6s1f on /usr (ufs, local, soft-updates)
/dev/ad6s1d on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
linprocfs on /usr/compat/linux/proc (linprocfs, local)

I/O statistics:
      tty             ad6              da0              da1             cpu
 tin tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
  14  209 11.09  11  0.12   0.01   0  0.00   0.01   0  0.00   6  0  2  2 90
INFO: 
Run gstat(8) to see live statistics.

Disk usage:
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad6s1a    496M    252M    204M    55%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad6s1e    496M     17M    439M     4%    /tmp
/dev/ad6s1f     58G     27G     26G    52%    /usr
/dev/ad6s1d    9.7G    1.4G    7.5G    16%    /var
procfs         4.0K    4.0K      0B   100%    /proc
linprocfs      4.0K    4.0K      0B   100%    /usr/compat/linux/proc

Network information

hostname:  icer.local

Currently available network devices:
em0 ath0 fwe0 fwip0 lo0 pflog0 pfsync0

Basic configuration for currently available NICs:

em0:
MAC address: 00:1c:c0:73:7c:2c
IPv4 addresses:
192.168.x.x netmask 0xffffff00

ath0:
MAC address: 00:21:91:97:ba:5e
IPv4 addresses:
192.168.x.x netmask 0xffffff00
MAC address: 02:90:27:24:da:b9

lo0:
IPv4 addresses:
127.0.0.1 netmask 0xff000000
IPv6 addresses:
fe80::1%lo0 prefixlen 64
::1 prefixlen 128

Default route: 192.168.x.x
INFO: For a complete routing table please run netstat -rn

There are 12 currently opened or listening connections.
INFO: For more information please see sockstat(8) manual

Information related to services

Misc information

Currently logged-in users:
icer             v8       :0                9:51PM     - -
icer             p1       :0.0             10:48PM     - w -hi
icer             p0       :0.0              9:51PM     9 /usr/bin/as -o nsPlugi

Uptime:
10:50PM  up  4:55, 3 users, load averages: 1.17, 1.05, 0.88
```
thx, useful fiche
P.S. btw in my opinion, it will be useful if script check rc.conf and after what check runing services and show status. smf like this: 
apache 2.2.1 - runing
samba 3.3.3 - runing


----------



## DutchDaemon (Apr 8, 2009)

> does http://people.freebsd.org/~rse/dist/freebsd-memory work for you well?



Yes, that looks normal to me.


```
SYSTEM MEMORY INFORMATION:
mem_wire:         144449536 (    137MB) [  4%] Wired: disabled for paging out
mem_active:  +    179015680 (    170MB) [  5%] Active: recently referenced
mem_inactive:+    567050240 (    540MB) [ 18%] Inactive: recently not referenced
mem_cache:   +      2453504 (      2MB) [  0%] Cached: almost avail. for allocation
mem_free:    +   2252898304 (   2148MB) [ 71%] Free: fully available for allocation
mem_gap_vm:  +       688128 (      0MB) [  0%] Memory gap: UNKNOWN
-------------- ------------ ----------- ------
mem_all:     =   3146555392 (   3000MB) [100%] Total real memory managed
mem_gap_sys: +     57012224 (     54MB)        Memory gap: Kernel?!
-------------- ------------ -----------
mem_phys:    =   3203567616 (   3055MB)        Total real memory available
mem_gap_hw:  +     17657856 (     16MB)        Memory gap: Segment Mappings?!
-------------- ------------ -----------
mem_hw:      =   3221225472 (   3072MB)        Total real memory installed

SYSTEM MEMORY SUMMARY:
mem_used:         398823424 (    380MB) [ 12%] Logically used memory
mem_avail:   +   2822402048 (   2691MB) [ 87%] Logically available memory
-------------- ------------ ----------- ------
mem_total:   =   3221225472 (   3072MB) [100%] Logically total memory
```


----------



## zordio (Apr 9, 2009)

I also get an error in the memory section:


```
expr: illegal option -- 1
usage: expr [-e] expression
expr: syntax error
```

I threw a few extra lines into 020.mem to see the values of the memory variables:


```
physmem: 3744890880
activemem: 140959744
inactmem: -1125810176
cachemem: 142274560
allmem: -616513536
wiremem: 211468288
freemem: 13770752
```

and the direct sysctl outputs (done after the script ran, so the results might be a little different) are:


```
hw.pagesize: 4096
hw.physmem: 3744890880
vm.stats.vm.v_active_count: 34425
vm.stats.vm.v_inactive_count: 773958
vm.stats.vm.v_cache_count: 34531
vm.stats.vm.v_page_count: 898060
vm.stats.vm.v_wire_count: 51683
vm.stats.vm.v_free_count: 3258
```

Seems to be an overflow error for memory above a certain size.


----------



## danger@ (Apr 9, 2009)

interesting...I will check later today and see what's going on. I have been developing this tool on 8gb box, so it's a bit weird. We will see.


----------



## danger@ (Apr 9, 2009)

Yup, the services part is not yet implemented. I will be working on this part today or maybe during the weekend and Easter holidays.

Having that said, I would like to hear what kind of information you guys are interested to see in the script's output in that regard.

Thanks.


----------



## danger@ (Apr 9, 2009)

what does `% expr 3744890880 / 1048576` give you?


----------



## zordio (Apr 9, 2009)

danger@ said:
			
		

> what does `% expr 3744890880 / 1048576` give you?



That gives 2047.  Although the problem seemed to be with multiplication, not division.

While reading the expr man page, I noticed the -e option, to detect overflows.  I added it to the script, and no longer get errors:


```
RAM information

System memory summary
Total real memory available:    3571 MB
Logically used memory:          398 MB
Logically available memory:     3172 MB

Swap information
Device          1K-blocks     Used    Avail Capacity
/dev/twed0s1b     4194304     248K     4.0G     0%
```


----------



## danger@ (Apr 9, 2009)

I thought that will be a problem 

can you please test http://people.freebsd.org/~danger/sysinfo/sysinfo-090409-alpha.tar.gz for me?


----------



## lme@ (Apr 9, 2009)

Daniel, that's a very nice script! 

```
Available hard drives:
acd0: DVDR <TSSTcorpCD/DVDW TS-L632D/SC01> at ata0-slave UDMA33
acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00
cd0: <TSSTcorp CD/DVDW TS-L632D SC01> Removable CD-ROM SCSI-0 device
cd0: 33.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, 
^^^^ should be grepped out
Medium not present - tray closed
acpi_acad0: <AC Adapter> on acpi0
^^^^^^^^^^^^^^^^^^^^^^^
  no, this is not a drive ;-)
ad0: 114473MB <Seagate ST9120822A 3.ALC> at ata0-master UDMA100
```


```
Basic configuration for currently available NICs:
MAC address: 00:13:02:3f:0d:e4
MAC address: 00:00:f0:7f:da:00
MAC address: 02:00:f0:0f:ab:79
```
You should add the device names here.


```
Default route: 192.168.10.1
```

Here you could add the interface.


----------



## zordio (Apr 9, 2009)

danger@ said:
			
		

> I thought that will be a problem
> 
> can you please test http://people.freebsd.org/~danger/sysinfo/sysinfo-090409-alpha.tar.gz for me?



No errors, info looks correct.


----------



## DutchDaemon (Apr 9, 2009)

No errors here.


----------



## gelraen (Apr 9, 2009)

```
CPU information

Machine class:  i386
CPU Model:      Intel(R) Core(TM)2 Duo CPU     T7250  @ 2.00GHz
Number of CPUs: 2

RAM information

System memory summary
Total real memory available:    2035 MB
Logically used memory:          1352 MB
Logically available memory:     682 MB

Swap information
Device          512-blocks     Used    Avail Capacity
/dev/ad4s1b        4194304     920K     2.0G     0%

Operating system information

Operating system release:       FreeBSD 8.0-CURRENT
OS architecture:                i386
Hostname:                       imax
Kernel build dir location:      /usr/obj/usr/src/sys/HEAD
Currently booted kernel:        /boot/kernel/kernel

Currently loaded kernel modules (kldstat):
drm.ko
radeon.ko
linprocfs.ko
linux.ko
ng_socket.ko
ng_mppc.ko
rc4.ko
ng_iface.ko
ng_ppp.ko
fuse.ko
kqemu.ko
Storage information

Available hard drives:
acd0: DVDR <MATSHITADVD-RAM UJ-861H/1.50> at ata0-master PIO4
acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00
acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00
cd0: <MATSHITA DVD-RAM UJ-861H 1.50> Removable CD-ROM SCSI-0 device
cd0: 16.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed
ad4: 152627MB <FUJITSU MHY2160BH 890B> at ata2-master SATA150

Currently mounted filesystems:
/dev/ufs/root on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ufs/tmp on /tmp (ufs, local, soft-updates)
/dev/ufs/usr on /usr (ufs, local, soft-updates)
/dev/ufs/var on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
linprocfs on /usr/compat/linux/proc (linprocfs, local)
devfs on /usr/compat/linux/dev (devfs, local)
/usr/home/imax/music/Audio on /var/ftp/music/audio (nullfs, local, read-only)
/usr/home/imax/music/Video on /var/ftp/music/video (nullfs, local, read-only)
/usr/home/imax/music/Lyrics on /var/ftp/music/lyrics (nullfs, local, read-only)
/usr/home/imax/Films on /var/ftp/films (nullfs, local, read-only, union)
/usr/home/imax/Share on /var/ftp/share (nullfs, local, read-only)
/var/ftp/incoming on /usr/home/imax/incoming (nullfs, local)
/usr/ports/distfiles on /var/ftp/distfiles (nullfs, local, read-only)
/usr/home/imax/Documents/docs on /var/ftp/docs (nullfs, local, read-only)
devfs on /var/named/dev (devfs, local)

I/O statistics:
      tty             ad4              cd0            pass0             cpu
 tin tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
  57 1588 65.26  17  1.05   0.00   0  0.00   0.00   0  0.00  17  3  9  1 69
modules/030.storage: DEBUG: checkyesno: INFO_MSGS is set to YES.
INFO: Run gstat(8) to see live statistics.

Disk usage:
Filesystem                       Size    Used   Avail Capacity  Mounted on
/dev/ufs/root                    496M    167M    289M    37%    /
devfs                            1.0K    1.0K      0B   100%    /dev
/dev/ufs/tmp                     989M    123M    787M    13%    /tmp
/dev/ufs/usr                     138G    135G    1.2G    99%    /usr
/dev/ufs/var                     2.9G    687M    2.0G    25%    /var
procfs                           4.0K    4.0K      0B   100%    /proc
linprocfs                        4.0K    4.0K      0B   100%    /usr/compat/linux/proc
devfs                            1.0K    1.0K      0B   100%    /usr/compat/linux/dev
/usr/home/imax/music/Audio       138G    135G    1.2G    99%    /var/ftp/music/audio
/usr/home/imax/music/Video       138G    135G    1.2G    99%    /var/ftp/music/video
/usr/home/imax/music/Lyrics      138G    135G    1.2G    99%    /var/ftp/music/lyrics
/usr/home/imax/Films             138G    135G    1.2G    99%    /var/ftp/films
/usr/home/imax/Share             138G    135G    1.2G    99%    /var/ftp/share
/var/ftp/incoming                2.9G    687M    2.0G    25%    /usr/home/imax/incoming
/usr/ports/distfiles             138G    135G    1.2G    99%    /var/ftp/distfiles
/usr/home/imax/Documents/docs    138G    135G    1.2G    99%    /var/ftp/docs
devfs                            1.0K    1.0K      0B   100%    /var/named/dev

Network information

hostname:  imax

Currently available network devices:
em0 wpi0 lo0 vlan0 ng0 gif0 gif1 gif4

Basic configuration for currently available NICs:

em0:
MAC address: 00:1a:4b:76:91:e1
IPv4 addresses:
10.45.71.120 netmask 0xffffff80
MAC address: 00:1c:bf:2e:dc:fc

lo0:
IPv4 addresses:
127.0.0.1 netmask 0xff000000
IPv6 addresses:
fe80::1%lo0 prefixlen 64
::1 prefixlen 128

vlan0:
MAC address: 00:1a:4b:76:91:e1
IPv4 addresses:
10.45.74.7 netmask 0xffffff00

gif0:
IPv4 addresses:
inet 10.45.74.7 -->
192.168.100.1 --> 192.168.100.2

gif1:
IPv4 addresses:
inet 10.45.74.7 -->
192.168.100.1 --> 192.168.100.3

gif4:
IPv4 addresses:
inet 10.45.74.7 -->
192.168.100.17 --> 192.168.100.18

Default route: 10.45.74.254
modules/040.network: DEBUG: checkyesno: INFO_MSGS is set to YES.
INFO: For a complete routing table please run netstat -rn

There are 183 currently opened or listening connections.
modules/040.network: DEBUG: checkyesno: INFO_MSGS is set to YES.
INFO: For more information please see sockstat(8) manual

Information related to services

Misc information

Currently logged-in users:
root             pts/10   :pts/9:S.0       Thu03PM  9:18 /usr/local/bin/zsh

Uptime:
12:55AM  up 10:51, 1 user, load averages: 0.55, 0.56, 0.59
```
ifconfig output parsing not adopted for point-to-point interfaces.

Maybe resolv.conf should be printed in network information.
Also, information about firewall could be useful (as for ipfw - at least sysctl net.inet(6).ip(6).fw.enable, net.link.ether.ipfw and net.link.bridge.ipfw variables).

P.S.: `./sysinfo -a | less` full of esacpe sequences used for coloring which makes output some less readable.

P.P.S.: thanks for developing such tool


----------



## danger@ (Apr 9, 2009)

gelraen said:
			
		

> ifconfig output parsing not adopted for point-to-point interfaces.



First, let me thank you for the feedback.

Could you please send me the output of your ifconfig, so I can fix it for P2P devices?



			
				gelraen said:
			
		

> Maybe resolv.conf should be printed in network information.



Feature added in my local version, thanks for an idea.



			
				gelraen said:
			
		

> Also, information about firewall could be useful (as for ipfw - at least sysctl net.inet(6).ip(6).fw.enable, net.link.ether.ipfw and net.link.bridge.ipfw variables).



That's a great idea, I will implement it soon.



			
				gelraen said:
			
		

> P.S.: `./sysinfo -a | less` full of esacpe sequences used for coloring which makes output some less readable.



That's why there's -c option 



			
				gelraen said:
			
		

> P.P.S.: thanks for developing such tool



It's nice to hear such words, thanks 
Actually it's being developed as part of my bachelor thesis.


----------



## danger@ (Apr 9, 2009)

lme@ said:
			
		

> ```
> cd0: Attempt to query device size failed: NOT READY,
> ^^^^ should be grepped out
> Medium not present - tray closed
> ...



I wonder how does your ifconfig output look like?



			
				lme@ said:
			
		

> ```
> Default route: 192.168.10.1
> ```
> 
> Here you could add the interface.



Added.


----------



## gelraen (Apr 10, 2009)

danger@ said:
			
		

> Could you please send me the output of your ifconfig, so I can fix it for P2P devices?




```
% ifconfig gif0
gif0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1280
        tunnel inet 10.45.74.7 --> 10.45.67.94
        inet 192.168.100.17 --> 192.168.100.18 netmask 0xffffffff
```

General interface looks like this:

```
% ifconfig vlan0
vlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3<RXCSUM,TXCSUM>
        ether 00:1a:4b:76:91:e1
        inet 10.45.74.7 netmask 0xffffff00 broadcast 10.45.74.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 1000 parent interface: em0
```



			
				danger@ said:
			
		

> That's why there's -c option


Oh, sorry, I've missed this one 

And one more small thing, when started without parameters it show help message followed by

```
./sysinfo: ERROR: Not enough arguments provided.
```


----------



## marius (Apr 11, 2009)

The script seems to work correctly on my Soekris.


----------



## danger@ (Apr 11, 2009)

*SysInfo v0.4 release*

Hello guys,

I have packaged a new version of my script. It can be downloaded from http://people.freebsd.org/~danger/sysinfo/sysinfo-110409.tar.gz.

Please test it (including execution with -v to include verbose information) and report any bugs you may have found.

I am still also interested in ideas on what should this script document.

Thanks in advance!


----------



## mwatkins (Apr 11, 2009)

Your latest script works without issue on my slightly out-dated version of FreeBSD 7.1 and served to remind me I have to do an OS update this weekend.

Quick small issue - advice in the following statement is spelled incorrectly:

INFO: For system tuning adice, see the tuning(7) man page.


----------



## gelraen (Apr 11, 2009)

1) check_firewalls() should handle also $firewall_type, not just $firewall_script (btw, maybe will be better to say "ipfw show" instead)

2) services module output full of

```
Cannot 'status' snmpd. Set snmpd_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
```

3) Socket statistics doesn't count tcp/udp sockets. And phrase "IP connections" has no sense.


----------



## trev (Apr 12, 2009)

> CPU information



You could add vmstat(8) -i info after cpu info.



> System memory summary



You could vmstat(8) output here.



> Currently mounted filesystems:



You could compare against /etc/fstab and list currently unmounted filesystems too.



> Disk usage:



After this, it might be useful to see the output of dump(8) -W ... although I'm sure everyone's backups would be up-to-date 



> MAC address: 00:1f:d0:a4:ec:fc
> IPv4 addresses:
> 192.168.1.4 netmask 0xffffff00



Why does the MAC address run on? Most of your other info after a colon starts a new line.



> Firewall related information:



Leave this out if there isn't any firewall info? Or say "no firewall info found" ?



> INFO: Use the portsnap(8) tool to update your ports tree.



Why not csup(1) with compression? Faster and smaller updates.



> Services status
> 
> adzapper is running as pid 730.
> 
> ...



Why the blank line between entries?



> INFO: Configuration of system-wide services is located in the /etc/ directory.
> INFO: Configuration files for local services can be found in the /usr/local/etc/



Might as well be consistent and make it "Configuration of..." rather than "Configuration files for..." the second time.

Nice job!


----------



## danger@ (Apr 14, 2009)

Hello,

it's me again! I have put up a new version of SysInfo (0.5), which can be downloaded from http://people.freebsd.org/~danger/sysinfo/sysinfo-140409.tar.gz.

In this version, I have incomporated the latest feedback I have recieved. I would be very thankful if anybody could test it in their own environment and report any bugs found in this release.

As a last note -- I am still looking for ideas of what should be documented by this script.


----------



## DutchDaemon (Apr 14, 2009)

Two quirks:

Double:


```
Available hard drives:
cd0: <HL-DT-ST DVDRAM GSA-T40L KC07> Removable CD-ROM SCSI-0 device 
cd0: 16.000MB/s transfers
cd0: <HL-DT-ST DVDRAM GSA-T40L KC07> Removable CD-ROM SCSI-0 device 
cd0: 16.000MB/s transfers
ad8: 114473MB <Seagate ST9120823AS 3.AHE> at ata4-master SATA300
ad8: 114473MB <Seagate ST9120823AS 3.AHE> at ata4-master SATA300
```

?


```
Firewall related information:
[: -ne: unexpected operator
```

(not using any)


----------



## danger@ (Apr 14, 2009)

I wonder whether your /var/run/dmesg.boot contains content from previous boot (i.e. not only the last one)?

As of the bug in FW section: I believe I have fixed this in my new local version (haven't tested on the system w/o fw), Thanks.


----------



## DutchDaemon (Apr 14, 2009)

I have no idea  Just a clean and planned reboot, and it shows up thusly in /var/run/dmesg.boot :


```
Waiting (max 60 seconds) for system process `vnlru' to stop...done
Waiting (max 60 seconds) for system process `bufdaemon' to stop...done
Waiting (max 60 seconds) for system process `syncer' to stop...
Syncing disks, vnodes remaining...3 2 2 0 0 done
All buffers synced.
Uptime: 1h37m8s
Rebooting...
cpu_reset: Stopping other CPUs
Copyright (c) 1992-2009 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 7.2-PRERELEASE #0: Thu Mar 19 15:26:46 CET 2009
```

Maybe default behaviour for a warm boot?


----------



## fraenki (Apr 14, 2009)

Nice script, thank you. Some suggestions:

 display whether CPU supports 64-bit or not (x86-64)
 more information about hardware (in addition to "graphic card information")
  -> storage controller vendor/device information
  -> network controller vendor/device information
 system boot date and time (in addition to "system uptime")
 Top 10 most frequently logged-in users (this month)


----------



## devel (Apr 14, 2009)

information regarding jails would be nice addition to existing features )


----------



## royce (Apr 14, 2009)

Great idea! 

ipfilter isn't being detected because of a minor test bug in 140409.  Running 040.network using 'sh -x', the error is:


```
+ [ ! -z ]
+ sysctl -n net.inet.ipf.fr_running
+ stat=1
+ [ ! -z 1]
[: missing ]
+ [ 0 -ne 1 ]
+ warn No firewall is being used on this system.
+ echo -e WARNING: No firewall is being used on this system.
WARNING: No firewall is being used on this system.
```

Just a typo:


```
--- 040.network 2009-04-14 04:10:33.000000000 -0800
+++ 040.network.new     2009-04-14 13:38:44.000000000 -0800
@@ -53,7 +53,7 @@

        # IPF
        stat=`sysctl -n net.inet.ipf.fr_running 2>/dev/null`
-       if [ ! -z $stat]  && [ $stat -eq 1 ]; then
+       if [ ! -z $stat ]  && [ $stat -eq 1 ]; then
                fw=1

                echo "ipfilter is enabled."
```

Keep up the good work!


----------



## mfaridi (Apr 15, 2009)

thanks this is great job , and this script give good informaton
I check it today


----------



## f-andrey (Apr 15, 2009)

Nice script
sysinfo-150409.tar.gz

```
# ./sysinfo -a -v 1 > info.txt 
WARNING: No firewall is being used on this system.
ps: illegal argument: to
usage: ps [-aCcefHhjlmrSTuvwXxZ] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-M core] [-N system]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
ps: illegal argument: to
usage: ps [-aCcefHhjlmrSTuvwXxZ] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-M core] [-N system]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
```


```
# ./sysinfo -a > info0.txt
```
work

Some suggestion:
Parsing program arguments


```
# ./sysinfo -ac
not work
my_book# ./sysinfo -a -c
work
```


----------



## danger@ (Apr 15, 2009)

I wonder why some of you guys get these:


```
Cannot 'status' ipxrouted. Set ipxrouted_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'
```

does anyone have an idea? I don't get it on my machines....interesting. That's the reason you got those ps errors.

As of the argument parsing, this is a common issue with shell scripts (or maybe I am missing something), you have to live with that, sorry


----------



## danger@ (Apr 15, 2009)

fraenki, devel:
I have added your requests to the latest version.


----------



## f-andrey (Apr 15, 2009)

danger@ said:
			
		

> I wonder why some of you guys get these:
> 
> 
> ```
> ...



I got those ps errors.

```
# sh -x ./sysinfo -a -v 1
...
Cannot 'status' kpasswdd. Set kpasswdd_server_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
ps: illegal argument: to
...
Cannot 'status' yppasswdd. Set nis_yppasswdd_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
ps: illegal argument: to
...
```


----------



## danger@ (Apr 15, 2009)

These messages are probably 8.0 feature (I don't run 8.0 personally, so I can't test), because I have tested several 7.x machines and they do not experience this bug.


----------



## Graaf_van_Vlaanderen (Apr 16, 2009)

Here is my info from 'sysinfo -a'
There is actually only "one" hyper-threaded CPU.


```
[root@Hjordis /home/depaepe/Technical/sysinfo]# sh sysinfo -a
CPU information

Machine class:	amd64
CPU Model:	Intel(R) Xeon(TM) CPU 3.40GHz
Number of CPUs:	2

RAM information

System memory summary
Total real memory available:	2035 MB
Logically used memory:		309 MB
Logically available memory:	1725 MB

Swap information
Device          1K-blocks     Used    Avail Capacity
/dev/da0s1b       4160032       0B     4.0G     0%

Operating system information

Operating system release:	FreeBSD 7.1-RELEASE-p4
OS architecture:		amd64
Hostname:			Hjordis
Kernel build dir location:	/usr/obj/usr/src/sys/GENERIC
Currently booted kernel:	/boot/kernel/kernel

No additional kernel modules are currently loaded.

INFO: For security recommendations see the security(7) man page.
INFO: For system tuning advice, see the tuning(7) man page.
INFO: To view various system statistics use the systat(1) tool.

Storage information

Available hard drives:
da1: <COMPAQ RAID 0  VOLUME OK> Fixed Direct Access SCSI-0 device 
da1: 135.168MB/s transfers
da1: 69459MB (142253280 512 byte sectors: 255H 32S/T 17433C)
da0: <COMPAQ RAID 0  VOLUME OK> Fixed Direct Access SCSI-0 device 
da0: 135.168MB/s transfers
da0: 69459MB (142253280 512 byte sectors: 255H 32S/T 17433C)

Raid controllers:
ciss0:
vendor='Compaq Computer Corp (Now owned by Hewlett-Packard)'
device='Smart Array 64xx Controller'

Currently mounted filesystems:
/dev/da0s1a on /
devfs on /dev
/dev/da0s1e on /tmp
/dev/da0s1f on /usr
/dev/da0s1d on /var


I/O statistics:
      tty             da0              da1            pass0             cpu
 tin tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
   0   91 20.17   2  0.03   1.94   0  0.00   0.00   0  0.00  79  0  0  0 20
INFO: Run iostat(8) or gstat(8) to see live statistics.

Disk usage:
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/da0s1a    496M    354M    102M    78%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/da0s1e    496M    3.7M    452M     1%    /tmp
/dev/da0s1f     58G     13G     40G    24%    /usr
/dev/da0s1d    2.9G    534M    2.1G    20%    /var

Network information

hostname: Hjordis

Currently available network devices:
bge0 bge1 lo0

Basic configuration for currently available NICs:

bge0:
MAC address:
00:12:79:94:19:60
IPv4 addresses:
192.168.1.4 netmask 0xffffff00

bge1:
MAC address:
00:12:79:94:19:5f

lo0:
IPv4 addresses:
127.0.0.1 netmask 0xff000000
IPv6 addresses:
fe80::1%lo0 prefixlen 64
::1 prefixlen 128

Default route:
192.168.1.1 via bge0
INFO: For a complete routing table please run netstat -rn.

Firewall related information:
WARNING: No firewall is being used on this system.
INFO: There are several firewall packages on FreeBSD.
INFO: You may want to check http://www.freebsd.org/doc/en/books/handbook/firewalls.html.

Resolver name servers:
192.168.1.1

Socket statistics:
There are currently 13 listening (11 TCP/2 UDP) and 15 connected connections.
INFO: For more information please see sockstat(8) manual.

Packages information

There are 527 packages installed in the system and 0 of them needs updating.
Note that this number may be inaccurate, as your ports tree may be outdated too.

INFO: Run pkg_info(1) to see a full list of installed packages.
INFO: Use pkg_version(1) to inspect what packages are outdated.
INFO: Use the portsnap(8) or csup(1) tool to update your ports tree.

Information related to services

Services status
cupsd is not running.
dbus is not running.
ffserver is not running.
hald is not running.
xfs is not running.
cron is running as pid 732.
devd is running as pid 524.
newsyslog is not running.
sendmail_submit is running as pid 722.
sendmail_clientmqueue is running as pid 726.
sshd is running as pid 716.
syslogd is running as pid 591.
wpa_supplicant is not running.

INFO: Configuration of system-wide services is located in the /etc/ directory.
INFO: Configuration of 3rd party services can be found in the /usr/local/etc/ directory.

Misc information

Graphic card information:
vendor='ATI Technologies Inc'
device='Rage XL PCI'
INFO: Check pciconf(8) for more information.

Currently logged-in users:
depaepe          p3       192.168.1.2      12:44PM     - w -hi
depaepe          p1       192.168.1.2      12:43PM     - bash
depaepe          p2       192.168.1.2      12:44PM    40 /usr/local/libexec/octave/3.0.5/exec/amd64-portbld-freebsd7.1/octave-3.0.5
depaepe          p0       192.168.1.2      12:43PM  2:38 top -uP

Top 10 logged-in users this month:
ac: /var/log/wtmp.0: No such file or directory

System uptime:
System is booted since Thu Apr 16 12:41:13 2009
 3:23PM  up  2:42, 4 users, load averages: 0.08, 0.42, 1.06
```


----------



## irado (Apr 17, 2009)

*how to conf?*

sorry, but I have no expertise to just read a bunch of scripts and know what to do  :r

so, besides a novice (in that matter) I think that I desperately need your script <G> but:

HOW can I configure the rc.conf? the sysinfo script is asking to put variables there but.. which ones is it asking for?

thank you


----------



## bsdsx (Apr 17, 2009)

First, thanks for you great work.
Second, sorry for my english.
Third, i have many comments in my /etc/resolv.conf but sysinfo
parse each lines.

modules/040.network


```
subsect "\nResolver name servers:"
awk '/^#/ { next } /nameserver/ { print $2 }' /etc/resolv.conf
```

Skip the comment line (without "grep"  and print ip


----------



## danger@ (Apr 18, 2009)

Thanks, I didn't think about comments in /etc/resolv.conf in my code.
I have inspired myself by your advise, however have used a bit different code in my local new version


```
awk '/^nameserver/ {print $2}' /etc/resolv.conf
```

Hope that will work for you.


----------



## gnemmi (Apr 18, 2009)

Marvelous work!
Works really well in here and it shows a lot more info than what I was expecting !

One thing though .. just a suggestion .. could you please consider doing something like:


```
Services status

Running
..
..
..

Not running
...
...
...
```

I'll be using your script _a_lot_ !!!

Thanks once again and please keep up the good work you are doing 

PS: sysinfo-150409.tar.gz


----------



## danger@ (Apr 18, 2009)

do you run 8.0-CURRENT?


----------



## irado (Apr 18, 2009)

irado said:
			
		

> sorry, but I have no expertise to just read a bunch of scripts and know what to do  :r
> 
> so, besides a novice (in that matter) I think that I desperately need your script <G> but:
> 
> ...



sure enough this is a so stupid question that not even desserves a "bad comment", it is more contundent just being ignored.

thanks, anyway.


----------



## Mel_Flynn (Apr 18, 2009)

danger@ said:
			
		

> Hello guys,
> 
> The point of this script is to provide some descriptive information about unknown system's configuration (hardware and software) for administrator who has no idea about the given system.



If by this you mean, like inheriting a system from a previous admin that left no docs around, then this is what I find out:

/boot/loader.conf
diff /boot/device.hints /usr/src/sys/$arch/conf/GENERIC.hints
Which settings from /etc/defaults/rc.conf have been changed, mostly local_startup and ldconfig_paths are of interest
Users in wheel with valid shell
sockstat -l
files in /etc/rc.d that should not be there (comparison with /usr/src/etc/rc.d)
Modification time of /var/db/mergemaster.mtree
portaudit -a
df -h, jls, mount -p, kldstat
pci devices without driver
geom modules status (gmirror, geli etc)
Whether NSS is enabled and what backends
Whether sshd allows root login, allows password based login and subsystems running
Number of physical CPU's, cores and logical ones.

That's pretty much my main list, hope this helps.



			
				danger@ said:
			
		

> Hello,
> 
> it's me again! I have put up a new version of SysInfo (0.5), which can be downloaded from http://people.freebsd.org/~danger/sysinfo/sysinfo-140409.tar.gz.



Missing which of available network interfaces are UP.
Should really call onestatus for rc.d services

Other then that, good work! :stud


----------



## MG (Apr 18, 2009)

sysinfo misc:

Top 10 logged-in users this month:
ac: /var/log/wtmp.0: No such file or directory

I have only binary file wtmp in /var/log


----------



## plamaiziere (Apr 19, 2009)

Thanks for this script.

(tests with version 0.8)

The test to see if the CPU supports amd64 returns a wrong result with AMD Geode CPU (because the script looks for "AMD Features"):


```
CPU: Geode(TM) Integrated Processor by AMD PCS (499.91-MHz 586-class CPU)      
  Origin = "AuthenticAMD"  Id = 0x5a2  Stepping = 2                            
  Features=0x88a93d<FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CLFLUSH,MMX>           
  AMD Features=0xc0400000<MMX+,3DNow!+,3DNow!>
```

No a bug but on this box (a Soekris Net5501) dmidecode does not return anything:

```
# dmidecode -t bios
# dmidecode 2.9
# No SMBIOS nor DMI entry point found, sorry.
```


----------



## hbokh (Apr 19, 2009)

*amd64 on a 10yr old PC?*

Nice script indeed!
One small issue: I run FreeBSD 6.4-RELEASE-p1 on an old Pentium2 400MHz so I think to run amd64 on this would be impossible...  


```
# ./sysinfo cpu
CPU information

Machine class:	i386
CPU Model:	Pentium II/Pentium II Xeon/Celeron
No. of Cores:	1

WARNING: Your CPU supports amd64 architecture, however you are running i386.
WARNING: You may want to switch to amd64 to get a better performance.
```


----------



## danger@ (Apr 19, 2009)

Ah, it should check against /var/log/wtmp for the current month...thanks.


----------



## danger@ (Apr 19, 2009)

Could you guys test with SysInfo 0.8.1 please?


----------



## f-andrey (Apr 19, 2009)

danger@ said:
			
		

> Could you guys test with SysInfo 0.8.1 please?



Thanks, now works correctly on amd64 FreeBSD-CURRENT


----------



## graudeejs (Apr 19, 2009)

```
CPU information

Machine class:  i386
CPU Model:      Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores:   2
Cores per CPU:

WARNING: Your CPU supports amd64 architecture, however you are running i386.
WARNING: You may want to switch to amd64 to get a better performance.
```

Warnings are wrong.... [i ran this script on target pc using ssh]
laptop that i'm using atm (i'm not at home) is in fact amd64

P4 doesn't support AMD64, i bought that computer when 64bit for desktop wasn't around yet


also: does amd64 in 64bit mode run faster than in 32bin mode??????? I'm not sure, i did some research few years ago, and that time it was false.


----------



## danger@ (Apr 19, 2009)

can you please paste the output of `# sysinfo -v cpu` please? thanks.


----------



## graudeejs (Apr 19, 2009)

output of 
*$ sysinfo -v -c cpu*

```
CPU information

Machine class:  i386
CPU Model:  Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores:   2
Cores per CPU:


CPU Features:
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0x441d<SSE3,DTES64,MON,DS_CPL,CNXT-ID,xTPR>

Interrupt statistics:
interrupt                          total       rate
irq1: atkbd0                           2          0
irq14: ata0                        85824          1
irq15: ata1                          101          0
irq16: uhci0 uhci3                     3          0
irq17: pcm0                          522          0
irq18: rl0 uhci2+               71669446       1125
irq23: ehci0                           1          0
cpu0: timer                    123139964       1934
cpu1: timer                    123139668       1934
Total                          318035531       4995

CPU usage statistics:
CPU:  2.8% user,  0.0% nice,  9.0% system,  4.7% interrupt, 83.5% idle

Number of processor slots on main board: 1
Voltage: 1.3 V
External Clock: 204 MHz
Max Speed: 4000 MHz
Current Speed: 3060 MHz
Upgrade: ZIF Socket

INFO: Run `dmidecode -t processor` to see further information.
```

perhaps it's because of DTES64


warnings are not included in stdout (they are probably directed to stderr)


P.S.
Max Speed: 4000 MHz
Didn't knew that
Max i have tried was something about 3.45 then it shutdown 
I was using abit software


EDIT
I've attached full output


----------



## danger@ (Apr 19, 2009)

Can you test with the attached patch applied?


----------



## graudeejs (Apr 19, 2009)

danger@ said:
			
		

> Can you test with the attached patch applied?



ok just tell me hot to apply patch (i've never done that  )


Ok, patched it (hopefully right)

```
CPU information

Machine class:  i386
CPU Model:      Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores:   2
Cores per CPU:

WARNING: Your CPU supports amd64 architecture, however you are running i386.
WARNING: You may want to switch to amd64 to get a better performance.

CPU usage statistics:
CPU:  0.9% user,  0.0% nice,  3.2% system,  1.9% interrupt, 94.0% idle
```


```
SysInfo v0.8.2 by Daniel Gerzo for FreeBSD Operating System
```

EDIT:

modules/cpu wan't pached for some reason
I manually removed !
at line 26 and everything is fine now


```
CPU information

Machine class:  i386
CPU Model:      Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores:   2
Cores per CPU:

CPU usage statistics:
CPU:  2.8% user,  0.0% nice,  1.9% system,  3.4% interrupt, 91.9% idle
```


----------



## danger@ (Apr 19, 2009)

you sure it applied correctly to modules/cpu?  it should contain the following code now:


```
# Check whether our CPU supports amd64 and if so, tell user about
        # it when it is not yet used
        if [ "$arch" != "amd64" ] &&
                ( grep -qE 'AMD Features.*LM.*' $DMESG ); then
                        echo
                        warn "Your CPU supports amd64 architecture, however you are running $arch."
                        warn "You may want to switch to amd64 to get a better performance."
        fi
```

BTW I am a bit confused now, because in the output of -a which you have attached in your previous post, there isn't that warning, hm?


----------



## graudeejs (Apr 19, 2009)

danger@ said:
			
		

> you sure it applied correctly to modules/cpu?  it should contain the following code now:
> 
> 
> ```
> ...


I'm not sure
plz, tell me what to execute to patch correctly




			
				danger@ said:
			
		

> BTW I am a bit confused now, because in the output of -a which you have attached in your previous post, there isn't that warning, hm?



warnings are redirected to /dev/stderr what i posted is output of sysinfo -c -a, but i redirected output to file, because i'm doing this with ssh (because i did redirection to file, stderr and stdout were separated, 1 to screen the other one to file).

*i suggest that you use echo for warnings as well*


----------



## graudeejs (Apr 19, 2009)

ok i did
patch < sysinfo.diff
in sysinfo dir

checked, seams now patching was ok
the output seams also ok


```
CPU information

Machine class:  i386
CPU Model:      Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores:   2
Cores per CPU:

CPU usage statistics:
CPU:  1.3% user,  0.0% nice,  0.9% system,  1.3% interrupt, 96.4% idle
```

output copied directly from screen


----------



## danger@ (Apr 19, 2009)

Good to hear that, thanks for verifying. I have also uploaded the full package for 0.8.2 now.


----------



## christias (Apr 19, 2009)

sysinfo-0.8.2 tested on FreeBSD 7.1-amd64, 7.1-i386, 7.0-i386 and 6.2-i386.


```
RAM information

System memory information
Maximum Capacity: 16 GB
Number Of Devices: 8
```

could add the number of installed modules (or even the size of each one).


```
Basic configuration for currently available NICs:

lo0:
IPv4 addresses:
127.0.0.1 netmask 0xff000000
IPv6 addresses:
::1 prefixlen 128
fe80::1%lo0 prefixlen 64

Input errors: 55624005647
Output errors: 55624323881
Collisions:
```

Ipkts and Opkts are reported for localhost instead of Ierrs and Oerrs.


```
Default route:
147.102.222.200 via em0
fe80::208:7cff:fe63:e400%em0 via
```

Interface for IPv6 default route is missing. See "netstat -rn" IPv6 output in case you do not have an IPv6 ready box:


```
Internet6:
Destination     Gateway                       Flags      Netif Expire
::/96           ::1                           UGRS        lo0 =>
default         fe80::208:7cff:fe63:e400%em0  UGS         em0
```

Also:


```
modules/network:
# TCP Wrappers - they are only useful when inetd is enabled
```

Not true. A lot of non inetd services use tcp wrappers. See sshd, sendmail, snmpd, mysqld, slapd, bacula, smbd, imapd etc.


----------



## hbokh (Apr 19, 2009)

FYI: "sysinfo-0.8.2" fixed the CPU-issue I reported this morning (amd64 on an old PII).


----------



## f-andrey (Apr 19, 2009)

danger@ said:
			
		

> As of the argument parsing, this is a common issue with shell scripts (or maybe I am missing something), you have to live with that, sorry



Maybe this will help :q


----------



## danger@ (Apr 20, 2009)

christias said:
			
		

> Also:
> 
> 
> ```
> ...



I have understood from http://www.freebsd.org/doc/en/books/handbook/tcpwrappers.html that you need inetd in order to make use of TCP Wrappers. Is Handbook correct or needs fixing?

As of the other stuff in your message - I will look at it tommorrow now it's time to get some sleep


----------



## gnemmi (Apr 20, 2009)

```
Running services

cron is running as pid 540.
devd is running as pid 353.
inetd is running as pid 561.
sendmail_submit is running as pid 528.
sendmail_clientmqueue is running as pid 534.
sshd is running as pid 522.
syslogd is running as pid 400.

Not running services

uuidd is not running.
newsyslog is not running.
wpa_supplicant is not running.
```

Thank you !!!
And thanks a lot for having implemented some of Mel_Flynn ideas !!!
This is becoming a _must_have_ tool ! 
Congratulations on an already Great Work!

PS: Just in case, i got that using sysinfo-8.0.2 on a 7.0 REL (my desktop =P) and a 7.1 REL (an internal server).
PS2: "Running services" seems to be sorted by service name but "Not running services" appears not to be sorted .. didn't have time to take a look at your code .. but maybe you forgot to pass a "sort" there .. or maybe sorting not running services wasn't your intention at all .. I don't know .. that just caught my attention and thought maybe you would like to know .. .

Once again .. thanks a lot for your really usefull work =)


----------



## fronclynne (Apr 20, 2009)

```
Not running services

. . .
newsyslog is not running.
```
Doesn't newsyslog run from cron?


----------



## gnemmi (Apr 20, 2009)

```
Running services

cupsd is running as pid 756.
hpssd is running as pid 743.
cron is running as pid 845.
devd is running as pid 493.
sendmail_submit is running as pid 835.
sendmail_clientmqueue is running as pid 839.
sshd is running as pid 829.
syslogd is running as pid 624.

Not running services

apache is not running.
bsdstats is not running.
dbus is not running.
ffserver is not running.
hald is not running.
mdnsd is not running.
snmpd is not running.
snmptrapd is not running.
svnserve is not running.
tinderd is not running.
uuidd is not running.
xfs is not running.
newsyslog is not running.
wpa_supplicant is not running.
```

1st post is from my local server. This one is from my desktop (7.1 REL, 7.0 REL, respectively).

Yes ... it does:


```
[gonzalo@inferna ~]% grep newsyslog /etc/crontab
0       *       *       *       *       root    newsyslog
[gonzalo@inferna ~]%
```


----------



## christias (Apr 20, 2009)

danger@ said:
			
		

> I have understood from http://www.freebsd.org/doc/en/books/handbook/tcpwrappers.html that you need inetd in order to make use of TCP Wrappers. Is Handbook correct or needs fixing?



It is outdated and incomplete. Most of standalone network services are linked against libwrap and thus using directly the tcp wrappers framework.


----------



## danger@ (Apr 20, 2009)

Okay,  I have removed the inetd_enable check and modified the message a bit, thanks.


----------



## christias (Apr 20, 2009)

gnemmi said:
			
		

> Yes ... it does:
> 
> 
> ```
> ...



Thinking out loud, may be sysinfo should check only rc.d scripts that make use of **enable* and/or **pidfile* variables.


----------



## danger@ (Apr 20, 2009)

It does. However it has a rc script in /etc/rc.d, that's why it is being checked. I will disable it, however there may be other false-positives.


----------



## danger@ (Apr 20, 2009)

I have checked that now, and it seems like it does not work very well


----------



## Mel_Flynn (Apr 20, 2009)

All services should theoretically REQUIRE: DAEMON, maybe that's a good entry point.


----------



## danger@ (Apr 21, 2009)

Unfortunately that doesn't work either (for example rc.d/nfsd, ezjail, pure-ftpd)


----------



## danger@ (Apr 28, 2009)

*SysInfo is now in ports*

Just a quick update:
the tool is now available from ports too: sysutils/sysinfo


----------



## robertclemens (Apr 30, 2009)

@danger:

Just stumbled upon your sysinfo script. Pretty nice output with lots of information. Could be great for providing "background info" when asking for help on the forum to see where problems reside.

Keep up the good work and thank you sir.


----------



## edhunter (May 3, 2009)

Hello,
really nice tool

I havent tested it very hard,
I just noticed one error on running

```
sysinfo -c -a | more
```
here it is:

```
...
...
Hostname:                       test.xxxxxx
Kernel build dir location:      /usr/obj/usr/src/sys/TESTPC
Currently booted kernel:        /boot/kernel/kernel

Currently loaded kernel modules (kldstat(8)):
linux.ko
--More--(byte 1514)[color="Red"]sysctl: unknown oid 'net.inet6.ip6.forwarding'
[: -eq: unexpected operator[/color]
```

May be that is because I use custom kernel with commented inet6.

Latest version from ports:

```
sysinfo-0.8.6       Utility used to gather system configuration information
```

machine:

```
FreeBSD test.xxxxxxx 7.1-STABLE FreeBSD 7.1-STABLE #0: Wed Feb 11 15:11:25 EET 2009     root@xxxxxx:/usr/obj/usr/src/sys/TESTPC  i386
```


----------



## kamikaze (May 3, 2009)

Test is allergic to empty strings in numeriacal comparisons. I normally use something like this:

```
value="$(sysctl -n net.inet6.ip6.forwarding 2> /dev/null)"
if [ ${value:-0} -eq ...
```


----------



## danger@ (May 3, 2009)

Thanks, it will be fixed in the next release


----------



## irado (May 4, 2009)

thank you very much.. this is a nice and clever tool, indeed.


----------



## trev (May 17, 2009)

Version from /ports/sysutils (perhaps the first line of the output should include the version number?)


```
RAM information

Memory information from dmidecode(8)
Maximum Memory Module Size: 1024 MB
Maximum Total Memory Size: 4096 MB
Maximum Capacity: 2 GB
Number Of Devices: 4
```

Why 4096 MB but then 2 GB ?

There are just two 2GB DIMMs populating two slots, and two empty slots. The memory module size seems wrong at 1GB. Later dmidecode "Memory module information" has correct "installed size" specified.


```
System is booted since Sat Apr 11 23:07:16 2009
```

Maybe better English to say "System is up since ..." or "System was booted on ..."


```
Currently mounted filesystems:
...
linprocfs on /usr/compat/linux/proc

WARNING: Not found in fstab(5): linprocfs on /usr/compat/linux/proc
```

It is in /etc/fstab, but as 
linprocfs               /compat/linux/proc linprocfs

Note: compat is linked to /usr/compat (I believe this is standard.)


```
Users in wheel group (allowed to use su(1)):
root
```

Other users are missing because they are not listed in /etc/groups. You need to also check /etc/passwd.


```
WARNING: bsdstats is supposed to be running, but it doesn't appear to.
```

"but it doesn't appear to." -> "but it isn't."

Of course, it is a one-shot script, so it'll probably never be running 


```
Running services
...
winbindd is not running. <<<<<----- !!
...
Not running services

applix_lic_mgr is not running.
bsdstats is not running.
snmpd is not running.
snmptrapd is not running.
uuidd is not running.
wpa_supplicant is not running.
xfs is not running.
```

Ooops.

Otherwise, great improvement over the last version I tried 4 pages back


----------



## danger@ (May 17, 2009)

trev said:
			
		

> Version from /ports/sysutils (perhaps the first line of the output should include the version number?)



Try to run sysinfo with no arguments, that will display its version. The current version in ports is 1.0. Not sure if you run that though (see below).



> ```
> RAM information
> 
> Memory information from dmidecode(8)
> ...



This appears like a bug in dmidecode(8). Could you please verify? In that case I cannot fix that for you 



> ```
> System is booted since Sat Apr 11 23:07:16 2009
> ```
> 
> Maybe better English to say "System is up since ..." or "System was booted on ..."



Fixed, thanks.



> ```
> Currently mounted filesystems:
> ...
> linprocfs on /usr/compat/linux/proc
> ...



I will look at this one this week.



> ```
> Users in wheel group (allowed to use su(1)):
> root
> ```
> ...



Heh. Nice one, thanks. I will implement this later this week. I usually don't set wheel group as my users' primary group.



> ```
> WARNING: bsdstats is supposed to be running, but it doesn't appear to.
> ```
> 
> ...



Language fixed. Yeah, I know about this problems with "services" which have rc.d scripts but actually are not a real services... I didn't come up to a proper solution yet 



> ```
> Running services
> ...
> winbindd is not running. <<<<<----- !!
> ...



Now that is interesting. I had a similar report in the past and I beleive that the current version should not have this bug. Could you please verify that you're actually running 1.0?



> Otherwise, great improvement over the last version I tried 4 pages back



Thanks 
You may want to run the script with -v as well


----------



## graudeejs (May 17, 2009)

```
Currently loaded kernel modules (kldstat(8)):
zfs.ko
opensolaris.ko
geom_eli.ko
crypto.ko
zlib.ko
snd_ich.ko
sound.ko
acpi.ko
radeon.ko
drm.ko
agp.ko
WARNING: The zfs.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The opensolaris.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The crypto.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The zlib.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The sound.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The acpi.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The radeon.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The drm.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The agp.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
```
i boot from flash, and this loader.conf is not synced (just for the record)


```
Currently mounted filesystems:
/dev/ufs/root on /
devfs on /dev
sys/home on /home
sys/home/Archive on /home/Archive
sys/home/Archive/music on /home/Archive/music
data on /home/Files
data/torrents on /home/Files/torrents
sys/home/Share on /home/Share
sys/home/killasmurf86 on /home/killasmurf86
sys/jails on /jails
sys/jails/test on /jails/test
sys/tmp on /tmp
sys/usr_local on /usr/local
sys/usr_obj on /usr/obj
sys/usr_ports on /usr/ports
sys/usr_ports/distfiles on /usr/ports/distfiles
sys/usr_ports/packages on /usr/ports/packages
sys/usr_src on /usr/src
sys/var on /var

WARNING: Not found in fstab(5): sys/home on /home
WARNING: Not found in fstab(5): sys/home/Archive on /home/Archive
WARNING: Not found in fstab(5): sys/home/Archive/music on /home/Archive/music
WARNING: Not found in fstab(5): data on /home/Files
WARNING: Not found in fstab(5): data/torrents on /home/Files/torrents
WARNING: Not found in fstab(5): sys/home/Share on /home/Share
WARNING: Not found in fstab(5): sys/home/killasmurf86 on /home/killasmurf86
WARNING: Not found in fstab(5): sys/jails on /jails
WARNING: Not found in fstab(5): sys/jails/test on /jails/test
WARNING: Not found in fstab(5): sys/tmp on /tmp
WARNING: Not found in fstab(5): sys/usr_local on /usr/local
WARNING: Not found in fstab(5): sys/usr_obj on /usr/obj
WARNING: Not found in fstab(5): sys/usr_ports on /usr/ports
WARNING: Not found in fstab(5): sys/usr_ports/distfiles on /usr/ports/distfiles
WARNING: Not found in fstab(5): sys/usr_ports/packages on /usr/ports/packages
WARNING: Not found in fstab(5): sys/usr_src on /usr/src
WARNING: Not found in fstab(5): sys/var on /var
```
ZFS 
you could check if zfs.ko is loaded, and then run 

```
zpool status
zpool list
zfs list
```
and probably show warning that zfs is still experimental



```
Geli information
   Name  Status  Components
ad0.eli     N/A  ad0
ad4.eli     N/A  ad4
```
What should be in status? (just in case it's a bug)
They bough are mounted....


```
IPv4 addresses:
192.168.128.100 netmask 0xffffff00
192.168.128.99 netmask 0xffffff00
```
perhaps it's worth mentioning that 192.168.128.99 is alias



```
These users are allowed to use their own crontab:
root
```
at(1) can also be source of evil.
You should check it as well


This is output of sysinfo-1.0_1


----------



## trev (May 18, 2009)

danger@ said:
			
		

> Try to run sysinfo with no arguments, that will display its version. The current version in ports is 1.0. Not sure if you run that though (see below).



SysInfo v1.0 by Daniel Gerzo for FreeBSD Operating System

I could not even read this line on my LCD - bright cyan writing on a bright white background! Also outputting to files is nasty with those control sequences scattered throughout. Yes, I know, use another command line switch, but... not sure many programs default to colour output as they generally follow the principle that you shouldn't surprise your user without good reason, and colour is probably not a good reason and is not a Unix "convention", though it might be a Linux convention (in my very limited Linux experience).



> This appears like a bug in dmidecode(8). Could you please verify? In that case I cannot fix that for you



I *think* the bug is yours. The 2GB DIMM uses 1Gb memory modules. The maximum total memory size is 4GB (ie max memory for a single slot). This is all correct. I think you are misinterpreting the information. The later dmidecode output is also correct, but is probably what you should be using to say what is actually installed. I hope I have explained it better this time 

My other comment had to do with some output being in MB and some in GB. I was, subtly, suggesting you pick one and convert consistently to that. So, 4096MB -> 4GB, or 2GB -> 2048MB, but not some being in MB and some being in GB. Picky, I know, but I'm a lawyer and a programmer, and a former editor.



> Yeah, I know about this problems with "services" which have rc.d scripts but actually are not a real services... I didn't come up to a proper solution yet



Is there not a hint in the scripts? For example:

# PROVIDE: bsdstats
# REQUIRE: LOGIN   <<<<-----
# KEYWORD: shutdown

For services which do run all the time, is it not usually REQUIRE: DAEMON ?



> Now that is interesting. I had a similar report in the past and I believe that the current version should not have this bug. Could you please verify that you're actually running 1.0?



Yep, I was running v1.0.


----------



## danger@ (May 18, 2009)

trev said:
			
		

> SysInfo v1.0 by Daniel Gerzo for FreeBSD Operating System
> 
> I could not even read this line on my LCD - bright cyan writing on a bright white background! Also outputting to files is nasty with those control sequences scattered throughout. Yes, I know, use another command line switch, but... not sure many programs default to colour output as they generally follow the principle that you shouldn't surprise your user without good reason, and colour is probably not a good reason and is not a Unix "convention", though it might be a Linux convention (in my very limited Linux experience).



Well I personally don't use white background in my terminal (it's always black) so I didn't realize this problem. However it is possible to disable the colorful output in the config file (/usr/local/etc/sysinfo.conf) if you don't want to use -c switch.

The colors are there mainly because it's easier to distinguish between sections of the output.



> I *think* the bug is yours. The 2GB DIMM uses 1Gb memory modules. The maximum total memory size is 4GB (ie max memory for a single slot). This is all correct. I think you are misinterpreting the information. The later dmidecode output is also correct, but is probably what you should be using to say what is actually installed. I hope I have explained it better this time



I will need to check further details.



> My other comment had to do with some output being in MB and some in GB. I was, subtly, suggesting you pick one and convert consistently to that. So, 4096MB -> 4GB, or 2GB -> 2048MB, but not some being in MB and some being in GB. Picky, I know, but I'm a lawyer and a programmer, and a former editor.



I currently have no plans in changing this 



> Is there not a hint in the scripts? For example:
> 
> # PROVIDE: bsdstats
> # REQUIRE: LOGIN   <<<<-----
> ...



Not really:


```
root@[lightstorm /data/jails/hosting.cia.sk/www/hmc.sk/www]# grep REQUIRE /services/usr/local/etc/rc.d/*
/services/usr/local/etc/rc.d/amavisd:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/clamav-clamd:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/clamav-freshclam:# REQUIRE: LOGIN clamd
/services/usr/local/etc/rc.d/dovecot:# REQUIRE: LOGIN mysql
/services/usr/local/etc/rc.d/mysql-server:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/postfix:# REQUIRE: LOGIN cleanvar mysql
/services/usr/local/etc/rc.d/postgrey:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/rsyncd:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/sa-spamd:# REQUIRE: LOGIN
```



> Yep, I was running v1.0.



Well that's interesting. I will check then what's going on.


----------



## vermaden (Oct 21, 2009)

I would like to mention some bugs/suggestions:

version: sysinfo-1.0.1


```
CPU usage statistics:
CPU: [3;6H 0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
```
Color even with *-c* in that section.


```
WARNING: Your CPU supports amd64 architecture, however you are running i386.
WARNING: You may want to switch to amd64 to get a better performance.
```
... and miss WINE and some MPLAYER codecs, FLASH and more, rather useless WARNING.



```
WARNING: The linprocfs.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
```
Its loaded automatically when you mount linprocfs from /etc/fstab, no need for /boot/loader.conf entry.


```
WARNING: The linux.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
```
Can be also set in /etc/rc.conf by linux_enable="YES"


```
WARNING: The wpifw.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
```
Its loaded by if_wpi.ko, no need for entry.


```
WARNING: The i915.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The drm.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
```
These two are loaded automatically by starting xorg.


```
WARNING: inetd(8) is enabled, however none of its services are enabled. Check /etc/inetd.conf.
```
Its not enabled and its not running.


```
WARNING: dmesg is supposed to be running, but it isn't.
WARNING: mixer is supposed to be running, but it isn't.
WARNING: virecover is supposed to be running, but it isn't.
```
Supossed to? What for?


```
WARNING: moused is supposed to be running, but it isn't.
WARNING: powerd is supposed to be running, but it isn't.
WARNING: sshd is supposed to be running, but it isn't.
WARNING: syslogd is supposed to be running, but it isn't.
WARNING: devd is supposed to be running, but it isn't.
```
They are running.


```
abi is not running.
addswap is not running.
adjkerntz is not running.
archdep is not running.
auto_linklocal is not running.
automounter is not running.
avahi_daemon is not running.
avahi_dnsconfd is not running.
background-fsck is not running.
bluetooth is not running.
bridge is not running.
```
Useless, most scripts start and end their job.

Regards.


----------



## tiko (Apr 19, 2010)

Hi,

Is this no longer available from the author (the link is obviously 404)?  If so, does anyone have a copy online they could share?


----------



## vermaden (Apr 19, 2010)

@tiko

Use the Ports Luke:

```
% cat /usr/ports/sysutils/sysinfo/pkg-descr

Sysinfo is a shell script, the purpose of which is to automatically
gather system information and document the hardware and software
configuration of the given host system. The goal is to provide a
system operator with descriptive information about an unknown FreeBSD
installation.

WWW: http://forums.freebsd.org/showthread.php?t=3282
```


----------



## Vovas (Jun 23, 2013)

Thanks for _a_ very useful port!

And one question. Could you add new pkg2ng functionality? Now _the_ tool is us_ing_ old pkg_info:

```
pkg_version: the package info for package 'yasm-1.2.0' is corrupt
pkg_version: the package info for package 'zfs-stats-1.2.2' is corrupt
pkg_version: the package info for package 'zip-3.0' is corrupt
```


----------



## Freitase (Aug 14, 2014)

I noticed some people have the following error and I had it as well on precisely one of my boxes.


```
root@mybox:~ # sysinfo services
Generated by SysInfo v1.0.1 by Daniel Gerzo

Information related to services


WARNING: nagios is supposed to be running, but it isn't.
WARNING: nginx is supposed to be running, but it isn't.
WARNING: nsca is supposed to be running, but it isn't.
WARNING: supervisord is supposed to be running, but it isn't.
WARNING: cleanvar is supposed to be running, but it isn't.
WARNING: cron is supposed to be running, but it isn't.
WARNING: devd is supposed to be running, but it isn't.
WARNING: dmesg is supposed to be running, but it isn't.
WARNING: gptboot is supposed to be running, but it isn't.
WARNING: hostid is supposed to be running, but it isn't.
kenv: unable to get dhcp.host-name
WARNING: inetd is supposed to be running, but it isn't.
WARNING: mixer is supposed to be running, but it isn't.
WARNING: ntpd is supposed to be running, but it isn't.
WARNING: pflog is supposed to be running, but it isn't.
WARNING: sshd is supposed to be running, but it isn't.
WARNING: syslogd is supposed to be running, but it isn't.
WARNING: virecover is supposed to be running, but it isn't.
```

But they ARE running:

```
root@mybox:~ # /usr/local/etc/rc.d/nagios status
nagios is running as pid 31973.
```

So I tried this in /usr/local/share/sysinfo/modules/services

```
...
run_rc_script()
{
    ...
    local _file _arg
    _file=$1
    _arg=$2
  
    #HERE I added the next line HERE
    unset procname
    ...
}
...
```

tried again and voila:

```
root@mybox:~ # sysinfo services
Generated by SysInfo v1.0.1 by Daniel Gerzo

Information related to services

WARNING: nsca is supposed to be running, but it isn't.

Running services

cron is running as pid 1028.
devd is running as pid 638.
fcgiwrap is running as pid 32032.
inetd is running as pid 1044.
nagios is running as pid 31973.
nfsd is running as pid 882 884.
nginx is running as pid 31995.
ntpd is running as pid 936.
pflog is running as pid 657.
sshd is running as pid 1016.
supervisord is running as pid 31948.
syslogd is running as pid 804.
```

Yay. Nsca is really not running, so everything is ok now.

I got the idea to unset procname when I had a look at _run_rc_script()_ in /etc/rc.subr. But I do not know why exactly this would fix the problem and if there is potential harm coming from this. Can someone enlighten me/us, please?


----------

