Sponsored Content
Special Forums UNIX and Linux Applications Infrastructure Monitoring Searching for Saas Monitor service which monitor my servers which are sitting in different providers Post 303002116 by MadeInGermany on Thursday 17th of August 2017 05:04:49 PM
Old 08-17-2017
You can have a look at my Nagios plugins, also in this forum.
They are shell scripts; you can adapt their output for your needs.

The current output for Nagios consists of a text message and an exit status 0(OK), 1(WARNING), 2(CRITICAL), 3(UNKNOWN).
After the text message there can be a pipe symbol followed by a performance data sample.

Nagios runs the plugin scripts periodically, with arguments that are typically thresholds for WARNING and CRITICAL.
Nagios displays the output text and reacts on the output status (i.e. raises WARNING or CRITICAL alerts)..
And it records the performance data (in rrd tool). The Web GUI draws perfdata out of it.

For basic monitoring I recommend: check_load5.sh check_disks.sh check_vmem.sh
 

9 More Discussions You Might Find Interesting

1. HP-UX

Monitor Service Status

Hey guys how do you determined the status of a certain service if its running or not aside from using ps. (0 Replies)
Discussion started by: sbn
0 Replies

2. Shell Programming and Scripting

Script to monitor sun servers temperature

Dears, need help on developing a script to monitor sun server temperature , I'm using the below command to check the servers one by one /usr/platform/`uname -i`/sbin/prtdiag -v Servers Models are : 2 x Sun SPARC Enterprise M9000 Server 4 x Sun Fire V490 2 x Sun Blade T6300 Server... (1 Reply)
Discussion started by: bejo4ever
1 Replies

3. Shell Programming and Scripting

Memory Usage Monitor on Linux/SunOS Servers

ok, so i'm trying to write a shell script (not perl) that monitors memory usage on a server. but i'm confused as to what fields exactly determines that yes, memory is low on a particular server. it sounds simple enough, but it really isn't. what do I look for in the field below? ... (1 Reply)
Discussion started by: SkySmart
1 Replies

4. AIX

Monitor Physical CPU usage on multiple servers

Hello, Looking for some help. I am trying to gather data at each server showing when the physical CPU is being used the most based on a weekly timeframe. I know this data can be seen through NMON but with multiple servers in our environment it could take a real long time. is there a easier... (4 Replies)
Discussion started by: audis$
4 Replies

5. Shell Programming and Scripting

Basic script for monitor send mail service

Hi All Need help Can any one share a basic script that is used for monitor sendmail service whether online, offline.etc in solaris Thanks in advance Zimmy (5 Replies)
Discussion started by: zimmyyash
5 Replies

6. Shell Programming and Scripting

script to monitor different processes on different Unix servers

GM, Can you pls help how to write a script to monitor different processes on different unix servers and send the output to a /tmp/report file, earlier my boss asked me to write a script to monitor just one process running on different servers and send the output to a file so I wrote this exec... (0 Replies)
Discussion started by: baders
0 Replies

7. UNIX for Dummies Questions & Answers

Script to monitor BI service and trigger a mail

Hello friends, I am new to shell scripting.I am assigned a task in Unix to prepare a script which will check if OBI 10g services are running or not and to send email if the services are down.Any help will be appreciated. I tried searching for it in the blog and came across the following code ... (1 Reply)
Discussion started by: pradeep467
1 Replies

8. Linux

Packages that monitor OS configs and service/ports?

I have several Redhat servers and workstations that I need to be able to monitor for any changes and be notified of any changes to the OS. The features I need to specifically monitor are: ports - opening of new ports that are not already in a whitelist services - any starting or attempts to start... (1 Reply)
Discussion started by: JCDinPGH
1 Replies

9. HP-UX

Critical Sevices and Process to be monitor on UNIX servers

Need to note the list of critical / important services and process need to monitor on unix server always with one line explanation for severity. Thanks in advance. (5 Replies)
Discussion started by: marunmeera
5 Replies
Nagios::Plugin::Getopt(3pm)				User Contributed Perl Documentation			       Nagios::Plugin::Getopt(3pm)

