Home Directory Plugins Network Protocols DNS check_zone_record_value

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_zone_record_value

Rating
0 votes
Favoured:
0
Current Version
1,0,0
Last Release Date
2015-02-09
Compatible With
  • Nagios 3.x
License
GPL
Hits
10782
Files:
FileDescription
check_zone_record_valuecheck_zone_record_value
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Plugin designed to check value of some records of a zone by parsing the BIND zone file.
Best way to use it is call thisplugin from another bash script with all parameters to check, like this:

[root@nagios-devel:~]# cat /usr/lib64/nagios/plugins/check_zone_record_value_-_contingencia_e-test.com.br
#!/bin/bash

/usr/lib64/nagios/plugins/check_zone_record_value \
\
-c 1
-f '/var/named/chroot/dbfiles_external_contingencia/db/e-test.com.br.zone' \
\
--ns ns1.test.com.br.
--ns ns2.test.com.br.
--ns ns3.test.com.br.

--mx 0:etest-com-br0c.mail.protection.outlook.com.

--a 177.220.196.10
--a 193.21.234.24
--a acesso:10.153.109.153
--a acesso1:10.97.0.42
--a bandeirante:193.21.234.36
--a centraldeservicos:193.21.234.38
--a centralservicos:193.21.234.38
--a cob:193.21.234.14
--a cob-h:193.21.234.14
--a cobranca:193.21.234.27
--a ctt:193.21.234.34
--a execplan:193.21.234.48
--a ftp1:10.69.0.17
--a gbbd:193.21.234.39
--a ged:191.145.240.19
--a gestor:193.21.234.24
--a gestorp:193.21.234.39
--a imap:193.21.234.35
--a kacev2:193.21.234.53
--a mediaservices:193.21.234.30
--a metropolitana:193.21.234.36
--a mobile:193.21.234.24
--a mobilebanking:193.21.234.55
--a mobilectt:193.21.234.34
--a mobileib:193.21.234.24
--a mobileservices-homo:193.21.234.49
--a mobileservices-prod:193.21.234.45
--a nimsoft:193.21.234.51
--a orquestra:193.21.234.38
--a pep:193.21.234.31
--a perdiminhasenha:193.21.234.46
--a pop:193.21.234.35
--a portal:193.21.234.14
--a portalsc:193.21.234.14
--a portalv1:193.21.234.14
--a portalv2:193.21.234.14
--a sa:193.21.234.33
--a simuladores:193.21.234.14
--a sisda:193.21.234.24
--a sisdacob:193.21.234.24
--a siteubr:193.21.234.43
--a smtp:193.21.234.35
--a sobras:193.21.234.24
--a sop:193.21.234.23
--a sura:193.21.234.18
--a tecnobi:193.21.234.16
--a testnet:193.21.234.24
--a testnetp:193.21.234.24
--a vpn:193.21.234.10
--a vpnssl:193.21.234.31
--a vpnssl2:189.73.153.24
--a webmail:193.21.234.35
--a www:193.21.234.24

--cname autodiscover:autodiscover.outlook.com.
--cname lyncdiscover:webdir.online.lync.com.
--cname modulo:gbbd
--cname msoid:clientconfig.microsoftonline-p.net.
--cname sip:sipdir.online.lync.com.
--cname vulpecula:pep

--srv _sipfederationtls._tcp:1:100:5061:sipfed.online.lync.com.
--srv _sip._tls:1:100:443:sipdir.online.lync.com.

--txt '"v=spf1 include:spf.protection.outlook.com -all"'

---------------------------------------------------------

OK - Checked "66" records. None problem found.|"Total Checks"=66;;0; "Total Errors"=0;;0; "A Errors"=0;;0; "NS Errors"=0;;0; "MX Errors"=0;;0; "PTR Errors"=0;;0; "SRV Errors"=0;;0; "TXT Errors"=0;;0; "CNAME Errors"=0;;0;
[root@aquila:NS3:~]# bash /tmp/check_
check_read_only_fs
check_zone_record_value_-_contingencia_e-unicred.com.br

