Review the server-side agent configuration file examples to learn how to apply monitoring configurations across your environment.
After you create the configuration files, they can serve as templates that can be shared, updated, and used with automation tools to standardize, maintain, and update monitoring configurations as required.
For more information, see the Monitor Like a Pro With Server-Side Configuration article on the Rackspace Blog.
- Agent plugin check
- CPU check with alarm
- Filesystem check; alarm
- Load average check; no alarm
- Memory check; alarm
- MySQL check; alarm
- Network check; no alarms
Agent plugin check
This example agent plugin check YAML file for server-side agent configuration, shows how to setup a script, “Test-LatencyServer2Server.sh”, to run with 2 parameters, 10.10.10.123
and destination.com
, passed on its command-lines.
Note
YAML arrays, list, and sequences, such as the one shown in args
in the following example, require a comma-separated list inside the square brackets. Although passing a space-separated list seems intuitively correct, the result is a single argument passed to the script specified by file
.
type : agent.plugin
label : Server to Server Latency Test Script
disabled : false
period : 60
timeout : 30
details :
file : Test-LatencyServer2Server.sh
args : [10.10.10.123,destination.com]
alarms :
status :
label : Server to Server Latency Test
notification_plan_id : npXXXXXX
criteria : |
if (metric[‘destination_response_time'] > 80) `
{ return new AlarmStatus(CRITICAL, 'The network latency is greater than 80ms'); }
return new AlarmStatus(OK, 'Network latency is normal');
CPU check with alarm
This example YAML file for server-side agent configuration creates a CPU check with alarm, file name: “cpu.yaml”.
type : agent.cpu
label : CPU
period : 60
timeout : 10
alarms :
cpu-usage:
label: CPU usage
notification_plan_id: npXXXXXXXX
criteria: |
if (metric['usage_average'] > 95) {
return new AlarmStatus(CRITICAL, 'CPU usage is
#{usage_average}%, above your critical threshold of 95%');
}
if (metric['usage_average'] > 90) {
return new AlarmStatus(WARNING, 'CPU usage is
#{usage_average}%, above your warning threshold of 90%');
}
return new AlarmStatus(OK, 'CPU usage is #{usage_average}%,
below your warning threshold of 90%');
Filesystem check; alarm
This example YAML file for server-side agent configuration creates a filesystem check for the root filesystem with alarm, file name: “filesystem.yaml”.
type : agent.filesystem
label : Filesystem - /
period : 60
timeout : 10
details :
target : /
alarms :
disk-size:
label: Usage on /
notification_plan_id: npXXXXXXXX
criteria: |
if (percentage(metric['used'], metric['total']) > 90) {
return new AlarmStatus(CRITICAL, 'Disk usage is above
90%,
#{used} out of #{total}');
}
if (percentage(metric['used'], metric['total']) > 80) {
return new AlarmStatus(WARNING, 'Disk usage is above 80%,
#{used} out of #{total}');
}
Load average check; no alarm
This example YAML file for server-side agent configuration creates a load average check without an alarm, file name: “loadavg.yaml”.
type : agent.load_average
label : Load average
period : 60
timeout : 10
Memory check; alarm
This example YAML file for server-side agent configuration creates a memory check with alarm with an alarm, file name: “memory.yaml”.
type : agent.memory
label : Memory
period : 60
timeout : 10
alarms :
actual-memory-usage:
label: Memory usage
notification_plan_id: npXXXXXXXX
criteria: |
if (percentage(metric['actual_used'], metric['total']) > 90)
{
return new AlarmStatus(CRITICAL, "Memory usage is above
your
critical threshold of 90%");
}
if (percentage(metric['actual_used'], metric['total']) > 80)
{
return new AlarmStatus(WARNING, "Memory usage is above your
warning threshold of 80%");
}
return new AlarmStatus(OK, "Memory usage is below your
warning
threshold of 80%");
MySQL check; alarm
This example YAML file for the MySQL server-side replication check creates a check with an alarm, file name: “mysql_replication.yaml”.
Note
The monitor user (“raxmon”) needs the REPLICATION CLIENT grant in MySQL.
type : agent.mysql
label : mysql_replication
period : 60
timeout : 10
disabled: false
details:
host: 192.168.100.1
port: 3306
username: raxmon
password: your_password_here
alarms :
MySQL-replication:
label: MySQL replication check
notification_plan_id: npTechnicalContactsEmail
criteria: |
if (metric['replication.slave_sql_running'] != "Yes") {
return new AlarmStatus(CRITICAL, 'Replica SQL thread is not
running with error number #{replication.last_errno} . ');
}
if (metric['replication.slave_io_running'] != "Yes") {
return new AlarmStatus(CRITICAL, 'Replica IO thread is not
running with error number #{replication.last_io_errno} and
error message #{replication.last_io_error}.');
}
return new AlarmStatus(OK, "Replica SQL and I/O threads are
running");
Network check; no alarms
This example YAML file for server-side agent configuration creates a network check without alarms, file name: network.eth0.yaml
.
type : agent.network
label : Network - eth0
period : 60
timeout : 10
details :
target : eth0