*New 11.3 series Release:
2019-10-19: XigmaNAS 11.3.0.4.7014 - released

*New 12.0 series Release:
2019-10-05: XigmaNAS 12.0.0.4.6928 - released!

*New 11.2 series Release:
2019-09-23: XigmaNAS 11.2.0.4.6881 - released!

We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

SNMP + MRTG on Nas4Free

SNMP service.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

SNMP + MRTG on Nas4Free

#1

Post by alexey123 » 15 Oct 2012 09:01

UPDATE -- bsnmptools repaired from 9.1.0.1 - Sandstorm (revision 358)

I enable on fresh installed nas4free SNMP server and check all modules. Also I go to NAS4Free trunk folder and check in ports - used bsnmptools.
For test it I write on SSH console

Code: Select all

Welcome to NAS4Free!
nas4free:~# bsmnpget
bsmnrget: Command not found.
nas4free:~# bsmnpwalk
nas4free:~#: Command not found.
OK, I go in Freshports and find Homepage for bsnmptools - http://wiki.freebsd.org/BsnmpTools. I download sources and see into /bsnmptools/usr.sbin/bsnmpdtools/bsnmptools/ only bsnmpget command. I think OK, and install package. Result

Code: Select all

nas4free:~# pkg_add -r bsnmptools
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9-stable/Latest/bsnmptools.tbz... Done.
nas4free:~# rehash
nas4free:~# bsnmpget
Provide at least one OID
Segmentation fault
This is not OK!! Nas4free server browserable from another clients but not have working self-tools

But I maniacally find snmpget and snmpwalk command

Code: Select all

nas4free:~# pkg_add -r net-snmp
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9-stable/Latest/net-snmp.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9-stable/All/perl-5.14.2_2.tbz... Done.
nas4free:~# rehash
nas4free:~# snmpget
Shared object "libelf.so.1" not found, required by "snmpget" 
OK, I go to jail-folder and copy paste from it /usr/lib/libelf.so.1 into nas. Wow, it work

Code: Select all

nas4free:~# snmpget
Created directory: /var/net-snmp
Created directory: /var/net-snmp/mib_indexes
No hostname specified.
USAGE: snmpget [OPTIONS] AGENT OID [OID]...

  Version:  5.7.1
  Web:      http://www.net-snmp.org/
  Email:    net-snmp-coders@lists.sourceforge.net

OPTIONS:
  -h, --help            display this help message
  -H                    display configuration file directives understood
  -v 1|2c|3             specifies SNMP version to use
  -V, --version         display package version number
SNMP Version 1 or 2c specific
  -c COMMUNITY          set the community string
SNMP Version 3 specific
  -a PROTOCOL           set authentication protocol (MD5|SHA)
  -A PASSPHRASE         set authentication protocol pass phrase
  -e ENGINE-ID          set security engine ID (e.g. 800000020109840301)
  -E ENGINE-ID          set context engine ID (e.g. 800000020109840301)
  -l LEVEL              set security level (noAuthNoPriv|authNoPriv|authPriv)
  -n CONTEXT            set context name (e.g. bridge1)
  -u USER-NAME          set security name (e.g. bert)
  -x PROTOCOL           set privacy protocol (DES|AES)
  -X PASSPHRASE         set privacy protocol pass phrase
  -Z BOOTS,TIME         set destination engine boots/time
General communication options
  -r RETRIES            set the number of retries
  -t TIMEOUT            set the request timeout (in seconds)
Debugging
  -d                    dump input/output packets in hexadecimal
  -D[TOKEN[,...]]       turn on debugging output for the specified TOKENs
                           (ALL gives extremely verbose debugging output)
General options
  -m MIB[:...]          load given list of MIBs (ALL loads everything)
  -M DIR[:...]          look in given list of directories for MIBs
    (default: /root/.snmp/mibs:/usr/local/share/snmp/mibs)
  -P MIBOPTS            Toggle various defaults controlling MIB parsing:
                          u:  allow the use of underlines in MIB symbols
                          c:  disallow the use of "--" to terminate comments
                          d:  save the DESCRIPTIONs of the MIB objects
                          e:  disable errors when MIB symbols conflict
                          w:  enable warnings when MIB symbols conflict
                          W:  enable detailed warnings when MIB symbols conflict
                          R:  replace MIB symbols from latest module
  -O OUTOPTS            Toggle various defaults controlling output display:
                          0:  print leading 0 for single-digit hex characters
                          a:  print all strings in ascii format
                          b:  do not break OID indexes down
                          e:  print enums numerically
                          E:  escape quotes in string indices
                          f:  print full OIDs on output
                          n:  print OIDs numerically
                          q:  quick print for easier parsing
                          Q:  quick print with equal-signs
                          s:  print only last symbolic element of OID
                          S:  print MIB module-id plus last element
                          t:  print timeticks unparsed as numeric integers
                          T:  print human-readable text along with hex strings
                          u:  print OIDs using UCD-style prefix suppression
                          U:  don't print units
                          v:  print values only (not OID = value)
                          x:  print all strings in hex format
                          X:  extended index format
  -I INOPTS             Toggle various defaults controlling input parsing:
                          b:  do best/regex matching to find a MIB node
                          h:  don't apply DISPLAY-HINTs
                          r:  do not check values for range/type legality
                          R:  do random access to OID labels
                          u:  top-level OIDs must have '.' prefix (UCD-style)
                          s SUFFIX:  Append all textual OIDs with SUFFIX before parsing
                          S PREFIX:  Prepend all textual OIDs with PREFIX before parsing
  -L LOGOPTS            Toggle various defaults controlling logging:
                          e:           log to standard error
                          o:           log to standard output
                          n:           don't log at all
                          f file:      log to the specified file
                          s facility:  log to syslog (via the specified facility)

                          (variants)
                          [EON] pri:   log to standard error, output or /dev/null for level 'pri' and above
                          [EON] p1-p2: log to standard error, output or /dev/null for levels 'p1' to 'p2'
                          [FS] pri token:    log to file/syslog for level 'pri' and above
                          [FS] p1-p2 token:  log to file/syslog for levels 'p1' to 'p2'
  -C APPOPTS            Set various application specific behaviours:
                          f:  do not fix errors and retry the request
Also work snmpget.
But I think need add this tools to NAS4Free server :!:
I'll continue this topic with MRTG service on NAS4Free - I build 4 pictures, but I want more
Last edited by alexey123 on 19 Oct 2012 10:05, edited 3 times in total.
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: where is command line?

#2

Post by alexey123 » 15 Oct 2012 11:59

I continue. MRTG - install ( i test on full version )
SNMP need be enabled.
In first - create Group mrtg with GID=273 and user mrtg with UID=273, member of mrtg group, nologin, nopassword over webgui.
Create working folder for it

Code: Select all

mkdir -p /mnt/data/app/mrtg
chown mrtg:mrtg /mnt/data/app/mrtg
Where data - my second partition, app - folder for applications.
Install mrtg.

Code: Select all

pkg_add -r mrtg
rehash
I use command for fresh install, old software may conflict with additional packages - need reinstall its.
Make config and edit it

Code: Select all

cd /usr/local/etc/mrtg
cfgmaker public@{Your NAS IP} > mrtg.cfg
---------------------------------------------------------------------------
If you have errors in this ste such
SNMPWALK Problem for 1.3.6.1.2.1.1 on public@10.0.0.41::::::v4only
at /usr/local/bin/cfgmaker line 951
- this sims about not installed net-snmp.
2Ways
1. repair all codes mrtg to use bsnmptools :o
2. Simple install net-snmp as wrote in first post.
----------------------------------------------------------------------
Edit file /usr/local/etc/mrtg/mrtg.cfg
# Created by
# /usr/local/bin/cfgmaker public@10.0.0.1
### Global Config Options

# for UNIX
WorkDir: /mnt/data/app/mrtg <--- and uncomment this line

# or for NT
# WorkDir: c:\mrtgdata
Also I delete commented interfaces as usb and plip - no need now.
Make first run

Code: Select all

mrtg mrtg.cfg
It says - Not want to run as simple command, and type True command

Code: Select all

env LANG=C /usr/local/bin/mrtg mrtg.cfg
In this step MRTG run with your config, and wrote about fault. Retype this command until it run without fault.
Now you can check files into /mnt/data/app/mrtg folder - need present files.
If files present - run mrtg as daemon. Add to /etc/rc.conf over webgui mrtg_daemon_enable="YES"
And start daemon

Code: Select all

env LANG=C /usr/local/bin/mrtg --pid-file /var/run/mrtg/mrtg.pid --lock-file /var/run/mrtg/lockfile --confcache-file /var/run/mrtg/confcache --user mrtg --group mrtg --daemon /usr/local/etc/mrtg/mrtg.cfg
Server must wrote - Daemonizing MRTG ...
Now create index page for MRTG. I create .php file instead html for some reasons.

Code: Select all

nas4free:/usr/local/etc/mrtg# indexmaker mrtg.cfg > index.php
nas4free:/usr/local/etc/mrtg# cp index.html /mnt/data/app/mrtg/
I want see MRTG - pictures on NAS4Free webgui.

Code: Select all

ln -s /mnt/data/app/mrtg /usr/local/www/mrtg
Edit /usr/local/www/fbegin.inc , section Diagnostic
// Diagnostics
$menu['diagnostics']['desc'] = gettext("Diagnostics");
$menu['diagnostics']['visible'] = Session::isAdmin();
$menu['diagnostics']['link'] = "";
$menu['diagnostics']['menuitem'] = array();
$menu['diagnostics']['menuitem'][] = array("desc" => gettext("Log"), "link" => "diag_log.php", "visible" => TRUE);
$menu['diagnostics']['menuitem'][] = array("desc" => gettext("Information"), "link" => "diag_infos.php", "visible" => TRUE);
$menu['diagnostics']['menuitem'][] = array("desc" => gettext("Graphs"), "link" => "/mrtg/", "visible" => Session::isAdmin(), "target" => "_blank"); <-- Added line
$menu['diagnostics']['menuitem'][] = array("type" => "separator", "visible" => TRUE);
$menu['diagnostics']['menuitem'][] = array("desc" => gettext("Ping/Traceroute"), "link" => "diag_ping.php", "visible" => TRUE);
$menu['diagnostics']['menuitem'][] = array("desc" => gettext("ARP Tables"), "link" => "diag_arp.php", "visible" => TRUE);
$menu['diagnostics']['menuitem'][] = array("desc" => gettext("Routes"), "link" => "diag_routes.php", "visible" => TRUE);
Image

We have graph for Lan interface for about 1 years.

Image

Installed packages on this time

Code: Select all

nas4free:~# pkg_info
expat-2.0.1_2       XML 1.0 parser written in C
fontconfig-2.9.0,1  An XML-based font configuration API for X Windows
freetype2-2.4.9_1   A free and portable TrueType font rendering engine
gd-2.0.35_8,1       A graphics library for fast creation of images
jpeg-8_3            IJG's jpeg compression utilities
mrtg-2.17.4_2,1     The multi-router traffic grapher
net-snmp-5.7.1_7    An extendable SNMP implementation
p5-SNMP_Session-1.13 A perl5 module providing rudimentary access to SNMPv1 and v
perl-5.14.2_2       Practical Extraction and Report Language
pkgconf-0.8.9       pkg-config compatible utility which does not depend on glib
png-1.5.12          Library for manipulating PNG images
CPU, Disk, Memory analistics I'll add.
Last edited by alexey123 on 19 Oct 2012 10:20, edited 1 time in total.
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: where is command line? + MRTG on Nas4Free

#3

Post by alexey123 » 17 Oct 2012 12:49

For continue working with NAS4Free - SNMP server need prepare some tools.
net-snmp I install in first post, but codes... :o
To be precise - need a simple converter for SNMP code, I want to work fast. I prepare it and attach to post. This converter only for NAS4free and <CENZURED> :D-7.5 release
How to use it?
Download archive, unzip it, and place to any web folder - this may be folder for Nas4Free webserver or admin interface
Archive content folder and 2 files into - script and .csv

Code: Select all

snmp----snmp_calc.php
     |- snmp_translate.csv
I'll put 2 files into /usr/local/www - to admin interface folder and I'll create menu on advansed tab.
Open with browser

Code: Select all

http://<your_nas_webserver>/snmp/snmp_calc.php
and try search by MiBname or digital code - this work 2-way.

Examples. Search by name
Image

Search by digital adress
Image

I'll continue
You do not have the required permissions to view the files attached to this post.
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: where is command line? + MRTG on Nas4Free

#4

Post by alexey123 » 17 Oct 2012 13:20

Ok, Now I add simple log for NAS4Free localhost - CPU usage, Swap and RAM usage. Anybody can add configs to disk usage or network protocol loggin, I wrote only examples
NOTE: MRTG can wrote only 2 lines per picture - blue and green. For more graphs need use another programm, such RRD-tools.

Code: Select all

cd /usr/local/etc/mrtg
Edit with any editor config.cfg file. I just add into next.
# Memory usage
Target[localhost.ram]:.1.3.6.1.4.1.2021.4.11.0&.1.3.6.1.4.1.2021.4.6.0:public@10.0.0.1
MaxBytes[localhost.ram]: 805175296
Title[localhost.ram]: Memory Usage
PageTop[localhost.ram]: <h1>Memory Usage</h1>
Shortlegend[localhost.ram]: Bytes
kilo[localhost.ram]: 1024
YLegend[localhost.ram]: mem usage
Legend1[localhost.ram]: RAM Free
Legend2[localhost.ram]: RAM Available
Legend3[localhost.ram]:
Legend4[localhost.ram]:
LegendI[localhost.ram]: RAM free&nbsp;
LegendO[localhost.ram]: Ram available&nbsp;
options[localhost.ram]: gauge pngdate

# Swap usage
Target[localhost.swap]:.1.3.6.1.4.1.2021.4.3.0&.1.3.6.1.4.1.2021.4.4.0:public@10.0.0.1
MaxBytes[localhost.swap]: 500000000
Title[localhost.swap]: Swap Usage
PageTop[localhost.swap]: <h1>Swap Usage</h1>
Shortlegend[localhost.swap]: Bytes
kilo[localhost.swap]: 1024
YLegend[localhost.swap]: mem usage
Legend1[localhost.swap]: Swap connected
Legend2[localhost.swap]: Swap free
Legend3[localhost.swap]:
Legend4[localhost.swap]:
LegendI[localhost.swap]: Swap connected free&nbsp;
LegendO[localhost.swap]: Swap free&nbsp;
options[localhost.swap]: gauge pngdate

# CPU load on localhost
Target[localhost.load]:.1.3.6.1.4.1.2021.11.9.0&.1.3.6.1.4.1.2021.11.10.0:public@10.0.0.1
MaxBytes[localhost.load]: 20
AbsMax[localhost.load]: 500
Title[localhost.load]: CPU Load on localhost
Options[localhost.load]: gauge
Shortlegend[localhost.load]: mips
YLegend[localhost.load]: Load
LegendI[localhost.load]: Load-1&nbsp;
LegendO[localhost.load]: Load-5&nbsp;
Legend1[localhost.load]: 1 Minute Load Average
Legend2[localhost.load]: 5 Minute Load Average
PageTop[localhost.load]: <H1>CPU Load Analysis for localhost </H1>
<TABLE>
<tr><td>Values are 'load * 100' so a value of 20 on the graph is a load of 0.2</td></tr>
</TABLE>
Blue and green marked variables on graphs
After add lines to config need stop mrtg_daemon

Code: Select all

ps -ax | grep mrtg
it wrote
22880 ?? Is 0:01.78 /usr/local/bin/perl -w /usr/local/bin/mrtg --pid-file

Code: Select all

kill -s HUP 22880
and reconfigure MRTG from his folder

Code: Select all

env LANG=C /usr/local/bin/mrtg mrtg.cfg
indexmaker mrtg.cfg > index.php
cp index.php /mnt/data/app/mrtg/
env LANG=C /usr/local/bin/mrtg --pid-file /var/run/mrtg/mrtg.pid --lock-file /var/run/mrtg/lockfile --confcache-file /var/run/mrtg/confcache --user mrtg --group mrtg --daemon /usr/local/etc/mrtg/mrtg.cfg
To be continued --> CPU temperature, hard disks temperatures, may be voltages on motherboard...
Also I'll monitor remote host.
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: SNMP + MRTG on Nas4Free

#5

Post by alexey123 » 19 Oct 2012 12:42

In this post I wrote how to log and graph CPU and hard disks temperatures on NAS4Free (all FreeBSD)
In MIBs not have entry for observe this parameters, may be anybody cane wrote it? I don't know how wrote its :cry: , but I wan't log and observe :!:
For do this I have to cheat program. I need insert My Data instead of the his standard input data.
I can observe temperature over command line
For CPU

Code: Select all

sysctl -a | grep | tempe
Server answer:
hw.acpi.thermal.tz0.temperature: 36.0C
Blue - full name, green - value. For AMD64 it answer another, for example dev.cpu.0.temperature: 36,0C dev.cpu.1.temperature: 37,0C
For disk

Code: Select all

/sbin/sysctl hw.acpi.thermal | awk '/temperature/ {print int($2)}'
Answer 36
mrtg need receive 4 values, which I test where
Legend1[graph.name]:first value, green colour on graph
Legend2[graph.name]: second value, blue line on graph
Legend3[graph.name]: thrid value - use on legend
Legend4[graph.name]: forth value - also use on legend
For do True Format I wrote script, wich make thermal log in /tmp folder. Script I put into /usr/local/etc/mrtg folder and named it as mrtg.sh, make it executable and observe results into /tmp folder - need be file thermal.log.

Code: Select all

echo `/usr/local/sbin/smartctl -a /dev/ada1 | grep Temperature | awk '{print $10}' | tail -n 1`> /tmp/thermal.log  
echo `/sbin/sysctl hw.acpi.thermal | awk '/temperature/ {print int($2)}'`>> /tmp/thermal.log
echo "Third Value" >> /tmp/thermal.log
echo "Forth Value" >> /tmp/thermal.log
This script I put into cron-tab - every 6 minutes. Check it ( I was see time of file and content)
I add in to /usr/local/etc/mrtg/config.cfg next:

Code: Select all