CRITICAL - Found "9" problems of "67" records checked: A (Errors: 5, Names: 189.25.88.24, ctt, metroolitana, mobilservices-prod, www), CNAME (Errors: 2, Names: modulo, si), SRV (Errors: 1, Names: sipdir.online.lync.com.), TXT (Errors: 1, Names: "v=spf1 iclude:spf.protection.outlook.com -all")|"Total Checks"=67;;0; "Total Errors"=9;;0; "A Errors"=5;;0; "NS Errors"=0;;0; "MX Errors"=0;;0; "PTR Errors"=0;;0; "SRV Errors"=1;;0; "TXT Errors"=1;;0; "CNAME Errors"=2;;0;

---------------------------------------------------------

[root@nagios-devel:~]# /usr/lib64/nagios/plugins/check_zone_record_value --help

Version:

Script : check_zone_record_value
Version : 1.0.0
Author : Otavio Gloria (og@e-trust.com.br)
Criation: 02/06/2015

Usage:

check_zone_record_value -[h|u|v] [--help|--usage|--version]
check_zone_record_value -f [-w|-c ] [-i]
check_zone_record_value -f --a|--ns|--mx|--ptr|--srv|--txt

Help:

Nagios plugin to check if some bind record has some value analizing a zone file.

Parameters:

-h|--help Show a help message.
-u|--usage Show how to use this plugin.
-v|--version Show plugin version.
-f|--file Path to bind zone file to be checked.
-w|--warning Warning threshold. Must be a integer.
-c|--critical Critical threshold. Must be a integer.
-i|--info Return just information state. Never alert.
--a Check A record type
--ns Check NS record type
--mx Check MX record type
--ptr Check PTR record type
--srv Check SRV record type
--txt Check TXT record type
--cname Check CNAME record type

Record checks data sytax:

--a ipv4
--a name:ipv4
--ns value
--ns name:value
--mx priority:value
--mx name:priority:value
--ptr ip:name
--srv priority:weight:port:value
--srv name:priority:weight:port:value
--txt 'text' (Must be between single quotes)
--txt 'name>:text' (Must be between single quotes)
--cname name:name

Data types:

IPv4 address like 192.168.10.4 or 29.167.41.254
Peace of IPv4 address like 154 or 249.10 or 9.78.151
Can be a single text string like web-server or www69
Can be a FQDN like test.com.br or exemplo.com.
Can be @ that represents $ORIGIN
Can be a single string like ns2 or srv-01
Can be a FQDN like test.com.br or mail.google.com.
A integer number only
A integer number only
A integer number only
Can be a string with space, igual, colon and quotes

Examples:

check_zone_record_value -f /var/named/zones/test.com.zone --a test:192.168.3.15 --cname www:webserver
check_zone_record_value -f /var/named/zones/test.com.zone --txt '@:v=spf1 include:spf.protection.outlook.com'
check_zone_record_value -f /var/named/zones/test.com.zone --mx 0:test.mail.protection.outlook.com.
check_zone_record_value -f /var/named/zones/test.com.zone --srv _sip._tls:1:100:443:sipdir.online.lync.com.
check_zone_record_value -f /var/named/zones/test.com.zone --ns ns1.test.com.
check_zone_record_value -f /var/named/zones/152-159.47.63.191.in-addr.arpa.zone --ptr 154:mail.test.com.

check_zone_record_value -f /var/named/zones/test.com.zone -w 1 -c 5
--ns ns1.test.com. --ns ns2.test.com. --mx 0:test.mail.protection.outlook.com.
--a ns1:139.15.68.27 --a ns2:159.95.37.231 --a test:192.168.3.15 --a smtp1:250.23.14.57
--a nagios:192.168.3.107 --a webserver:192.168.3. --cname www:webserver
--srv _sip._tls:1:100:443:sipdir.online.lync.com. --txt '@:"MS=ms89157621"'