NagiosPlugin.vbs new framework
Mattias Ryrlén
mattias.ryrlen-5Rr5URSufFE at public.gmane.org
Thu Nov 27 17:00:13 CET 2008
Hello,
I have built a framework to be used with vbscript files and nagios. this
is in early stage but it almost works as i would expect it (similar as
Nagios::Plugin for perl)
you can see the information about it on
http://git.op5.org/git/?p=nagios/vbs-plugins.git;a=summary
to just download/view the files click "tree" then "raw" on
NagiosPlugin.vbs and check_test.vbs for example.
you can use git to check-out the whole project with the following
command:
git clone git://git.op5.org/nagios/vbs-plugins.git
Feedback can be sent to list or direct to me :)
Example:
' Define what args that should be used
np.add_arg "host", "Hostaddress", 1
np.add_arg "warning", "warning threshold", 0
np.add_arg "critical", "critical threshold", 0
np.add_arg "community", "SNMP Community", 1
np.add_arg "variable", "Variable to check, eg CPU", 1
' If we have no args or arglist contains /help or not all of the required arguments are fulfilled show the usage output,.
If Args.Count < 1 Or Args.Exists("help") Or np.parse_args = 0 Then
np.Usage
End If
' If we define /warning /critical on commandline it should override the script default.
If Args.Exists("warning") Then threshold_warning = Args("warning")
If Args.Exists("critical") Then threshold_critical = Args("critical")
np.set_thresholds threshold_warning, threshold_critical
' Set the msg output to be used (OK/WARNING/CRITICAL/UNKNOWN will be applied automaticly)
return_code = np.check_threshold(Args("variable"))
msg = "Testing " & Args.Item("host") & " " & np.get_threshold("warning") & " " & np.get_threshold("critical")
' Nice Exit with msg and exitcode
np.nagios_exit msg, return_code
--
Vänliga hälsningar / Best Regards
Mattias Ryrlén
__________________________
op5 AB
Första Långgatan 19
SE-413 27 Göteborg
Mobil: +46 735-17 70 99
Support: +46 31-774 09 24
www.op5.com
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________________
Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
::: Please include plugins version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list