Target[cpu_temp]:`/bin/cat /tmp/thermal.log`
Options[cpu_temp]: nopercent, gauge, pngdate
Title[cpu_temp]: Server CPU temperature
LegendI[cpu_temp]: Temperature CPU
LegendO[cpu_temp]: Disk temperature
YLegend[cpu_temp]: Temp C
MaxBytes[cpu_temp]: 55
AbsMax[cpu_temp]: 60
ShortLegend[cpu_temp]:
PageTop[cpu_temp]: <h1>Server CPU Temperature</h1>
Legend1[cpu_temp]: Server CPU Temperature   
Legend2[cpu_temp]: Disk Temperature
Legend3[cpu_temp]: Third value
Legend4[cpu_temp]: Forth value
Now I not need nrtg daemon - Instead I have CronJob. Disable daemon - remove from /etc/rc.conf string mrtg_daemon_enable="YES"
And add to my script next lines for start mrtg with measurement

Code: Select all

env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
echo "`/bin/date`::  mrtg executed " >> /var/log/mrtg.log
It wrote create log for first time. In future I'll disable log. I create log

Code: Select all

touch /var/log/mrtg.log
Now I start mrtg with his configuration manually until it execute without warning - It need recreate old files and create new

Code: Select all

env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
When success - I create index file and copy it to working directory

Code: Select all

nas4free:/usr/local/etc/mrtg# indexmaker mrtg.cfg > index.php
nas4free:/usr/local/etc/mrtg# cp index.html /mnt/data/app/mrtg/
Thats all.
Need wait about 2-3 hours for script make new pictures.

Now Result script /usr/local/etc/mrtg/mrtg.sh is :

Code: Select all

echo `/usr/local/sbin/smartctl -a /dev/ada1 | grep Temperature | awk '{print $10}' | tail -n 1`> /tmp/thermal.log  
echo `/sbin/sysctl hw.acpi.thermal | awk '/temperature/ {print int($2)}'`>> /tmp/thermal.log
echo "Third Value" >> /tmp/thermal.log
echo "Forth Value" >> /tmp/thermal.log
env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
echo "`/bin/date`::  mrtg executed " >> /var/log/mrtg.log
Nightly building result I attach to post
You do not have the required permissions to view the files attached to this post.
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: SNMP + MRTG on Nas4Free

#6

Post by alexey123 » 19 Oct 2012 13:21

Mbmon working on my motherboard , I'll use it for laboratory! But not working at home motherboard and on my repaired HP D530, E350

Code: Select all

pkg_add -r mbmon
rehash
mbmon
Answer
ioctl(smb0:open): No such file or directory

Temp.= 37.0, 127.0, 124.0; Rot.= 3515, 0, 0
Vcore = 1.54, 2.50; Volt. = 0.00, 0.00, 0.00, -0.00, -0.00
37.0 - CPU temperature
3515 - value as CPU fan speed
0 - value as first chassic fan speed +
0 - value as second chassic fan speed, not connected but i HACK IT
Vcore = 1.54, is core voltage 2.50 - is RAM voltage
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: SNMP + MRTG on Nas4Free

#7

Post by alexey123 » 20 Oct 2012 15:26

Monitoring remote host.
In my case - windows XP Professional Work station, alwais work 24/7/360.
For monitor Windows I enable SNMP service. Manual from Microsoft. Vista/Win7 have someway. Need only open port on firewall.
But it not have any recources for hardware monitoring. I use third party software - speedfan.
And SNMP extentionfor it.
Manual for this extension is false, need create self-manual. Haaaack IT :oops:
I go into speedfan panel and open exotic tab.
Image
Observe... Fine view.
Now i connect to NAS4Free box over SSH and type command

Code: Select all

snmpwalk -v 2c -c public 10.0.0.4 .1.3.6.1.4.1.30503.1  >  speedfan_ext.txt
For version from 358 can use command

Code: Select all

