GithubHelp home page GithubHelp logo

bonomani / devmon Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 7.0 2.29 MB

Devmon is an open-source SNMP monitoring tool that can graph and alert several hundreds of devices per minutes

License: GNU General Public License v2.0

Perl 97.63% Shell 1.55% C 0.82%
monitoring snmp xymon

devmon's People

Contributors

bonomani avatar lionrouge avatar roemer2201 avatar stefcoene avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

devmon's Issues

Improve logging

  • Improve the logging which is not bad, but can be improved to debug easier

Implement a way to track "changes"

Dear All,

I would like to change the guest column from the vmware-esxi6 test so that it goes yellow if a change happens like, a vm is powered off, has [dis]appeared (probably vMotion). Can someone give me a hint, what transforms or thresholds can be used for this. The only thing I came up with is the "DELTA" transform, but I think it is only for numerical values.

Thank you in advance!

Regards

Force overwrite clear status

Dear all,

I'm writing a template where, depending on the devices physical configuration, some OIDs (leaf, not branch) might be empty. As soon as this happens, the test becomes white saying "No data.". I've tried many many configurations to force devmon to overwrite the clear status for that OID with green, but I have not found any working solution. Is this even possible? If so, how?

Thank you in advance!

Regards

Oliver

Encrypt all commmications from and to Devmon

Encryption is a must have feature and requirement for most customers

Status:

A. Polling

  1. Pretest of device connectivity (verify the xymon 'conn')
    • done with raw socket: Workaround Stunnel
    • We could add other test like ssh...or none?
  2. SNMPv3: Done

B. Devmon to xymon:

  1. Send msg to xymon: WIP: Workaround Stunnel (see bellow)
  2. Retrieve hosts.cfg: WIP: workaround (see bellow)

C. Devmon to devmon: (Sync) WIP: Workaround Stunnel (see bellow)

Xymon also support xymoncgimsg.cgi which depends on http server. Also as this use curl or wget this option can pass proxies easely.

Stunnel Configuration

Encypting the Traffic between Xymon Client and Server
From: https://salsa.debian.org/debian/xymon/blob/master/debian/README.encryption

If you want to encrypt the reporting traffic between Xymon client and
server, you can use stunnel (Debian package stunnel4).

Besides the normal stunnel configuration, you need the according
tunnel entries in /etc/stunnel/stunnel.conf.

(If you like, you can also use a different names for the connection,
e.g. xymons or a differnt port number, but 1983 seems the proper
"not yet 1984" port number. Of course, the port number should be the
same on client and server side.)

Stunnel Client Side Configuration

[bbs]
accept  = 127.0.0.1:1984
connect = <your-xymon-server>:1983
client = yes

Stunnel Server Side Configuration

[bbs]
accept = 1983
connect = 1984

Further documentation

See the section
Encryption and Tunnelling
in the
Administration Guide for System Monitoring with Xymon
at Wikibooks for a more detailed (and not Debian-specific)
documentation.

Retrieve hosts.cfg

  1. Detect changes on hosts.cfg xymon
  • Best inotify: immediate detection
  • Xymon analysis and alerts: see (devmon/extra/reload_devmon_if_hosts.cfg_changed.README)
  1. Transmit to devmon (no needed if xymon and devmon are on the same server)
  • Use rsync, scp (ssh) or other combined with script or cron
    ...
  1. Reload devmon
  • Included if you are on the same machine (see: devmon/extra/reload_devmon_if_hosts.cfg_changed.README)

Now more and more people required encryption

Experimental keys on scalar is now forbidden at ...dm_snmp.pm

I am installing "devmon" to add snmp monitoring to Xymon and when i try to run ".../devmon/devmon --readbbhosts" i get the following "Error":

