Check Command: check_tcp
Service Parameters
NEMS Linux requires just one argument for the check_tcp check command: the port number to check.
Quick Use
Open NEMS NConf.
Click Services→Add.
Give it a friendly name.
Choose the Check Command “check_tcp”.
Set the notification period to 24/7.
Set your intervals and notification settings as normal.
Set ARG1 to the port number. Eg., 8080
Hit submit.
Then go generate your config and if you set your intervals correctly, all should be a-okay. If not, expand the error message to see where you went wrong.
Exercise
NEMS Linux includes a dummy port listener running on port 9590. The port listener is cleverly called 9590, and does nothing other than reply that it is up. This can be used to simulate a port on another device.
Let’s setup a service monitor on the NEMS host to warn us if port 9590 ever goes offline.
On the left menu of NConf, you’ll see “Services”. Click “Add”.
Set the Service Name to: 9590
Leave Service Enabled set to: Yes
Set the Check Command to: check_tcp
Set Assigned to Host to: NEMS (this host comes pre-installed)
Leave Check Period set to: 24×7
Set Notification Period to: 24/7
Leave Service Templates as is, none selected.
Under Contact Groups highlight the ‘admins’ group and press the arrow pointed right to move it to Selected Items.
Leave Notes, Notes and Action blank.
Set Max Check Attempts to: 5
Set Check Interval to: 30
Set Retry Interval to: 5
Set First Notification Delay to: 60
Set Notification Interval to: 90
Set Notification Options to: w,u,c,r,f,s
Leave Active Checking, Passive Checking, Notification Enabled, Check Freshness and Freshness Threshold blank.
Leave Assign Service to servicegroup as is, none selected.
Set Params for check command to the port number: 9590
Press Submit
Once the new config is running, try failing the service by opening Monit Service Manager, click on the Process named 9590, and then click “Stop service”. You’ll notice within 30 minutes the status of 9590 will show as a problem in all status views (Eg., NEMS TV Dashboard, NEMS Adagios, Nagios Core), and after 60 minutes you will receive a notification (assuming your notifications settings are configured).
Once you have received a notification, visit NEMS Adagios to Acknowledge the outage.
Then, return to Monit, open the 9590 Process, and click “Enable Monitoring”. This will re-load 9590 and you’ll soon see it change to a Recovered state.
Another fun experiment is to try changing your “First Notification Delay” on the NEMS:9590 service in NEMS NConf and disable it again.