bsnmpwalk -v 2c -s public@10.0.0.4 .1.3.6.1.4.1.30503.1 > speedfan_ext.txt
When I press Enter I make screenshot for speedfan. For better understand Who is Who. Compare picture and file , placed nas4free:/root/speedfan_ext.txt
I have output from snmpget as
SNMPv2-SMI::enterprises.30503.1.1.1 = INTEGER: 7
SNMPv2-SMI::enterprises.30503.1.1.2 = INTEGER: 5
SNMPv2-SMI::enterprises.30503.1.1.3 = INTEGER: 9
SNMPv2-SMI::enterprises.30503.1.2.1 = INTEGER: 12700
SNMPv2-SMI::enterprises.30503.1.2.2 = INTEGER: 12700
SNMPv2-SMI::enterprises.30503.1.2.3 = INTEGER: 3000
SNMPv2-SMI::enterprises.30503.1.2.4 = INTEGER: 4200
SNMPv2-SMI::enterprises.30503.1.2.5 = INTEGER: 3000
SNMPv2-SMI::enterprises.30503.1.2.6 = INTEGER: 3000
SNMPv2-SMI::enterprises.30503.1.2.7 = INTEGER: 3300
SNMPv2-SMI::enterprises.30503.1.3.1 = INTEGER: 2547
SNMPv2-SMI::enterprises.30503.1.3.2 = INTEGER: 0
SNMPv2-SMI::enterprises.30503.1.3.3 = INTEGER: 0
SNMPv2-SMI::enterprises.30503.1.3.4 = INTEGER: 0
SNMPv2-SMI::enterprises.30503.1.3.5 = INTEGER: 0
SNMPv2-SMI::enterprises.30503.1.4.1 = INTEGER: 120
SNMPv2-SMI::enterprises.30503.1.4.2 = INTEGER: 128
SNMPv2-SMI::enterprises.30503.1.4.3 = INTEGER: 336
SNMPv2-SMI::enterprises.30503.1.4.4 = INTEGER: 481
SNMPv2-SMI::enterprises.30503.1.4.5 = INTEGER: 1197
SNMPv2-SMI::enterprises.30503.1.4.6 = INTEGER: -751
SNMPv2-SMI::enterprises.30503.1.4.7 = INTEGER: -506
SNMPv2-SMI::enterprises.30503.1.4.8 = INTEGER: 470
SNMPv2-SMI::enterprises.30503.1.4.9 = INTEGER: 408
SNMPv2-SMI::enterprises.30503.1.5.1 = STRING: "127.00"
SNMPv2-SMI::enterprises.30503.1.5.2 = STRING: "127.00"
SNMPv2-SMI::enterprises.30503.1.5.3 = STRING: "30.00"
SNMPv2-SMI::enterprises.30503.1.5.4 = STRING: "42.00"
SNMPv2-SMI::enterprises.30503.1.5.5 = STRING: "30.00"
SNMPv2-SMI::enterprises.30503.1.5.6 = STRING: "30.00"
SNMPv2-SMI::enterprises.30503.1.5.7 = STRING: "33.00"
SNMPv2-SMI::enterprises.30503.1.6.1 = STRING: "2547.00"
SNMPv2-SMI::enterprises.30503.1.6.2 = STRING: "0.00"
SNMPv2-SMI::enterprises.30503.1.6.3 = STRING: "0.00"
SNMPv2-SMI::enterprises.30503.1.6.4 = STRING: "0.00"
SNMPv2-SMI::enterprises.30503.1.6.5 = STRING: "0.00"
SNMPv2-SMI::enterprises.30503.1.7.1 = STRING: "1.20"
SNMPv2-SMI::enterprises.30503.1.7.2 = STRING: "1.28"
SNMPv2-SMI::enterprises.30503.1.7.3 = STRING: "3.36"
SNMPv2-SMI::enterprises.30503.1.7.4 = STRING: "4.81"
SNMPv2-SMI::enterprises.30503.1.7.5 = STRING: "11.97"
SNMPv2-SMI::enterprises.30503.1.7.6 = STRING: "-7.51"
SNMPv2-SMI::enterprises.30503.1.7.7 = STRING: "-5.06"
SNMPv2-SMI::enterprises.30503.1.7.8 = STRING: "4.70"
SNMPv2-SMI::enterprises.30503.1.7.9 = STRING: "4.08"
I understand Who is Who , when I compare text and picture! Win! Windows is ready for monitoring, But when I try monitor it from mrtg, I have error - many string about protocol.
As not working standart, But we know how to use external program with MRTG.
Strategy: I'll use graph for CPU and hard disk temperature, and log voltages and FAN speed into logfile.
Will be continue..
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: SNMP + MRTG on Nas4Free

#8

Post by alexey123 » 21 Oct 2012 00:41

For log remote XP station I'll use my script /usr/local/etc/mrtg/mrtg.sh
SNMPv2-SMI::enterprises.30503.1.5.6 = STRING: "30.00" - Core1 Temperature
SNMPv2-SMI::enterprises.30503.1.5.7 = STRING: "33.00" - Core0 Temperature
SNMPv2-SMI::enterprises.30503.1.6.1 = STRING: "2547.00" - Fan speed
SNMPv2-SMI::enterprises.30503.1.5.3 = STRING: "30.00" - Motherboard
SNMPv2-SMI::enterprises.30503.1.5.4 = STRING: "42.00" - Hard Disk

I use value ($core0 + $core1)/2 for green graph and Fan speed for blue line, but converted to revolution per second. My XP have ip adress 10.0.0.2
Script create small temporary file /tmp/xp_thermal.log

Code: Select all