Experimental keys on scalar is now forbidden at .../devmon/modules/dm_snmp.pm line 818.
Type of arg 1 to keys must be hash or array (not hash element) at .../devmon/modules/dm_snmp.pm line 818, near "} ) "
Experimental keys on scalar is now forbidden at .../devmon/modules/dm_snmp.pm line 820.
Type of arg 1 to keys must be hash or array (not hash element) at .../devmon/modules/dm_snmp.pm line 820, near "} )"
Compilation failed in require at .../devmon/devmon line 21.
BEGIN failed--compilation aborted at .../devmon/devmon line 21 (#1)
(F) An experimental feature added in Perl 5.14 allowed each, keys,
push, pop, shift, splice, unshift, and values to be called with a
scalar argument. This experiment is considered unsuccessful, and
has been removed. The postderef feature may meet your needs better.

Uncaught exception from user code:
Experimental keys on scalar is now forbidden at .../devmon/modules/dm_snmp.pm line 818.
Type of arg 1 to keys must be hash or array (not hash element) at .../devmon/modules/dm_snmp.pm line 818, near "} ) "
Experimental keys on scalar is now forbidden at .../devmon/modules/dm_snmp.pm line 820.
Type of arg 1 to keys must be hash or array (not hash element) at .../devmon/modules/dm_snmp.pm line 820, near "} )"
Compilation failed in require at .../devmon/devmon line 21.
BEGIN failed--compilation aborted at .../devmon/devmon line 21._

The details of my devmon installation are as follows:

  • The latest devmon version: 0.22.06.
  • A single-node server installation.
  • The same server as the Xymon server (v4.3.28).
  • Perl version: v5.28.1.

I have been googling but I have not been able to find a solution... could you give me a hand?

Thank you very much in advance

Updating hosts.db fails while doing "readbbhosts" and using SNMPv3 ( no v3 entries made )

  • Please use the ๐Ÿ‘ to show that you are affected by the same issue.
  • Subscribe to receive notifications on status change and new comments.

Describe the bug

While doing "devmon -vvv --readbbhosts", the SNMPv3 enabled hosts will not be validated and added to hosts.db

Manual snmpwalk with right/same credentials on device works

If it can help you you can fill the template below

Steps to reproduce

  1. Adding device to Xymon hosts.cfg, including "devmon" tag for a SNMPv3 enabled device ( SNMP v1/v2 disabled !! )
  2. Remove hosts.db and run "devmon -vvv --readbbhosts"
  3. Verify hosts.db for device entry

Expected behaviour

Expect hosts.db to contain an entry similar to:
"device"_A^["ip-address"^[161^[xymon_host^[brocade^[SANswitch^[3^[^["username"^[noAuthNoPriv^[^[^[^[^[all^[^[
or
"device"^["ip-address"^[161^[xymon_host^[brocade^[SANswitch^[3^[^["username"^[authPriv^[^[^[^[^[all^[^[
(

Both are from hosts.db after modified dm_snmp.pm,but with different devmon.cfg. First is default devmon.cfg, second is modified as below

SECLEVELS=authPriv
AUTHPROTOS=SHA
PRIVPROTOS=AES
###SECLEVELS=noAuthNoPriv,authNoPriv,authPriv
###AUTHPROTOS=,MD5,SHA
###PRIVPROTOS=,DES,AES

Actual behaviour

hosts.db do not get updated, hence devices won't populate into configuration.

Screenshots

No screenshots, but some logging..

Server configuration

Operating system:
Linux is-storaged-a.oneadr.net 3.10.0-1160.49.1.el7.x86_64

Xymon version:
Xymon version 4.3.28

Perl version:
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 44 registered patches, see perl -V for more detail)

Devmon version:
devmon-v0.21.08.13

Additional context

==== Initial ===
No hosts.db file
No modification in dm_snmp.pm or devmon.cfg

SECNAMES="username"
AUTHPASSS=,"password"
PRIVPASSS=,"password"

###SECLEVELS=noAuthNoPriv,authNoPriv,authPriv
###AUTHPROTOS=,MD5,SHA
###PRIVPROTOS=,DES,AES

DEBUG INFORMATION:
INFOR CONF: Net-SNMP is installed and provides SNMPv2c and SNMPv3
INFOR CONF: SNMP_Session is installed and provides SNMPv1
INFOR CONF: Reading hosts.cfg
INFOR CONF: 34 new host(s) left, trying cid:'"community"' and snmp v2
ERROR SNMP(1): Bulkwalk timeout: 40[sec] (Timeout=20 * (1 + Retries=1))
ERROR SNMP(1): Bulkwalk timeout: 40[sec] (Timeout=20 * (1 + Retries=1))
ERROR SNMP(1): Bulkwalk timeout: 40[sec] (Timeout=20 * (1 + Retries=1))
INFOR CONF: 3 new host(s) left, trying secname:'"username"', seclevel:'noAuthNoPriv', authproto:'', authpass:'', privproto:'', privpass:'' and snmp:v3
ERROR SNMP(1): Cannot do bulkwalk: Unsupported security level (-34)
ERROR SNMP(1): Cannot do bulkwalk: Unsupported security level (-34)
ERROR SNMP(1): Cannot do bulkwalk: Unsupported security level (-34)
INFOR CONF: 3 new host(s) left, trying secname:'"username"', seclevel:'authNoPriv', authproto:'MD5', authpass:'"password"', privproto:'', privpass:'' and snmp:v3
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
INFOR CONF: 3 new host(s) left, trying secname:'"username"', seclevel:'authNoPriv', authproto:'SHA', authpass:'"password"', privproto:'', privpass:'' and snmp:v3
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
INFOR CONF: 3 new host(s) left, trying secname:'"username"', seclevel:'authPriv', authproto:'MD5', authpass:'"password"', privproto:'DES', privpass:'"password"' and snmp:v3
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
INFOR CONF: 3 new host(s) left, trying secname:'"username"', seclevel:'authPriv', authproto:'MD5', authpass:'"password"', privproto:'AES', privpass:'"password"' and snmp:v3
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
INFOR CONF: 3 new host(s) left, trying secname:'"username"', seclevel:'authPriv', authproto:'SHA', authpass:'"password"', privproto:'DES', privpass:'"password"' and snmp:v3
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
INFOR CONF: 3 new host(s) left, trying secname:'"username"', seclevel:'authPriv', authproto:'SHA', authpass:'"password"', privproto:'AES', privpass:'"password"' and snmp:v3
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
ERROR SNMP(1): Cannot do bulkwalk: Authentication failure (incorrect password, community or key) (-35)
INFOR CONF: 3 new host(s) left, trying cid:'"community"' and snmp v1
ERROR SNMP: snmpget "device1" (no response received)
ERROR SNMP: snmpget "device2" (no response received)
ERROR SNMP: snmpget "device3" (no response received)
INFOR CONF: DBFILE: "path"/devmon-v0.21.08.13/hosts.db
INFOR CONF: Fork with pid 27614 received signal TERM, shutting down with return code 0

No entry in hosts.db about device, v3

=== modify dm_snmp.pm ===
No hosts.db file
modification in devmon.cfg and dm_snmp.pm right after line 800 - hardcoded credentials like:
$snmpvars{SecName} = ""username"";
$snmpvars{SecLevel} = "authPriv";
$snmpvars{AuthProto} = "SHA";
$snmpvars{AuthPass} = "password";
$snmpvars{PrivProto} = "AES";
$snmpvars{PrivPass} = "password";

SECNAMES="username"
AUTHPASSS=,"password"
PRIVPASSS=,"password"

SECLEVELS=,authPriv
AUTHPROTOS=,SHA
PRIVPROTOS=,AES

DEBUG INFORMATION:
INFOR CONF: Net-SNMP is installed and provides SNMPv2c and SNMPv3
INFOR CONF: SNMP_Session is installed and provides SNMPv1
INFOR CONF: Reading hosts.cfg
INFOR CONF: 34 new host(s) left, trying cid:'"community"' and snmp v2
INFOR CONF: 3 new host(s) left, trying secname:'"username"', seclevel:'noAuthNoPriv', authproto:'', authpass:'', privproto:'', privpass:'' and snmp:v3
INFOR CONF: Valid new host:"device1", trying secname:'"username"', seclevel:'noAuthNoPriv', authproto:'', authpass:'', privproto:'', privpass:'' and snmp:v3
INFOR CONF: Valid new host:"device2", trying secname:'"username"', seclevel:'noAuthNoPriv', authproto:'', authpass:'', privproto:'', privpass:'' and snmp:v3
INFOR CONF: Valid new host:"device3", trying secname:'"username"', seclevel:'noAuthNoPriv', authproto:'', authpass:'', privproto:'', privpass:'' and snmp:v3
DEBUG CONF: Sending data to SNMP
DEBUG SNMP(1): Got EOF in message, attempting to thaw
DEBUG SNMP(1): SNMP session started: Device="device1", RemotePort=161, DestHost="ip", Version=3
DEBUG SNMP(1): Swap oid type repeaters:1->0 non-repeaters:0->1 for device "device1"
DEBUG SNMP: Fork 1 has data for device "device1", reading it
DEBUG SNMP: Fork 1 returned complete message for device "device1"
DEBUG SNMP: Dethawing data for "device1"
DEBUG SNMP(1): Got EOF in message, attempting to thaw
DEBUG SNMP(1): SNMP session started: Device="device2", RemotePort=161, DestHost="ip", Version=3
DEBUG SNMP(1): Swap oid type repeaters:1->0 non-repeaters:0->1 for device "device2"
DEBUG SNMP: Fork 1 has data for device "device2", reading it
DEBUG SNMP: Fork 1 returned complete message for device "device2"
DEBUG SNMP: Dethawing data for "device2"
DEBUG SNMP(1): Got EOF in message, attempting to thaw
DEBUG SNMP(1): SNMP session started: Device="device3", RemotePort=161, DestHost="ip" Version=3
DEBUG SNMP(1): Swap oid type repeaters:1->0 non-repeaters:0->1 for device "device3"
DEBUG SNMP: Fork 1 has data for device "device3", reading it
DEBUG SNMP: Fork 1 returned complete message for device
DEBUG SNMP: Dethawing data for "device3"
INFOR CONF: DBFILE: "path"/devmon-v0.21.08.13/hosts.db
INFOR CONF: Fork with pid 50348 received signal TERM, shutting down with return code 0

hosts.db file updated correct with all 3 devices

Devmon log (/var/log/devmon.log)

Devmon log
Insert your Devmon log here

Implement SNMPv3

There is currently a WIP on this subject, mainly based on the idea/implementation of coec

  • Improve speed of current implementation of coec (using bulkwalk): WIP
    • Current implementation by coec is 3x slow (in my tests), but for small environnement it is ok. As a proof of concept it's perfect
    • Current WIP, show that SNMP.pm can afford a probably a X2 gain over current and X8 from the one by coec.
    • Algorythm is now defined (after 3 failed attempt) and successfully acheive the polling for complex template (cisco-asa, huawei, vmware). So just a question of time...
  • Resolve bug of current implementation of coec (huawei oid polling undefined)
  • Keep existing SNMP Pure perl implementation for snmpv1 and 2: DONE
  • Auto-discover protocole: DONE
    Remarks:
  • Based on SNMP.pm from perl CPAN
    • Rhel and debian package exists
    • Compatibility with FreeBSD probably not implemented as difficult to test (need help)

Stable Fork?

Bonomani,

I was just about to do a new devmon install and came across this repository. I see you've been making some changes and wonder if you consider the changes as committed to be stable.

The last update to the code on sourceforge was about 3 years ago.

Parsing DEVMON: tag for cid() ip() port() and model() sometimes remove the following separator

  • Please use the ๐Ÿ‘ to show that you are affected by the same issue.
  • Subscribe to receive notifications on status change and new comments.

Describe the bug

The devmon program, when run in "--readbbhosts" mode, incorrectly parses the DEVMON: tag from hosts.cfg.

Example: DEVMON: tag has model(cisco),cid(public),ip(10.0.0.161), then the comma after cid() is stripped before parsing, causing the model() and ip() options to be merged into model(cisco)ip(10.0.0.161) without the comma. Subsequent parsing detects the model() option, but the ip() option is not recognised due to there being no comma having being stripped by the code that detects cid().

Devmon logs the message:

2023-10-09T11:00:13.759+1100|ERROR|config |30898|1778|Unknown devmon option (ip(10.0.0.161)) on line 2 of /etc/xymon/hosts.cfg

If cid() is the last entry, then this problem doesn't occur, because there are no commas after it.

Other options (ip(), port(), model()) have the same problem, in that they impact some options that follow them, because they parse/strip the options list in the same way.
ย 

If it can help you you can fill the template below

Steps to reproduce

  1. Create an entry in hosts.cfg that works correctly with a DEVMON: tag.
  2. Add a cid() option and an ip() option to the end of the DEVMON: tag.
  3. Run devmon with the "--readbbhosts" and "-debug" options, and search for "ERROR" entries, and see that the program bails with the error Unknown devmon option (ip(10.0.0.161))

Expected behaviour

The cid() option should work anywhere in the DEVMON tag.

Actual behaviour

The cid() option when not used last, can affect some options that follow.

Screenshots

If applicable, add screenshots to help explain your problem.

Server configuration

RHELv7.9

Xymon v4.3.30

Perl v5.16.3

Devmon v0.22.06 (code has not changed in Github version)

Additional context
Add any other context about the problem here.

Devmon log (/var/log/devmon.log)

Devmon log
2023-10-09T11:00:13.759+1100|ERROR|config   |30898|1778|Unknown devmon option (ip(10.0.0.161)) on line 2 of /etc/xymon/hosts.cfg

Rendering the best transform is wrong

The problem arrives when:
If we use the best transform and 1 oid is yellow and 1 is red, the page render "red" which is wrong.
(This is also observerd in the original code from sourceforge)

The problem is due to a missbehaviour of the rendering code of a page for the best transform

Workaround: do not use {oid.color} for each oid in the best transform, use only {bestoid.color}

Move work-in-progress code to development branch

The published versions of the Perl modules do contain large chunks of dead code, often labeled in a comment section as 'work in progress' (WIP). Please remove those dead code sections from the published, main branch and move them into a development branch.

"Undefined" state reported

Dear Bonomani,

there is another difference between legacy devmon and the version from this fork. We have a template for the Cisco 2960X series as an example, but other template show the same behavior. The new devmon reports a lot of "NaN", probably caused by division by zero or maybe due to division by "null"/"nil" (basically empty value). Unfortunately the devmon trace does not show any error messages, so I think, it's "working as designed". These are screenshots from new devmon:

2022-04-06_10h05_53
2022-04-06_10h06_23
2022-04-06_10h06_45

On the old devmon querying the same device with the same template the result looks like this:
2022-04-06_10h49_07
2022-04-06_10h49_26
2022-04-06_10h50_07

My guess is there is something different now with the MATH oder DELTA transform, please have a look at the transform file from the template:

# cat transforms 
# Get bit speed delta (so we dont have to provide custom delta limit)
ifInOps         : DELTA         : {ifInOctets}
ifOutOps        : DELTA         : {ifOutOctets}
# Convert our octets delta into bits per second
ifInBps         : MATH          : {ifInOps} x 8
ifOutBps        : MATH          : {ifOutOps} x 8
# Do delta transform on all error counters
ifInEps		: DELTA		: {ifInErrors}
ifOutEps	: DELTA		: {ifOutErrors}
# Perform error to traffic percentage calculations
ifInErrPct	: MATH		: ({ifInEps} / {ifInBps}) x 100
ifOutErrPct	: MATH		: ({ifOutEps} / {ifOutBps}) x 100
# Create an alias in a bracketed box, or nothing if alias is blank
ifAliasBox      : REGSUB        : {ifAlias} /(\S+.*)/ [$1]/

Then interesting part is, that the ports showing the NaN / undefined messages are in state "admin down". (The exeption files for this template is the same on both devmon versions.)

I can provide further details, if needed, like trace logs.

Regards

EDIT1:

Changing from "auto" to "session" in dm_config.pm (line 246) shows the same behavior.

SNMPTIMEOUT is in devmon.cfg but has been renamed to SNMP_MAX_TIMEOUT in code

Describe the bug

The file devmon.cfg has this section (near the end of the file):

# SNMPTRIES: Number of attempts an SNMP query will make before it gives
# up.  More than 3 or so might be overkill here
# [DEFAULT: 2] (must be greater than 0)
#SNMPTRIES=2

When I set SNMPTRIES, devmon fails with this message:

Unknown option 'snmptries' in config file, line 167

I used this setting with a previous verison of devmon, so the code seems to have been changed.

If it can help you you can fill the template below

Steps to reproduce

  1. edit devmon.cfg and add SNMPTRIES=2
  2. run devmon
  3. inspect logfile to see message about unknown option

Expected behaviour

Adding config option according to comments that describe it in the configuration file should produce the described behaviour.

Actual behaviour

Adding config option according to comments that describe it in the configuration file causes devmon to fail.

Server configuration

OS RHELv7

Xymon version: v4.3.30
Perl version:

Devmon version: current devmon-main branch

Devmon log (/var/log/devmon.log)

Devmon log
2024-03-07T13:36:14.089+1100|FATAL|config   |46026|1381|Unknown option 'snmptries' in config file, line 167

On the line of the Xymon/Devmon itself, in the dm test, counter of clear data is not working

On the line of the Xymon/Devmon itself we have a "dm" test (for DevMon)

  • Counter of clear data is not working in the โ€œdmโ€ test (also if the SourceForge version)
  • Only one reference in the code: for my $dev (keys %{$g{'cleardata'}}) {

Clear means that we don't have data, it can be because of a problem. If it's a problem, these data can be interesting, even more, if

  • We have an historical view, graph
  • We have other indicators
  • We have the type of the errors

Current trends: We keep for now

[PERL] dm_config.pm Experimental keys on scalar is now forbidden

  • Please use the ๐Ÿ‘ to show that you are affected by the same issue.
  • Subscribe to receive notifications on status change and new comments.

Describe the bug

# ./devmon -vvv --readbbhosts
Experimental keys on scalar is now forbidden at /usr/lib/xymon/server/ext/devmon/modules/dm_config.pm line 734.
Type of arg 1 to keys must be hash or array (not hash element) at /usr/lib/xymon/server/ext/devmon/modules/dm_config.pm line 734, near "} ) "
BEGIN not safe after errors--compilation aborted at /usr/lib/xymon/server/ext/devmon/modules/dm_config.pm line 2740.
Compilation failed in require at ./devmon line 20.
BEGIN failed--compilation aborted at ./devmon line 20.

Server configuration

Operating system:

Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm

Xymon version:

#apt show xymon
Package: xymon
Version: 4.3.30-1+b2
Priority: optional
Section: net
Source: xymon (4.3.30-1)

Perl version:

# perl --version

This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-linux-gnu-thread-multi
(with 52 registered patches, see perl -V for more detail)

Devmon version:
latest : https://github.com/bonomani/devmon

Add a NTP test

Some clock information like the uptime is currently in the CPU (cpu_dm) test.

  • Create a new test or add it to CPU?
  • And how to manage when NTP is not running?

Some pages are rendering witch color "clear" and where green with the code from sourceforge

This devmon code introduce a change that should be adapted

Behaviour: Some pages are rendering with color "clear" with "undefined" error message
Excepted: Green

The problem arrives when:
We use the 'math' transform and a division / by an num oid when it is 0: this is not a number anymore
This was introcduce by a change in the code so that the result of a div by 0:

  • The result 0 (orignal code) is replace in the code by NaN (which is correct asnwer)
  • The color change from 'green' to 'clear'

The solution is to override the alarm in the 'threshold' file template
{oid_of_the_math_trans} : clear: NaN :

Remark: The message is empty, but defined! this will not raised any alamed....for NaN values....

Related problem

  1. The problem was also due to a missbehaviour of the rendering code of a page for the best transform: see best transform issue #13 (resolved in current master)

  2. In some case (as the division by zero) we know the problem and we would like to have a specific message for it. We also need to have a way if the color is not overriden, the 'clear' color raised an alarm and an error message: we would like to have a specific error for that case

  • Alarme not raised if message is empty but still if it not defined!(note the : at the end)
    • Empty: {oid_of_the_math_trans} : clear: NaN :
    • Not defined: {oid_of_the_math_trans} : clear: NaN
  • Possibility to have multiple threshold lines with different messages

Add option to align columns in a table to the right side

By default the columns in a table generated by Devmon are aligned to the left side. Some columns become more readable if the content is aligned to the right side, for instance if it only contains a number with a fixed number of decimals right to the decimal point. The following changes will implement this option:

--- dm_tests.pm	2023-09-01 11:21:50.451118647 +0200
+++ dm_tests.pm.new	2023-09-06 13:32:47.694530154 +0200
@@ -2701,11 +2701,14 @@
 
             # Replace our separaters with html
             if ( defined $t_opts{nonhtml} ) {
+                $line =~ s/\|>/|/g;     # Remove right-align indicator
                 $line =~ s/\|/:/g;
             } elsif ( defined $t_opts{plain} ) {
+                $line =~ s/\|>/|/g;     # Remove right-align indicator
                 $line =~ s/\|/ /g;
             } else {
                 $line =~ s/\|/<\/td><td>/g;
+                $line =~ s/td>>/td align='right'>/g;
             }
 
             # Make the first oid (from left to right) the primary one

--- TEMPLATES.md	2023-09-06 12:59:58.813101684 +0200
+++ TEMPLATES.md.new	2023-09-06 13:07:54.433372896 +0200
@@ -1064,6 +1064,7 @@
 
  -<begin file------------------------------
 
+      TABLE:
       Ifc name|Ifc speed|Ifc status
       {ifName}{ifAliasBox}|{ifSpeed}|{ifStat.color}{ifStat}{ifStat.errors}
 
@@ -1078,7 +1079,11 @@
  Devmon basically just builds an HTML table out of the repeater data. It can
  have an optional header, which should be specified on the line immediately
  after the 'TABLE:' tag. If no table header is desired, the line after the
- table tag should be the row data identifier.
+ table tag should be the row data identifier. The column separator in the
+ header line is a '|'. By default the content of a column will be left
+ aligned. If the content should be aligned on the right side, use '|>' rather
+ than '|' as the separator. Note that the leftmost column cannot be right
+ aligned in this way.
 
  The row data identifier is the one that contains one or more data aliases.
  The first of these aliases is referred to as the 'primary' alias, and must be

Note: the diff above also solves a small error in the description of the TABLE: directive.

Implement Special Tests

Brainstorming information (should be consolidated in a more globale view)

  1. Ability to perform test on multiple host

    • For example: Having a "root" device spanning tree domain (SPT) that is elected from multiple devices
      • (But all routing protocols could benefit from this kind of feature)
    • For example: Having a cluster devices (active/standby):
      • Xymon supported with ipv4 ip address 0.0.0.0
      • 0.0.0.0 involve a DNS resolution to make test
      • 0.0.0.0 hosts accept message from multiple ips
      • But there are some limit:
        • IPv6 not supported (nor mix IPv4 and 6)?
        • How do we control the cluster and its members
        • Member can change (in a round-robin manner or other)
  2. Having a (fake) test on a fake device could be used to test all features of DEVMON (transforms, error propagation ...) to create a spec. This would mainly help developpers, but can also give some hints if something fails for others

  3. Current proposal: use fake host (as it is not a host) with:

    • 0.0.0.0 for IP address
    • ".test" as top domain extension as this is a special purpose domain that do will never be used for production on the Internet (As it is used for testing purpose)
      • (local|localhost).test is current proposal, so it it self explantory name and test can be: I prefer localhost as it tell us that a sub name is on localhost...which is true.
      • regsub.localhost.test or best.localhost.test

Spanning Tree Protocol Test

I implemented a first approach for a Spanning Tree Protocol test. It goes yellow if the last spanning tree topology change is younger than 3 minutes. This might need to be adjusted depending on the polling cycle of devmon.

The purpose of this is to help identify package flooding caused by STP topology changes.

On the Cisco IOS CLI one can see the origin, where the STP-TC (topology change) came from. Unfortunately I could not find an OID holding that information. Can you help out here?

Thank you in advance.

I created a branch in my fork, can you please check it out? https://github.com/roemer2201/devmon/tree/SpanningTreeProtocol

Devmon Tag for excluding certain tests in hosts.cfg

Hello!

As far as I can see there is only a tag for running certain tests from a template, but not the other way around. I would like to filter out certain tests. This might come in handy for systems with a modular approach, where certain OIDs do not exist until a hardware module is plugged in.

Would be nice to hear back from you!

Regards

Query Limit of 100 Leaf OIDs?

Dear Bonomani,

yesterday we installed the most current version of devmon from this fork on a xymon/devmon test system. There we ran into a strange issue: We got some custom templates for some liquid cooling devices in the servers room. The OIDs there are dynamically generated by the way single components are connected to the controlling motherboard. Because of that, almost every rack needs its own template. The behavior also prevents the use of OID branches, this is why i created a template with around 130 leaf OIDs.

Now the current devmon is stuck at 100% CPU for the main process (not the forks), as soon as one of these templates is involved in the query. The fork which actually does the query crashes with this message:

[22-03-15@16:05:16] INFOR SNMP(1): Do bulkwalk
Can't use an undefined value as an ARRAY reference at
	/usr/local/devmon/modules/dm_snmp.pm line 992, <__ANONIO__> line 21 (#1)
    (F) A value used as either a hard reference or a symbolic reference must
    be a defined value.  This helps to delurk some insidious errors.
    
Uncaught exception from user code:
	Can't use an undefined value as an ARRAY reference at /usr/local/devmon/modules/dm_snmp.pm line 992, <__ANONIO__> line 21.
	dm_snmp::snmp_bulkwalk(HASH(0x8028c9ab0), HASH(0x8021eb378), 0) called at /usr/local/devmon/modules/dm_snmp.pm line 832
	dm_snmp::fork_sub(1) called at /usr/local/devmon/modules/dm_snmp.pm line 525
	dm_snmp::fork_queries() called at /usr/local/devmon/modules/dm_snmp.pm line 210
	dm_snmp::snmp_query(HASH(0x8021bd6d8)) called at /usr/local/devmon/modules/dm_snmp.pm line 176
	dm_snmp::poll_devices() called at /usr/local/devmon/devmon line 44
[22-03-15@16:05:16] DEBUG SNMP: Fork 1 has data for device Lampertzzelle_GEL_CMC, reading it
[22-03-15@16:05:31] ERROR SNMP: Fork HASH(0x8034237b0), pid 14581 stalled on device Lampertzzelle_GEL_CMC: Timeout waiting for EOF from fork
. Killing this fork.
[22-03-15@16:05:31] ERROR SNMP: Sending 1 TERM signal failed: No such process

My collegue and me nailed it down to the following. The actual query seem to happen at line 952 in dm_snmp.pm:
my @nrresp = $session->bulkwalk( $$nrep_count, $$oid_count, $nrvars );
This line can't run properly as soon as the oids file in a template contains more than 100 leaves. For debugging purposes we dropped a debug line before 992 like this, showing us the variables used in the loop:
do_log( "VBARR LOOP oid:$oid poid:$polled_oid vbarr_counter:$vbarr_counter foo:$foo", 0 );
The log then shows the following results:

[22-03-15@16:05:16] INFOR SNMP(1): Do bulkwalk
[22-03-15@16:05:16] VBARR LOOP oid:.1.3.6.1.2.1.1.1.0 poid:.1.3.6.1.2.1.1.1 vbarr_counter:0 foo:1
Can't use an undefined value as an ARRAY reference at
	/usr/local/devmon/modules/dm_snmp.pm line 994, <__ANONIO__> line 21 (#1)
    (F) A value used as either a hard reference or a symbolic reference must
    be a defined value.  This helps to delurk some insidious errors.
...

The foo Variable only contains a 1 as soon as there are more than 100 leaves in the template. This means, that the array @nrresp is broken somehow with 101 or more leaves. Can you guess, why there is the limit of 100 and where it comes from? A strict 100 cannot be found anywhere in the code, so it must be limited by accident.

Thank you for your help!

Server configuration

Operating system:
FreeBSD 12.3-RELEASE-p1 GENERIC amd64

Xymon version:
4.3.30

Perl version:
perl 5, version 32, subversion 1 (v5.32.1) built for amd64-freebsd-thread-multi

Devmon version:
v0.21.09

dm_snmp::DiveRef: Can't use string ("X") as a HASH ref while "strict refs" in use

Describe the bug

When I query a host of mine on a specific OID, devmon crashes with the following errors. I ran the command /usr/local/devmon/devmon -vvvvv -f -m host=dora -m test=temp --o=xymon://stdout -1.

2023-11-05T09:59:19.914+0100|INFO |snmp     |2911300| 165|Querying snmp oids on dora for tests temp
2023-11-05T09:59:19.914+0100|DEBUG|snmp     |2911300| 644|Starting fork number 1
2023-11-05T09:59:19.919+0100|DEBUG|snmp     |2911300| 662|Fork number 1 started with pid 2911305
2023-11-05T09:59:19.919+0100|DEBUG|snmp(1)  |2911305| 673|Fork 1 using sockets GLOB(0xaaaae08730f8) <-> GLOB(0xaaaae08730c8) for IPC
2023-11-05T09:59:19.920+0100|DEBUG|snmp(1)  |2911305| 675|Fork 1 closing socket (child 1) GLOB(0xaaaae08730f8)
2023-11-05T09:59:19.923+0100|DEBUG|snmp(1)  |2911305| 742|Got EOF in message, attempting to thaw
Can't use string ("5") as a HASH ref while "strict refs" in use at
	/usr/local/devmon/modules/dm_snmp.pm line 2273, <__ANONIO__> line 13 (#1)
    (F) You've told Perl to dereference a string, something which
    use strict blocks to prevent it happening accidentally.  See
    "Symbolic references" in perlref.  This can be triggered by an @ or $
    in a double-quoted string immediately before interpolating a variable,
    for example in "user @$twitter_id", which says to treat the contents
    of $twitter_id as an array reference; use a \ to have a literal @
    symbol followed by the contents of $twitter_id: "user \@$twitter_id".
    
Uncaught exception from user code:
	Can't use string ("5") as a HASH ref while "strict refs" in use at /usr/local/devmon/modules/dm_snmp.pm line 2273, <__ANONIO__> line 13.
	dm_snmp::DiveRef(HASH(0xaaaae00ebc98), SCALAR(0xaaaae08b9bf8), SCALAR(0xaaaae08b9880), SCALAR(0xaaaae08bd3f8), SCALAR(0xaaaae08bbc70), SCALAR(0xaaaae08bbc10), SCALAR(0xaaaae08bb340), SCALAR(0xaaaae08b99a0), ...) called at /usr/local/devmon/modules/dm_snmp.pm line 2159
	dm_snmp::deeph_insert_oidval_h("1.3.6.1.4.1.8072.1.5.3.1.2.1.3.6.1.2.1.4.24.4:60", HASH(0xaaaae00ebc98)) called at /usr/local/devmon/modules/dm_snmp.pm line 1391
	dm_snmp::fork_sub(1) called at /usr/local/devmon/modules/dm_snmp.pm line 680
	dm_snmp::fork_queries() called at /usr/local/devmon/modules/dm_snmp.pm line 284
	dm_snmp::snmp_query(HASH(0xaaaadfdd2d90)) called at /usr/local/devmon/modules/dm_snmp.pm line 202
	dm_snmp::poll_devices() called at /usr/local/devmon/devmon line 47
2023-11-05T09:59:20.114+0100|DEBUG|snmp     |2911300| 316|Fork:1 has data for device:dora, reading it
^C2023-11-05T09:59:20.846+0100|INFO |config   |2911300|2790|Master received signal INT, shutting down with return code 0
2023-11-05T09:59:20.846+0100|INFO |config   |2911300|2802|Shutting down

The OID is .1.3.6.1.4.1.8072.1.3.2.4.1.2.7.99.112.117.116.101.109.112.1, which translates into NET-SNMP-EXTEND-MIB::nsExtendOutLine."cputemp".1. The host is running Linux ("LibreElec" distribution: SNMPv2-MIB::sysDescr.0 = STRING: Linux dora 4.19.127 #1 SMP Tue Jul 6 19:08:37 CEST 2021 armv7l).

Steps to reproduce

  1. Have a Linux "LibreElec" and temperature sensors activated (should be the same with any Linux / Net-SNMP).
  2. Have an adequate template:
find templates/libreelec-rpi/temp templates/libreelec-rpi/specs -type f -exec echo "FILE {}:" \; -exec cat {} \;

FILE templates/libreelec-rpi/temp/transforms:
cpuTempValue: REGSUB : {cpuTemp} /^(\d+).*$/$1/
gpuTempValue: REGSUB : {gpuTemp} /^(\d+).*$/$1/
FILE templates/libreelec-rpi/temp/thresholds:
cpuTempValue : red     : >90 : CPU Boiling
cpuTempValue : yellow  : >80 : CPU Heating
gpuTempValue : red     : >90 : GPU Boiling
gpuTempValue : yellow  : >80 : GPU Heating
FILE templates/libreelec-rpi/temp/exceptions:
FILE templates/libreelec-rpi/temp/oids:
cpuTemp: .1.3.6.1.4.1.8072.1.3.2.4.1.2.7.99.112.117.116.101.109.112.1  :leaf
gpuTemp: .1.3.6.1.4.1.8072.1.3.2.4.1.2.7.103.112.117.116.101.109.112.1 :leaf
FILE templates/libreelec-rpi/temp/message:
{cpuTempValue.color}cpu: {cpuTempValue} &deg;C
{gpuTempValue.color}gpu: {gpuTempValue} &deg;C
FILE templates/libreelec-rpi/specs:
vendor	: Raspberry Pi
model	: LibreELEC
snmpver	: 2
sysdesc : Linux dora 4.19.127 #1 SMP Tue Jul 6 19:08:37 CEST 2021 armv7l
  1. Run /usr/local/devmon/devmon -vvvvv -f -m host=dora -m test=temp --o=xymon://stdout -1.

Expected behaviour

Get the answer:

2023-11-05T10:57:06.801+0100|INFO |tests    |2914504|  61|Performing tests
2023-11-05T10:57:06.801+0100|DEBUG|tests    |2914504| 112|Starting test for temp on device dora
2023-11-05T10:57:06.802+0100|DEBUG|tests    |2914504| 329|Doing regsub transform on dora/gpuTempValue
2023-11-05T10:57:06.804+0100|DEBUG|tests    |2914504| 162|64
2023-11-05T10:57:06.804+0100|DEBUG|tests    |2914504| 329|Doing regsub transform on dora/cpuTempValue
2023-11-05T10:57:06.805+0100|DEBUG|tests    |2914504| 162|64
2023-11-05T10:57:06.806+0100|DEBUG|tests    |2914504|2281|Rendering temp message for dora
2023-11-05T10:57:06.807+0100|DEBUG|msg      |2914504|  35|Running send_msgs()
2023-11-05T10:57:06.807+0100|INFO |msg      |2914504|  52|Sending 1 messages to 'xymon://stdout'
status dora.temp green Sun Nov  5 10:57:06 2023

&green cpu: 64 &deg;C
&green gpu: 64 &deg;C


<a href='https://github.com/bonomani/devmon'>Devmon 0.23.09</a> running on astrea
2023-11-05T10:57:06.807+0100|DEBUG|config   |2914504| 700|Running time_test()

Actual behaviour

Crash with stackstrace above.

Server configuration

Operating system:

The target host is running Linux "LibreElec" distribution: SNMPv2-MIB::sysDescr.0 = STRING: Linux dora 4.19.127 #1 SMP Tue Jul 6 19:08:37 CEST 2021 armv7l.

The master host is running Linux Debian "Bookworm" distribution.

Xymon version:

4.3.30

Perl version:

5.36.0

Devmon version:

latest (2023-11-04)

Additional context

The error seems to tell that the function DiveRef() is certain that, on its line 26, $$sv is a hash. In my case it's not, it's a scalar. I can slightly alter the dm_snmp.pm code and get a functionning software: before line 26 I test if $$sv is a hash. But my patch is not a corrective patch but a quick workaround. It seems the error is elsewhere, but I cannot find it (I didn't understand the logic used to dive into SNMP keys and values with the functions deeph_insert_oidval_h() and similar).

Patch to make code work:

--- modules/dm_snmp.pm.orig	2023-11-05 10:43:05.166882587 +0100
+++ modules/dm_snmp.pm	2023-11-05 10:43:54.250826093 +0100
@@ -2267,7 +2267,9 @@
         {
             $sv = \$$sv->[$key];
         } else {
-            $sv = \$$sv->{$key};
+            if (ref $$sv eq ref {}) {
+                $sv = \$$sv->{$key};
+            }
         }
     }
     return $sv;

Work under RHEL8

This occurs under Perl 5.26.

[root@xymon devmon]# ./devmon
Experimental keys on scalar is now forbidden at /usr/local/devmon/modules/dm_templates.pm line 907.
Type of arg 1 to keys must be hash or array (not hash element) at /usr/local/devmon/modules/dm_templates.pm line 907, near "};"
Experimental keys on scalar is now forbidden at /usr/local/devmon/modules/dm_templates.pm line 1068.
Type of arg 1 to keys must be hash or array (not private variable) at /usr/local/devmon/modules/dm_templates.pm line 1068, near "$deps) "
Compilation failed in require at /usr/local/devmon/modules/dm_config.pm line 29.
Compilation failed in require at ./devmon line 23.
BEGIN failed--compilation aborted at ./devmon line 23.
[root@xymon devmon]#

Suggested patch is (sorry I can't clone):
--- /usr/local/devmon/modules/dm_templates.pm.orig 2020-02-03 08:34:17.551832749 +0800
+++ /usr/local/devmon/modules/dm_templates.pm 2020-02-03 08:33:01.471034309 +0800
@@ -904,7 +904,7 @@
}
sub calc_template_test_deps {
my $tmpl = $_[0];

  • my @Oids = keys $tmpl->{oids};
  • my @Oids = keys %{$tmpl->{oids}};
    my $deps = {} ;
    my $infls = {} ;
    my %trans_data ; #for sort from W. Nelis
    @@ -1065,7 +1065,7 @@
    my $node;

    Precompute number of deps

  • foreach $node (keys $deps) {
  • foreach $node (keys %{$deps}) {
    $nb_deps{$node} = keys %{$deps->{$node}};
    $nb_infls{$node} = keys %{$infls->{$node}};
    }

templatebuilder.pl error

Hello Team,

I have a strange issue with the templatebuilder.pl in devmon/extras/ folder.
When going to use it to create a template for one Asus Switch , receiving this output error:
./templatebuilder.pl -cpublic -v2c 10.10.10.10
Modification of non-creatable array value attempted, subscript -1 at ./templatebuilder.pl line 46.

Any help will be much appreciated.

Thank you in advance!

SNMP tests flakey on HPE Proliant Gen9 and above

Hi

using Xymon and devmon, the SNMP tests for HPE Proliant Gen9 are mostly clear, only occasionally green. These work fine on our Gen5,6,7 servers (I thought we had some 8's but we don;t).

snmpwalk always succeeds.

Thanks

Document new features

  • Smart threshold with muliple error msg (DONE!)
  • Negative test (DEVMON:notests(test1,test2) (DONE!)
  • "colored" automatch
  • Error and Alarms propagation (DONE!)
  • Review all the docs: (DONE)
  • Document Coltre transform
  • Document SORT Transform
    To sort in an increasing order oid values (txt only by now). The result (the new oid values) are
    integer (from 1 to n, n is the number of element in the branch oid ) indexes corresponding to the position of the source
    It can be used to 'reindex' an oid if use in conjonction with the CHAIN transform. (similar to the INDEX transform)

And add samples...

Howto graph vmware template data

Dear All,

I just found this repository and I was very happy, that someone continues working on devmon!

I got the "vmware-esxi6" working for me an I was wondering, how I can graph the data. In the message files I found lines like this:
"TABLE:rrd(DS:ds0:hrProcessorLoad:GAUGE; )"

What do I need to add/edit in Xymons configuration files in order to make the rrd graphing work?

Thank you for your help!

Regards

Add new Transform Features

We would like to add a line in a table like the average of CPU in the first row
We could do something like the following...just ideas!

CPU SORT by index (if not incresing by +1) ADD LEAF() INDEX MATH (INDEX+1) % COUNT(CPU) +1 CHAIN (MATH,ADD)
1.1.1.1 10 x 1 x 1 x 1 1 1 2 1 AVG CPU
1.1.1.1 20 y 2 z 2 y 2 2 2 3 2 x
1.1.1.1 30 x 3 z 3 z 3 3 3 4 3 y
4 AVG CPU 4 4 4 1 4 z

A little bit complex....a simpler solution could be to have:
An ADD transform with at-pos(0.1)
And a SORT transform with numerical (only alpha now) sorting and precision 1, ...need also a padding (auto?) because of Xymon limitation

ADD Function
argument

  1. non-repeters at position default is end
  2. non-repeters other?
  3. Repetes

SORT Function
Sort by val
Sort by key is a function composition:

OID INDEX SORT by val CHAIN(SORT by val,OID)
1.1.1.1 10 x 10 10 1 10 1 x
1.1.1.1 20 y 20 20 2 20 2 y
1.1.1.1 30 x 30 30 3 30 3 x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.