Handy thanks Michael.
Gives the number of CPU's for Monit load. Hmm wonder if we could automate the 
configuration of Monit with this?

Regards
Michael Knill
On 7/3/18, 9:19 pm, "Michael Keuter" <li...@mksolutions.info> wrote:

    
    > Am 04.03.2018 um 23:36 schrieb Michael Knill 
<michael.kn...@ipcsolutions.com.au>:
    > 
    > Thanks. Yes I think I will need to do a mixture of things, knowing what I 
have out there.
    > 
    > Regards
    > Michael Knill
    
    BTW: For CPUs there is something even simpler:
    
    "lscpu"
    
    > On 5/3/18, 8:54 am, "Lonnie Abelbeck" <li...@lonnie.abelbeck.com> wrote:
    > 
    >    Hi Michael,
    > 
    >    Just for completeness, the Linux kernel exposes some DMI (Destktop 
Management Information) values in the /sys virtual filesystem.
    > 
    >    # grep '.*' /sys/class/dmi/id/[bpc]*
    >    -- APU2 --
    >    /sys/class/dmi/id/bios_date:03/07/2016
    >    /sys/class/dmi/id/bios_vendor:coreboot
    >    /sys/class/dmi/id/bios_version:88a4f96
    >    /sys/class/dmi/id/board_asset_tag:
    >    /sys/class/dmi/id/board_name:apu2
    >    /sys/class/dmi/id/board_serial:123456789
    >    /sys/class/dmi/id/board_vendor:PC Engines
    >    /sys/class/dmi/id/board_version:1.0
    >    /sys/class/dmi/id/chassis_asset_tag:
    >    /sys/class/dmi/id/chassis_serial:
    >    /sys/class/dmi/id/chassis_type:3
    >    /sys/class/dmi/id/chassis_vendor:PC Engines
    >    /sys/class/dmi/id/chassis_version:
    >    /sys/class/dmi/id/product_name:apu2
    >    /sys/class/dmi/id/product_serial:123456789
    >    /sys/class/dmi/id/product_version:1.0
    >    --
    > 
    >    And that is one of the more accurately defined boards, many are loaded 
with "To Be Filled By O.E.M".
    > 
    >    As suggested below, some hash of the CPU model and the first 3 bytes 
of the ethernet MAC address would be a better indicator.
    > 
    >    Lonnie
    > 
    > 
    >    On Mar 1, 2018, at 10:39 AM, Lonnie Abelbeck 
<li...@lonnie.abelbeck.com> wrote:
    > 
    >> Hi Michael,
    >> 
    >> There is no direct string containing the vendor/model.  By default we 
don't include the dmidecode command which can retrieve BIOS info, but not 
always accurate or useful.
    >> 
    >> A couple ideas ... (example APU2)
    >> 
    >> # cat /proc/cpuinfo | sed -n -r 's/^model 
name[[:space:]]*:[[:space:]]*(.+)$/\1/p'
    >> AMD GX-412TC SOC
    >> AMD GX-412TC SOC
    >> AMD GX-412TC SOC
    >> AMD GX-412TC SOC
    >> 
    >> You could generate a unique hash string from that ...
    >> 
    >> # cat /proc/cpuinfo | sed -n -r 's/^model 
name[[:space:]]*:[[:space:]]*(.+)$/\1/p' | tr -d ' \t' | sha1sum | cut -c 1-8
    >> 4e908e0f
    >> 
    >> Of course this is not totally unique, but for the common boards used 
with AstLinux it would probably be unique.  But you would have to map the hash 
to a human readable string.
    >> 
    >> You could further refine it using the MAC address of the NIC's
    >> 
    >> # ip -o link show | sed -n -r 's#^.*link/ether ([0-9a-fA-F:]+).*$#\1#p'
    >> 00:0d:b9:01:02:24
    >> 00:0d:b9:01:02:25
    >> 00:0d:b9:01:02:26
    >> 00:0d:b9:01:02:25
    >> 
    >> Get the Vendor of the first MAC ...
    >> 
    >> # ip -o link show | sed -n -r 's#^.*link/ether ([0-9a-fA-F:]+).*$#\1#p' 