core0=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.6 | awk -F'"' '{ print $2 }'`
core1=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.7 | awk -F'"' '{ print $2 }'`
fan=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.6.1 | awk -F'"' '{ print $2 }'`
echo $core0 $core1 |awk '{print ($1 + $2)/2}' > /tmp/xp_thermal.log
echo $fan |awk '{print $1/60}' >> /tmp/xp_thermal.log
echo `sysctl kern.boottime | awk '{ print $14 "-" $12 "-" $13}'` >> /tmp/xp_thermal.log
echo "Remote CPU Thermal State" >> /tmp/xp_thermal.log 


for hard disk and motherboard I use script without any conversions. It create temporary file /tmp/xp_thermal_hd.log

Code: Select all

echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.6 | awk -F'"' '{ print $2 }'` >  /tmp/xp_thermal_hd.log
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.7 | awk -F'"' '{ print $2 }'` >> /tmp/xp_thermal_hd.log
echo `sysctl kern.boottime | awk '{ print $14 "-" $12 "-" $13}'` >> /tmp/xp_thermal_hd.log
echo "Remote Hard Drive motherboard Thermal State" >> /tmp/xp_thermal_hd.log
Need small modification for undestanding in future. Add coments and script. Result.

Code: Select all

#!/bin/sh
##Local CPU and HardDrive temperature
echo `/usr/local/sbin/smartctl -a /dev/ada1 | grep Temperature | awk '{print $10}' | tail -n 1`> /tmp/thermal.log  
echo `/sbin/sysctl hw.acpi.thermal | awk '/temperature/ {print int($2)}'`>> /tmp/thermal.log
echo "Third Value" >> /tmp/thermal.log
echo "Forth Value" >> /tmp/thermal.log
###############################################
#Remote CPU temperature
core0=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.6 | awk -F'"' '{ print $2 }'`
core1=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.7 | awk -F'"' '{ print $2 }'`
fan=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.6.1 | awk -F'"' '{ print $2 }'`
echo $core0 $core1 |awk '{print ($1 + $2)/2}' > /tmp/xp_thermal.log
echo $fan |awk '{print $1/60}' >> /tmp/xp_thermal.log
echo `sysctl kern.boottime | awk '{ print $14 "-" $12 "-" $13}'` >> /tmp/xp_thermal.log
echo "Remote CPU Thermal State" >> /tmp/xp_thermal.log
##################################################
# Remote hard disk and Motherboard temperature
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.6 | awk -F'"' '{ print $2 }'` >  /tmp/xp_thermal_hd.log
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.7 | awk -F'"' '{ print $2 }'` >> /tmp/xp_thermal_hd.log
echo `sysctl kern.boottime | awk '{ print $14 "-" $12 "-" $13}'` >> /tmp/xp_thermal_hd.log
echo "Remote Hard Drive motherboard Thermal State" >> /tmp/xp_thermal_hd.log
##################################################
# MRTG update
env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
echo "`/bin/date`::  mrtg executed " >> /var/log/mrtg.log
From webgui System|Advanced|Cron|Edit run now script 4-5 times for create all files in working folder
rebuilt and copy index.php

Code: Select all

