.. _linux-server-tutorial: Part 2: Configuring checks in your first GNU/Linux node ======================================================= In :doc:`01` a simple linux node with basic checks has been set up, now more checks will be defined and customized. The operations to performa re the following: + Execute the CLI in interactive mode to define a GNU/Linux node to monitor and launch the monitoring activity. .. sourcecode:: python $ bin/sanet-cli Welcome to SANET sanet# con t sanet(config)# node localhost Creating node localhost Notice: sync localhost sanet(config-node)# category server-linux Warning: dependson not resolvable for localhost::server-linux:cpuperc-hr Warning: dependson not resolvable for localhost::server-linux:loadavg Warning: dependson not resolvable for localhost::server-linux:nonidle-ucd Warning: dependson not resolvable for localhost::server-linux:ramperc-ucd sanet(config-node)# icon host sanet(config-node)# Notice: sync localhost Notice: sync localhost sanet(config)# exit sanet# exit $ sudo SANET_HOME=$SANET_HOME etc/rc.sanet start + Launch the developement web server (NOT to be used on deployed installations!) and check that everything is working fine by opening the URL printed in output with your browser: .. sourcecode:: python $ etc/rc.sanet web Validating models... 0 errors found Django version 1.0.2 final SVN-2223, using settings 'sanet.settings' Development server is running at http://scoppola:7777/ Quit the server with CONTROL-C. .. _linux-server-customize-tutorial: Adding targets and measures to node ```````````````````````````````````` + Define checks parameters and aassociate them to the node using the CLI: .. sourcecode:: python sanet(config)# node localhost sanet(config-node)# target gora category storageperc Creating target gora of target-category storageperc in node localhost sanet(config-node-target)# parameter storage_descr "Spazio di disponibile per archiviare i backup" sanet(config-node-target)# parameter storage_re ^/mnt/gora$ sanet(config-node-target)# sanet(config-node)# measure gora category storage gora already exists in localhost but is a target sanet(config-node)# measure gora-graph category storage Creating measure gora-graph of measure-category storage in node localhost sanet(config-node-measure)# parameter storage_descr "Spazio di disponibile per archiviare i backup" sanet(config-node-measure)# parameter storage_re ^/mnt/gora$ sanet(config-node-measure)# sanet(config-node)# Notice: sync localhost + Add the node www.labs.it to the present installation: .. sourcecode:: python sanet# conf t sanet(config)# node www.labs.it Creating node www.labs.it Notice: sync www.labs.it sanet(config-node)# category node-reach Notice: sync www.labs.it sanet(config) + Let's have a look at the available target categories, looking for something we might use. .. sourcecode:: python sanet(config-node)# sh categories target-categories NAME ID KIND SOURCE DESCRIPTION ----------------------------------- ------ ------- ------- ---------------------------------------------------------------------------------------------------- adjacent 1 target library Check that the linked interface is really connected to this cpuperc-hr 2 target library CPU occupation (1 min average) threshold, via hrProcessorLoad, absent from old net-snmp agents fullduplex 3 target library Full duplex check for an ethernet interface iferrs 4 target library Interface errors threshold loadavg-threshold-ucd 5 target library Load average threshold, 5 min average, as reported by net-snmp via ucd-mib nonidle-ucd 6 target library CPU nonidle percentage threshold, with ucd mib for Linux. Percentage can be >100 for more CPUs. operstatus 7 target library Interface ifOperStatus, usually OK when the LED on the panel is green proc-hr 8 target library Presence of a process in the table, with hrmib ramperc-netsnmp 18 target library RAM usage threshold, for nodes with net-snmp ramperc-ucd 9 target library RAM usage threshold for Linux with net-snmp via ucdmb ramperc-ucd-nobc 10 target library RAM usage threshold with net-snmp via ucdmib, no buffers and cached, for non-Linux ramperc-windows 19 target library RAM usage threshold, for Windows nodes reach 11 target library This is the standard ICMP reachability check reach6 14 target library ICMP IPv6 reachability reach-crit 12 target library ICMP reachability check for critical devices reach-server 13 target library ICMP reachability check for servers reboot 15 target library Check for reboots, by verifying that sysUptime goes upwards. Compensate for sysUptime wraparounds. reboot-hr 16 target library Check for server reboots, by verifying that hrSystemUptime goes upwards. Compensate for wraparounds. storageperc 17 target library HR storage occupation threshold, percent swapperc-netsnmp 20 target library SWAP usage threshold, for nodes with net-snmp swapperc-ucd 22 target library SWAP usage threshold for Linux with net-snmp via ucdmb tcpport 23 target library TCP port reachability url-positivematch 24 target library URL content matches urlregex, target UP if matches vmemperc-windows 21 target library Virtual memory (ram+swap) usage threshold, for windows nodes sanet(config-node)# sh categories target-categories tcpport NAME  : tcpport ID  : 23 KIND  : target: Verify a true or false condition SOURCE  : library: Defined in the library that comes with the program DESCRIPTION  : TCP port reachability PARENT  : USED_PARAMETERS : deleted, dependson, descr, minperiod, shorttries, suspended, times, title, email, expr, flap_damp_limit, flap_half_life, flap_penalty, flap_undamp_limit, maxtries, msg_downbody, msg_downlog, msg_downsubj, msg_faillog, msg_upbody, msg_uplog, msg_upsubj, primary, uncheckable_fallback, upemail, port REFERENCED_FROM : BOUND PARAMETERS: expr: isTcpOpen($node,$port) maxtries: 1 minperiod: 600 msg_downbody: (%N %T down) La porta TCP $tcpport di $node non e' piu' disponibile. (%m, tries %n) %s msg_downsubj: %T down: porta $tcpport non disponibile su $node msg_upbody: (%N %T up) La porta TCP $tcpport di $node e' di nuovo disponibile. (%m) %s msg_upsubj: %T up: porta $tcpport di nuovo disponibile su $node shorttries: 5 title: Raggiungibilita' porta TCP $tcpport BOUND WITH NO VALUE: port + Change the email address used for sending notifications of DOWN and UP state changes for the TCP port 80 reachability check .. sourcecode:: python sanet(config-node)# target tcpport Creating target tcpport of target-category tcpport in node www.labs.it sanet(config-node-target)# parameter port 80 sanet(config-node-target)# sanet(config-node)# Notice: sync www.labs.it Notice: sync www.labs.it sanet(config)# sh targets node www.labs.it PATH ID NODE IFACE DS STATUS LASTDONE ------------------------------------ ------ ----------- ----- -- ------ ---------- www.labs.it::node-reach:reach-server 37 www.labs.it UP 1242393940 www.labs.it:::tcpport 38 www.labs.it UU 0 sanet(config)# node www.labs.it sanet(config-node)# target tcpport sanet(config-node-target)# sh targets path www.labs.it:::tcpport PATH  : www.labs.it:::tcpport ID  : 38 DESCRIPTION  : TCP port reachability LASTDONE  : 2009-05-15 15:27:40 LASTCONFIG  : 2009-05-15 15:25:34 MINPERIOD  : 600 DELETED  : False DEPENDSON  : Raggiungibilita' ICMP (www.labs.it::node-reach:reach-server) TIMES  : all SHORTTRIES  : 5 THREAD  : 2 SUSPENDED  : False SUSPEND_TIME  : 0 SUSPEND_REASON  : SUSPEND_AUTO_RESUME : 0 NODED  : www.labs.it IFACE  : None CATEGORY  : tcpport EXPR  : isTcpOpen($node,$port) STATUS  : UP STATUSLAST  : UU VERBSTATUS  : up: isTcpOpen(www.labs.it,80): OK, connected to 85.41.212.67 port 80,isTcpOpen($node,$port) expands to True LASTCHANGE  : 2009-05-15 15:27:41 PRIMARY  : False PENALTY  : 0 DAMPENED  : False EMAIL  : netwarning UPEMAIL  : sanet(config-node-target)# email fero@pdp.linux.it Unrecognized command sanet(config-node-target)# parameter email fero@pdp.linux.it sanet(config-node-target)# parameter upemail fero@pdp.linux.it sanet(config-node)# Notice: sync www.labs.it Notice: sync www.labs.it sanet(config)# sh targets path www.labs.it:::tcpport PATH  : www.labs.it:::tcpport [cut] EMAIL  : fero@pdp.linux.it UPEMAIL  : fero@pdp.linux.it To learn the basics of how to setup the monitoring of a Microsft Windows node step ahed in :doc:`03`.