| xargs mac2vendor
    >> PC Engines GmbH
    >> 
    >> You can create a very simple shell script to qualify your vendor/model.
    >> --
    >> #!/bin/sh
    >> 
    >> echo "Network Hardware: $(ip -o link show | sed -n -r 's#^.*link/ether 
([0-9a-fA-F:]+).*$#\1#p' | xargs mac2vendor)"
    >> 
    >> echo "Memory: $(awk '/^MemTotal:/ { print int(($2 + 512) / 1024) }' 
/proc/meminfo) MB"
    >> 
    >> case $(cat /proc/cpuinfo | sed -n -r 's/^model 
name[[:space:]]*:[[:space:]]*(.+)$/\1/p' | tr -d ' \t' | sha1sum | cut -c 1-8) 
in
    >> 4e908e0f) echo "PC Engines APU2" ;;
    >> f24bfcb8) echo "Jetway NF9HG-2930" ;;
    >> 173fdaba) echo "Soekris net5501" ;;
    >>        *) echo "Model Unknown" ;;
    >> esac
    >> --
    >> 
    >> Output for APU2:
    >> --
    >> Network Hardware: PC Engines GmbH
    >> Memory: 3881 MB
    >> PC Engines APU2
    >> --
    >> 
    >> Lonnie
    >> 
    >> 
    >> 
    >> On Mar 1, 2018, at 4:49 AM, Michael Knill 
<michael.kn...@ipcsolutions.com.au> wrote:
    >> 
    >>> Ah whoops sorry. Wrong terminology.
    >>> I meant board vendor/model etc. E.g. is it an APU1, APU2, Jetway ????
    >>> 
    >>> Regards
    >>> Michael Knill
    >>> On 1/3/18, 9:39 pm, "Michael Keuter" <li...@mksolutions.info> wrote:
    >>> 
    >>> 
    >>>> Am 01.03.2018 um 11:25 schrieb Michael Knill 
<michael.kn...@ipcsolutions.com.au>:
    >>>> 
    >>>> Hi Group
    >>>> 
    >>>> Is there an easy way to find what board type you have installed in an 
Astlinux box?
    >>>> Im starting to lose track of what I have installed ☹
    >>>> 
    >>>> Regards
    >>>> Michael Knill
    >>> 
    >>>  "cat /proc/cmdline"
    >>> 
    >>>  This is from the file:
    >>> 
    >>>  "/oldroot/cdrom/os/astlinux-xxx.run.conf"
    >>> 
    >>>  you can see in the line KCMD under "astlinux=xxx" the board type.
    >>> 
    >>>  Michael
    >>> 
    >>>  http://www.mksolutions.info
    >>> 
    > 
    >    
------------------------------------------------------------------------------
    >    Check out the vibrant tech community on one of the world's most
    >    engaging tech sites, Slashdot.org! http://sdm.link/slashdot
    >    _______________________________________________
    >    Astlinux-users mailing list
    >    Astlinux-users@lists.sourceforge.net
    >    https://lists.sourceforge.net/lists/listinfo/astlinux-users
    > 
    >    Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.
    > 
    > 
------------------------------------------------------------------------------
    > Check out the vibrant tech community on one of the world's most
    > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
    > _______________________________________________
    > Astlinux-users mailing list
    > Astlinux-users@lists.sourceforge.net
    > https://lists.sourceforge.net/lists/listinfo/astlinux-users
    > 
    > Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.
    
    
    Michael
    
    http://www.mksolutions.info
    
    
    
    
    
------------------------------------------------------------------------------
    Check out the vibrant tech community on one of the world's most
    engaging tech sites, Slashdot.org! http://sdm.link/slashdot
    _______________________________________________
    Astlinux-users mailing list
    Astlinux-users@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/astlinux-users
    
    Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Astlinux-users mailing list
Astlinux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.

Reply via email to