cd   /usr/local/etc/mrtg
indexmaker mrtg.cfg > index.php
cp index.php /mnt/data/app/mrtg/
In this step - that all.
UPD from 22.10.2012
All? Not all. I made a mistake and started messing around with the charts .. Now, after all building work, I have to tidy up my network and computers. :(
But everything was fine before. :shock:
I begin from properly pictures and Legends.
Last edited by alexey123 on 22 Oct 2012 09:27, edited 1 time in total.
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: SNMP + MRTG on Nas4Free

#9

Post by alexey123 » 22 Oct 2012 09:27

It was brilliant idea - substitute System Up Time for remote computer by taking it to the local server. Also good idea - wrote Remote Hard Drive motherboard Thermal State instead remote host name. Image

Observe WinXP boot time:

Code: Select all

snmpget -v 2c -c public 10.0.0.2 .1.3.6.1.2.1.25.1.1.0
Observe WinXp host name

Code: Select all

snmpget -v 2c -c public 10.0.0.2 .1.3.6.1.2.1.1.5.0
Nas4free System boot time

Code: Select all

snmpget -v 2c -c public 10.0.0.1 .1.3.6.1.2.1.1.3.0
Nas4free host name

Code: Select all

snmpget -v 2c -c public 10.0.0.1 .1.3.6.1.2.1.1.5.0
And script for mrtg measurement from extended comand

Code: Select all

#!/bin/sh
##Local CPU and HardDrive temperature
echo `/usr/local/sbin/smartctl -a /dev/ada1 | grep Temperature | awk '{print $10}' | tail -n 1`> /tmp/thermal.log
echo `/sbin/sysctl hw.acpi.thermal | awk '/temperature/ {print int($2)}'`>> /tmp/thermal.log
echo `/usr/local/bin/snmpget/snmpget -v 2c -c public 10.0.0.1 .1.3.6.1.2.1.1.5.0 | awk '{print $4}'` >> /tmp/thermal.log
echo `/usr/local/bin/snmpget/snmpget -v 2c -c public 10.0.0.1 .1.3.6.1.2.1.1.3.0 | awk -F')' '{ print $2 }'` >> /tmp/thermal.log
#Remote
# Define start variables
echo "0" > /tmp/xp_thermal.log
echo "0" >> /tmp/xp_thermal.log
echo "Stopped" >> /tmp/xp_thermal.log
echo "Remote XP" >> /tmp/xp_thermal.log
echo "Remote XP" >> /tmp/xp_thermal.log
echo "0" > /tmp/xp_thermal_hd.log
echo "0" >> /tmp/xp_thermal.log
echo "Stopped" >> /tmp/xp_thermal.log
echo "Remote XP" >> /tmp/xp_thermal.log
#Remote CPU temperature
core0=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.6 | awk -F'"' '{ print $2 }'`
core1=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.7 | awk -F'"' '{ print $2 }'`
fan=`/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.6.1 | awk -F'"' '{ print $2 }'`
echo $core0 $core1 |awk '{print ($1 + $2)/2}' > /tmp/xp_thermal.log
echo $fan |awk '{print $1/60}' >> /tmp/xp_thermal.log
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 .1.3.6.1.2.1.1.3.0 | awk -F')' '{ print $2 }'` >> /tmp/xp_thermal.log
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 .1.3.6.1.2.1.1.5.0 | awk '{print $4}'` >> /tmp/xp_thermal.log

# Remote hard disk and Motherboard temperature
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.4 | awk -F'"' '{ print $2 }'` >  /tmp/xp_thermal_hd.log
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 1.3.6.1.4.1.30503.1.5.3 | awk -F'"' '{ print $2 }'` >> /tmp/xp_thermal_hd.log
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 .1.3.6.1.2.1.1.3.0 | awk -F')' '{print $2}'` >> /tmp/xp_thermal_hd.log
echo `/usr/local/bin/snmpget -v 2c -c public 10.0.0.2 .1.3.6.1.2.1.1.5.0 | awk '{print $4}'` >> /tmp/xp_thermal_hd.log
# MRTG ask
env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
echo "`/bin/date`::  mrtg executed " >> /var/log/mrtg.log
After editing result.
Image

Installed software
net-snmp - used command line tools only
mrtg http://oss.oetiker.ch/mrtg/

Example link with pictures MRTG http://freebsd.quip.cz/ext/2012/2012-02 ... rtg-12-15/
Disk monitoring with MRTG http://freebsd.quip.cz/ext/2012/2012-02 ... _disk.html
disk average duration of transactions can detect problemly disk with random fault

The end with MRTG
You do not have the required permissions to view the files attached to this post.
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

User avatar
alexey123
Moderator
Moderator
Posts: 1563
Joined: 19 Aug 2012 08:22
Location: Israel, Karmiel
Contact:
Status: Offline

Re: SNMP + MRTG on Nas4Free

#10

Post by alexey123 » 08 Mar 2013 07:53

Hmmmm
I don't understand nothing
For my graphs I used net-snmp - without any problem. But when I tried migrate to bsnmptools I receive in syslog messages about not properly work.
Example:
I run command
/usr/bin/bsnmpwalk -v 2c -s udp::public@10.0.0.1 sysName.0
and receive into log message
Image
When I run some command but from net-snmp

Code: Select all

snmpwalk -v 2c -c public 10.0.0.1 sysName.0
I not receive message into syslog.
My problem is: If I use bsnmptool,( I want use it :!: ) , my system log will filled only bsnmp messages, I cannot find any another.

I search over google - any info not finded. Result for me - or redirect bsnmptool messages to another log, or compose command for bsnmpwalk without message. I want use bsnmpwalk or bsnmpget

Anybody can help me?
Home11.0.0.4 - Sayyadina (revision 4249)/ x64-embedded on SAPPHIRE Pure Mini E350 / 8G RAM / UPS Ippon Back Power Pro 600
Lab 10.2.0.2 - Prescience (revision 2545) /x64-embedded on Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz / H61M-DS2 / 4G RAM / UPS Ippon Back Power Pro 600
New XigmanasXigmaNAS version 11.2.0.4.6026 on x64-embedded on AMD A8-7600 Radeon R7 A88XM-PLUS/ 16G RAM
TEST1 11.0.0.4 - Pilingitam (revision 4333) bpi-embedded on Allwinner a20 / 1015MiB RAM

Post Reply

Return to “SNMP”