[Nagios-devel] Donation: perl/SNMP monitors for processes and disk

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Donation: perl/SNMP monitors for processes and disk

Post by Guest »

--=-V/GNUKun9F1Q9m8xMHyv
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello all,

I've written two perl plugins for monitoring disk space and running
processes over SNMP using the host-resources mib. They are both
attached. I run these here at Priority Health for monitoring our HP-UX
and Linux servers. A quick test showed that these will also work on
Windows 2000 running the default SNMP. I also believe that Novell
provides the host-resources mib, so the plugins should work for that,
too. The Net-SNMP perl modules are required for these scripts to
operate properly.

They are released under the GNU public license, especially not the NO
WARRANTY part ;)

Here are my command definitions from checkcommands.cfg. The
$SNMPCOMMUNITY$ is provided by a patch I posted to nagios-users a few
days ago. I've attached it here again.

define command {
command_name check_disk
command_line $USER1$/snmp_disk_monitor.pl -s -H $HOSTADDRESS$ -C
$SNMPCOMMUNITY$ -m $ARG1$
}
define command {
command_name check_disk_custom
command_line $USER1$/snmp_disk_monitor.pl -s -H $HOSTADDRESS$ -C
$SNMPCOMMUNITY$ -m $ARG1$ -w $ARG2$ -c $ARG3$
}
define command {
command_name check_process
command_line $USER1$/snmp_process_monitor.pl -H $HOSTADDRESS$ -C
$SNMPCOMMUNITY$ -e $ARG1$
}
define command {
command_name check_processes
command_line $USER1$/snmp_process_monitor.pl -H $HOSTADDRESS$ -C
$SNMPCOMMUNITY$ -e $ARG1$ -w $ARG2$ -c $ARG3$
}

Have fun and send me your feedback,
-Al Tobey
Unix Administrator
Priority Health



********************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity
to whom they are addressed. If you have received this
email in error please notify the Priority Health Information
Services Department at (616) 942-0954.
********************************************************************


--=-V/GNUKun9F1Q9m8xMHyv
Content-Disposition: attachment; filename=snmp_community.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=snmp_community.patch; charset=ISO-8859-1

diff -ruNp nagios-1.0b4/base/nagios.c nagios-1.0b4.tobeya/base/nagios.c
--- nagios-1.0b4/base/nagios.c Fri Jul 5 01:36:02 2002
+++ nagios-1.0b4.tobeya/base/nagios.c Wed Aug 14 17:14:53 2002
@@ -131,6 +131,7 @@ char *macro_service_state=3DNULL;
char *macro_date_time[7]=3D{NULL,NULL,NULL,NULL,NULL,NULL,NULL};
char *macro_output=3DNULL;
char *macro_perfdata=3DNULL;
+char *macro_snmp_community=3DNULL;
char *macro_contact_email=3DNULL;
char *macro_contact_pager=3DNULL;
char *macro_admin_email=3DNULL;
diff -ruNp nagios-1.0b4/base/utils.c nagios-1.0b4.tobeya/base/utils.c
--- nagios-1.0b4/base/utils.c Wed Jul 3 00:41:43 2002
+++ nagios-1.0b4.tobeya/base/utils.c Thu Aug 15 11:05:05 2002
@@ -88,6 +88,7 @@ extern char *macro_notification_type
extern char *macro_notification_number;
extern char *macro_argv[MAX_COMMAND_ARGUMENTS];
extern char *macro_user[MAX_USER_MACROS];
+extern char *macro_snmp_community;
=20
extern char *global_host_event_handler;
extern char *global_service_event_handler;
@@ -246,6 +247,8 @@ int process_macros(char *input_buffer,ch
=20
else if(!strcmp(temp_buffer,"HOSTADDRESS"))
strncat(output_buffer,(macro_host_address=3D=3DNULL)?"":macro_host_ad=
dress,buffer_length-strlen(output_buffer)-1);
+ else if(!strcmp(temp_buffer,"SNMPCOMMUNITY"))
+ strncat(output_buffer,(macro_snmp_community=3D=3DNULL)?"":macro_snmp_=
community,buffer_length-strlen(output_buffer)-1);
=20
else if(!strcmp(temp_buffer,"SERVICEDESC"))
strncat(output_buffer,(macro_service_description=3D=3DNULL)?"":macro_=
service_description,buffer_length-strlen(output_buffer)-1);
@@ -512,6 +515,13 @@ int grab_host_macros(host *hst){
if(macro_host_address!=3DNULL)
strcpy(macro_host_address,hst->address);
=20
+ /* get the snmp community */
+ if(macro_snmp_community!=3DNULL)
+ free(macro_snmp_community);
+

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: albert.tobey@priority-health.com
Locked