XYMONGREP(1)
π XYMONGREP π
okay bestie so xymongrep is a lil command from the Xymon fam, and its whole thing is picking out lines in hosts.cfg β¨ it's a manual page from the General Commands Manual, and it's giving "small tool, huge main character energy" π
β¨ SYNOPSIS β¨
xymongrep --help
xymongrep --version
xymongrep [--noextras] [--test-untagged] [--web] [--net]
[--loadhostsfromxymond] TAG [TAG...]
like. that's the whole vibe check right there π¦
πΈ DESCRIPTION πΈ
so xymongrep(1) is literally made for extension scripts β the ones that need to pick out the entries in a hosts.cfg file that actually matter to them π
here's the tea: the utility takes test names as parameters, then parses the hosts.cfg file and prints out the host entries that have at least one of the wanted tests. and listen β tags can be given with a trailing asterisk '*', so for example "xymongrep http*" is what you need to find all the http and https tags. iykyk β
also? xymongrep fully supports "include" directives inside the hosts.cfg file, and it will find matching tags in all the included files. no host left behind fr fr π«Ά
and if the DOWNTIME or SLA tags are used in the hosts.cfg(5) file, those get interpreted relative to the current time. xymongrep then outputs an "INSIDESLA" or "OUTSIDESLA" tag, which makes it way easier for scripts that wanna check if the current time is inside or outside the expected uptime window π
π OPTIONS π
--noextrasβ removes the"testip","dialup","INSIDESLA"and"OUTSIDESLA"tags from the output. decluttered, periodt π--test-untaggedβ okay so when you're using theXYMONNETWORKenvironment variable to test only hosts on a particular network segment,xymonnetwill ignore hosts that don't have any"NET:x"tag. so only hosts that have aNET:$XYMONNETWORKtag will be tested. with this option tho? hosts with noNET:tag are included in the test, so that all hosts that either have a matchingNET:tag, or noNET:tag at all, are tested π--no-down[=TESTNAME]βxymongrepwill query the Xymon server for the current status of the"conn"test, and if TESTNAME is specified, also for the current state of that specified test. if the status of the"conn"test for a host is non-green, or the status of the TESTNAME test is disabled, then this host is ignored and will not be included in the output. so it's the "pls don't bother me about hosts that are down" option, or hosts where the custom test is disabled π--webβ search thehosts.cfgfile following include statements as a Xymon web-server would π¦--netβ search thehosts.cfgfile following include statements as when runningxymonnetπΏ--loadhostsfromxymondβ normallyxymongrepattempts to load theHOSTSCFGfile by itself when searching for lines to transmit, and if the file is unreadable, it will exit out. with this option, it will query thexymondserver (set via theXYMONSERVERenvironment) for the hosts file. this is the move if you're running this on a client or remote system and can't β or don't wanna β have thehosts.cfgfile synchronized across your servers π₯
π« EXAMPLE π«
say your hosts.cfg file looks like this:
192.168.1.1 www.test.com # ftp telnet !oracle
192.168.1.2 db1.test.com # oracle
192.168.1.3 mail.test.com # smtp
and you have a custom Xymon extension script that performs the "oracle" test. then running "xymongrep oracle" would yield:
192.168.1.1 www.test.com # !oracle
192.168.1.2 db1.test.com # oracle
so the script can quickly find the hosts that are of interest. slay β¨
note bestie: the reverse-test modifier β "!oracle" β is included in the output! this also applies to the other test modifiers defined by Xymon (the dial-up and always-true modifiers). don't get caught out by that one π
if your extension scripts use more than one tag, just list all of the interesting tags on the command line. easy π«Ά
xymongrep also supports the "NET:location" tag used by xymonnet, so if your script performs network checks then it will see only the hosts that are relevant for the test location that the script currently executes on. chef's kiss π
π§ USE IN EXTENSION SCRIPTS π§
to integrate xymongrep into an existing script, look for the line in the script that grep's in the $HOSTSCFG file. typically it will look somewhat like this:
$GREP -i "^[0-9].*#.*TESTNAME" $HOSTSCFG | ... code to handle test
instead of the grep, we will use xymongrep. it then becomes:
$XYMONHOME/bin/xymongrep TESTNAME | ... code to handle test
which is simpler, less error-prone and more efficient. the glow-up is real ππ
π ENVIRONMENT VARIABLES π
XYMONNETWORKβ if set,xymongrepoutputs only lines fromhosts.cfgthat have a matchingNET:$XYMONNETWORKsetting πHOSTSCFGβ filename for the Xymonhosts.cfg(5)file π
π FILES π
$HOSTSCFGβ the Xymonhosts.cfgfile β
π SEE ALSO π
hosts.cfg(5), xymonserver.cfg(5) π¦
okay that's the whole page bestie, go forth and grep responsibly π β¨
Xymon β Version 4.3.30, dated 4 Sep 2019, and yeah this is the XYMONGREP(1) page, mwah ππ
π¦ where this page comes from
- debian bookworm: xymon-client 4.3.30-1+b2 Β· GPL-2.0-only WITH OpenSSL exception
- debian trixie: xymon-client 4.3.30-4 Β· GPL-2.0-only WITH OpenSSL exception
- ubuntu jammy: xymon-client 4.3.30-1build2 Β· GPL-2.0-only WITH OpenSSL exception
- ubuntu jammy: xymon-client 4.3.30-1ubuntu0.1 Β· GPL-2.0-only WITH OpenSSL exception
- ubuntu noble: xymon-client 4.3.30-2build3 Β· GPL-2.0-only WITH OpenSSL exception
- ubuntu noble: xymon-client 4.3.30-2ubuntu0.1 Β· GPL-2.0-only WITH OpenSSL exception
- ubuntu questing: xymon-client 4.3.30-4
- ubuntu resolute: xymon-client 4.3.30-5 Β· GPL-2.0-only WITH OpenSSL exception
- ubuntu stonking: xymon-client 4.3.30-6 Β· GPL-2.0-only WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms