Discovering Linux ‘Distro’ Facts

I am building out parts of the Citihub web site monitoring solution using Zabbix and have decided that I need a User Procedure to report certain distro facts since we seem to be using whatever OS the solution author feels like. (We have several Linux distros within the web site. Zabbix comes with a number of agents which report certain static facts about the systems being monitored, and these have been the inspiration for this piece of work.

I have written a program (shell script) that browses and parses /etc/*-release. It has been tested for RHES, SUSE, Fedora and Ubuntu 10. It ends with status 0 if it works OK and 1 for a universal error i.e. if it cannot detect and parse the *-release files. It replies status 10 if neither lsb-release nor system-release files are present, and status 255 if it is not Linux. I put this program in /usr/local/bin.

This page, called Find out my Linux distribution name and version at http://www.cyberciti.biz was very useful and documented the use of the /etc/*-release files.

I wrote a script called showdistro which works on a bunch of distros with varying verboseness.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.