NAME
Nagios::Plugin::Getopt - OO perl module providing standardised argument processing for Nagios plugins SYNOPSIS
use Nagios::Plugin::Getopt; # Instantiate object (usage is mandatory) $ng = Nagios::Plugin::Getopt->new( usage => "Usage: %s -H <host> -w <warning> -c <critical>", version => '0.1', url => 'http://www.openfusion.com.au/labs/nagios/', blurb => 'This plugin tests various stuff.', ); # Add argument - named parameters (spec and help are mandatory) $ng->arg( spec => 'critical|c=i', help => q(Exit with CRITICAL status if fewer than INTEGER foobars are free), required => 1, default => 10, ); # Add argument - positional parameters - arg spec, help text, # default value, required? (first two mandatory) $ng->arg( 'warning|w=i', q(Exit with WARNING status if fewer than INTEGER foobars are free), 5, 1); # Parse arguments and process standard ones (e.g. usage, help, version) $ng->getopts; # Access arguments using named accessors or or via the generic get() print $ng->warning; print $ng->get('critical'); DESCRIPTION
Nagios::Plugin::Getopt is an OO perl module providing standardised and simplified argument processing for Nagios plugins. It implements a number of standard arguments itself (--help, --version, --usage, --timeout, --verbose, and their short form counterparts), produces standardised nagios plugin help output, and allows additional arguments to be easily defined. CONSTRUCTOR # Instantiate object (usage is mandatory) $ng = Nagios::Plugin::Getopt->new( usage => 'Usage: %s --hello', version => '0.01', ); The Nagios::Plugin::Getopt constructor accepts the following named arguments: usage (required) Short usage message used with --usage/-? and with missing required arguments, and included in the longer --help output. Can include a '%s' sprintf placeholder which will be replaced with the plugin name e.g. usage => qq(Usage: %s -H <hostname> -p <ports> [-v]), might be displayed as: $ ./check_tcp_range --usage Usage: check_tcp_range -H <hostname> -p <ports> [-v] version (required) Plugin version number, included in the --version/-V output, and in the longer --help output. e.g. $ ./check_tcp_range --version check_tcp_range 0.2 [http://www.openfusion.com.au/labs/nagios/] url URL for info about this plugin, included in the --version/-V output, and in the longer --help output (see preceding 'version' example). blurb Short plugin description, included in the longer --help output (see below for an example). license License text, included in the longer --help output (see below for an example). By default, this is set to the standard nagios plugins GPL license text: This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY. It may be used, redistributed and/or modified under the terms of the GNU General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt). Provide your own to replace this text in the help output. extra Extra text to be appended at the end of the longer --help output. plugin Plugin name. This defaults to the basename of your plugin, which is usually correct, but you can set it explicitly if not. timeout Timeout period in seconds, overriding the standard timeout default (15 seconds). The full --help output has the following form: version string license string blurb usage string options list extra text The 'blurb' and 'extra text' sections are omitted if not supplied. For example: $ ./check_tcp_range -h check_tcp_range 0.2 [http://www.openfusion.com.au/labs/nagios/] This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY. It may be used, redistributed and/or modified under the terms of the GNU General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt). This plugin tests arbitrary ranges/sets of tcp ports for a host. Usage: check_tcp_range -H <hostname> -p <ports> [-v] Options: -h, --help Print detailed help screen -V, --version Print version information -H, --hostname=ADDRESS Host name or IP address -p, --ports=STRING Port numbers to check. Format: comma-separated, colons for ranges, no spaces e.g. 8700:8705,8710:8715,8760 -t, --timeout=INTEGER Seconds before plugin times out (default: 15) -v, --verbose Show details for command-line debugging (can repeat up to 3 times) ARGUMENTS You can define arguments for your plugin using the arg() method, which supports both named and positional arguments. In both cases the "spec" and "help" arguments are required, while the "label", "default", and "required" arguments are optional: # Define --hello argument (named parameters) $ng->arg( spec => 'hello|h=s', help => "Hello string", required => 1, ); # Define --hello argument (positional parameters) # Parameter order is 'spec', 'help', 'default', 'required?', 'label' $ng->arg('hello|h=s', "Hello parameter (default %s)", 5, 1); spec The "spec" argument (the first argument in the positional variant) is a Getopt::Long argument specification. See Getopt::Long for the details, but basically it is a series of one or more argument names for this argument (separated by '|'), suffixed with an '=<type>' indicator if the argument takes a value. '=s' indicates a string argument; '=i' indicates an integer argument; appending an '@' indicates multiple such arguments are accepted; and so on. The following are some examples: hello=s hello|h=s ports|port|p=i exclude|X=s@ verbose|v+ help The "help" argument is a string displayed in the --help option list output, or it can be a list (an arrayref) of such strings, for multi-line help (see below). The help string is munged in two ways: o First, if the help string does NOT begins with a '-' sign, it is prefixed by an expanded form of the "spec" argument. For instance, the following hello argument: $ng->arg( spec => 'hello|h=s', help => "Hello string", ); would be displayed in the help output as: -h, --hello=STRING Hello string where the '-h, --hello=STRING' part is derived from the spec definition (by convention with short args first, then long, then label/type, if any). o Second, if the string contains a '%s' it will be formatted via "sprintf" with the 'default' as the argument i.e. sprintf($help, $default) Multi-line help is useful in cases where an argument can be of different types and you want to make this explicit in your help output e.g. $ng->arg( spec => 'warning|w=s', help => [ 'Exit with WARNING status if less than BYTES bytes of disk are free', 'Exit with WARNING status if less than PERCENT of disk is free', ], label => [ 'BYTES', 'PERCENT%' ], ); would be displayed in the help output as: -w, --warning=BYTES Exit with WARNING status if less than BYTES bytes of disk are free -w, --warning=PERCENT% Exit with WARNING status if less than PERCENT of disk space is free Note that in this case we've also specified explicit labels in another arrayref corresponding to the "help" one - if this had been omitted the types would have defaulted to 'STRING', instead of 'BYTES' and 'PERCENT%'. label The "label" argument is a scalar or an arrayref (see 'Multi-line help' description above) that overrides the standard type expansion when generating help text from the spec definition. By default, "spec=i" arguments are labelled as "=INTEGER" in the help text, and "spec=s" arguments are labelled as "=STRING". By supplying your own "label" argument you can override these standard 'INTEGER' and 'STRING' designations. For multi-line help, you can supply an ordered list (arrayref) of labels to match the list of help strings e.g. label => [ 'BYTES', 'PERCENT%' ] Any labels that are left as undef (or just omitted, if trailing) will just use the default 'INTEGER' or 'STRING' designations e.g. label => [ undef, 'PERCENT%' ] default The "default" argument is the default value to be given to this parameter if none is explicitly supplied. required The "required" argument is a boolean used to indicate that this argument is mandatory (Nagios::Plugin::Getopt will exit with your usage message and a 'Missing argument' indicator if any required arguments are not supplied). Note that --help lists your arguments in the order they are defined, so you should order your "arg()" calls accordingly. GETOPTS The main parsing and processing functionality is provided by the getopts() method, which takes no arguments: # Parse and process arguments $ng->getopts; This parses the command line arguments passed to your plugin using Getopt::Long and the builtin and provided argument specifications. Flags and argument values are recorded within the object, and can be accessed either using the generic get() accessor, or using named accessors corresponding to your argument names. For example: print $ng->get('hello'); print $ng->hello(); if ($ng->verbose) { # ... } if ($ng->get('ports') =~ m/:/) { # ... } Note that where you have defined alternate argument names, the first is considered the citation form. All the builtin arguments are available using their long variant names. BUILTIN PROCESSING The "getopts()" method also handles processing of the immediate builtin arguments, namely --usage, --version, --help, as well as checking all required arguments have been supplied, so you don't have to handle those yourself. This means that your plugin will exit from the getopts() call in these cases - if you want to catch that you can run getopts() within an eval{}. "getopts()" also sets up a default ALRM timeout handler so you can use an alarm $ng->timeout; around any blocking operations within your plugin (which you are free to override if you want to use a custom timeout message). SEE ALSO
Nagios::Plugin, Getopt::Long AUTHOR
Gavin Carr <gavin@openfusion.com.au> COPYRIGHT AND LICENSE
Copyright (C) 2006-2007 by the Nagios Plugin Development Team. This module is free software. It may be used, redistributed and/or modified under either the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html) or the GNU General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt). perl v5.14.2 2010-12-03 Nagios::Plugin::Getopt(3pm)
All times are GMT -4. The time now is 01:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy