Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/DEV-capside/release-3.9.0:6365-6370
/branches/DEV-extra-notification-data:6734-6746
/branches/DEV-odw-calculations:9016-9160
/branches/DEV-restapi-monitoringservers:9778
/branches/DEV-snmp-multi:7324-7376
/branches/US187:9403-9479
/branches/US198b:8875-8994
/branches/US310:9851-9873
/branches/enterprise/BRAN-3.14:6874,6882,6956
/branches/enterprise/DEV-professional:6494-8475,8477-8478,8486,8490,8492,8494,8499-8500,8515,8518-8519,8524,8527-8529,8531-8532,8536,8538,8540-8544,8547-8552,8554,8557,8600-8601,8637,8749,8772,8897,8917,8944-8945,8947,8950-8952,8967,8969,8979,8982,8987,8998,9006,9008,9011,9013,9026,9033-9036,9038,9040,9042,9044,9048,9050-9053,9062,9064-9065,9069,9078,9081,9088,9096,9099-9101,9103,9105,9115,9118,9347,9353-9354,9411,9432,9445,9486,9538-9550,9569-9571,9620,9635,9637-9638,9645-9647,9693,9699,9721,9814,9825,9857,9879,9881,9939,10002,10029
/branches/nagvis-iframe:9764-9786
/branches/us168:8759,8762-8763,8766-8768,8770,8774-8777,8794,8798-8799,8801-8803,8821-8822,8834,8837-8838,8932,8937,8947,8969,8977,8981,9004,9007,9009-9010,9012,9024,9049
/commercial/branches/US306-slaves:9804-9823
/commercial/branches/US307-network-map:9685-9837
+ /branches/DEV-capside/release-3.9.0:6365-6370
/branches/DEV-extra-notification-data:6734-6746
/branches/DEV-odw-calculations:9016-9160
/branches/DEV-restapi-monitoringservers:9778
/branches/DEV-snmp-multi:7324-7376
/branches/US187:9403-9479
/branches/US198b:8875-8994
/branches/US310:9851-9873
/branches/enterprise/BRAN-3.14:6874,6882,6956
/branches/enterprise/DEV-professional:6494-8475,8477-8478,8486,8490,8492,8494,8499-8500,8515,8518-8519,8524,8527-8529,8531-8532,8536,8538,8540-8544,8547-8552,8554,8557,8600-8601,8637,8749,8772,8897,8917,8944-8945,8947,8950-8952,8967,8969,8979,8982,8987,8998,9006,9008,9011,9013,9026,9033-9036,9038,9040,9042,9044,9048,9050-9053,9062,9064-9065,9069,9078,9081,9088,9096,9099-9101,9103,9105,9115,9118,9347,9353-9354,9411,9432,9445,9486,9538-9550,9569-9571,9620,9635,9637-9638,9645-9647,9693,9699,9721,9814,9825,9857,9879,9881,9939,10002,10029,10038-10041
/branches/nagvis-iframe:9764-9786
/branches/us168:8759,8762-8763,8766-8768,8770,8774-8777,8794,8798-8799,8801-8803,8821-8822,8834,8837-8838,8932,8937,8947,8969,8977,8981,9004,9007,9009-9010,9012,9024,9049
/commercial/branches/US306-slaves:9804-9823
/commercial/branches/US307-network-map:9685-9837
Modified: trunk/opsview-core/etc/logrotate.conf
===================================================================
--- trunk/opsview-core/etc/logrotate.conf 2012-09-11 21:50:39 UTC (rev 10044)
+++ trunk/opsview-core/etc/logrotate.conf 2012-09-11 21:57:26 UTC (rev 10045)
@@ -14,21 +14,21 @@
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
"/usr/local/nagios/nmis/logs/nmis.log" {
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
"/usr/local/nagios/var/log/rsync_nmis_database.log" {
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
# other log files
@@ -36,41 +36,48 @@
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
"/usr/local/nagios/var/log/mrtgconfgen.log" {
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
"/usr/local/nagios/var/log/mrtg_genstats.log" {
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
"/usr/local/nagios/var/log/nagiosgraph.log" {
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
"/usr/local/nagios/var/log/takeover_hosts.log" {
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
"/usr/local/nagios/var/log/opsview_cronjobs.log" {
rotate 5
weekly
nocompress
- create 0775 nagios nagios
+ create 0660 nagios nagios
}
+"/usr/local/nagios/var/log/notify_by_ios_push.log" {
+ rotate 5
+ weekly
+ nocompress
+ create 0660 nagios nagios
+ }
+
Modified: trunk/opsview-core/notifications/notify_by_ios_push
===================================================================
--- trunk/opsview-core/notifications/notify_by_ios_push 2012-09-11 21:50:39 UTC (rev 10044)
+++ trunk/opsview-core/notifications/notify_by_ios_push 2012-09-11 21:57:26 UTC (rev 10045)
@@ -17,7 +17,7 @@
use lib qw( /usr/local/nagios/lib /usr/local/nagios/perl/lib );
use List::Util 'shuffle';
use Time::HiRes 'gettimeofday';
-use URI::Escape 'uri_escape';
+use Socket;
# Change these if you don't have the notification profile set up in Opsview.
my $opsview_system_uuid = '';
@@ -51,27 +51,20 @@
$ldap_password ||= $notification_vars->{IOSPUSH_PASSWORD};
$proxy ||= $notification_vars->{IOSPUSH_PROXY};
-my $alert_message =
- uri_escape( $ENV{NAGIOS_HOSTNAME} . ':' . $ENV{NAGIOS_SERVICEOUTPUT} );
+die "Must specify UUID" unless $opsview_system_uuid;
+die "Must have an opsview.com username" unless $ldap_username;
+die "Must have an opsview.com password" unless $ldap_password;
+
+my $alert_message = "$ENV{NAGIOS_HOSTNAME}: $ENV{NAGIOS_SERVICEOUTPUT}";
$alert_message = substr( $alert_message, 0, 190 );
# Remove any profile information from contact name.
my $contact_name = $ENV{NAGIOS_CONTACTNAME};
$contact_name =~ s'/.*'';
-# Get a list of IPs to try.
-require Net::DNS;
-my $res = Net::DNS::Resolver->new;
-my $query = $res->search($dest_server);
-unless ($query) {
- logit( "DNS query failed: " . $res->errorstring );
- exit 1;
-}
-my @ips;
-for my $rr ( $query->answer ) {
- next unless $rr->type eq 'A';
- push @ips, $rr->address;
-}
+# Get a list of IPs to try. Use gethostbyname so that OS may cache it
+my ( undef, undef, undef, undef, @ips ) = gethostbyname($dest_server);
+@ips = map { inet_ntoa($_) } @ips;
require LWP::UserAgent;
@@ -80,37 +73,38 @@
LWP::Protocol::implementor( 'https', 'Opsview::LWP::UserAgent::Protocol::HTTPS'
);
+use HTTP::Request::Common qw(POST);
+
# Send the request to each IP until one's successful.
@ips = shuffle @ips;
for my $ip (@ips) {
$pushserverip = $ip;
- my $url = ""
+ my $url = ""
+ my $req = POST $url,
+ [
+ cmd => 'send_msg',
+ uuid => $opsview_system_uuid,
+ username => $contact_name,
+ msg => $alert_message,
+ ];
+ $req->authorization_basic( $ldap_username, $ldap_password );
my $ua = LWP::UserAgent->new;
- $ua->credentials(
- $dest_server . ':' . ( $protocol eq 'https' ? '443' : '80' ),
- $realm, $ldap_username, $ldap_password );
- $ua->proxy( $protocol, $proxy );
- $ua->timeout(2);
+ $ua->proxy( $protocol, $proxy ) if $proxy;
+ $ua->timeout(5);
$ua->ssl_opts( SSL_verifycn_name => $dest_server );
my $begin = gettimeofday();
- my $res = $ua->post(
- $url,
- {
- cmd => 'send_msg',
- uuid => $opsview_system_uuid,
- username => $contact_name,
- msg => $alert_message,
- }
- );
+ my $res = $ua->request($req);
+ my ($message_count) = $res->content =~ /OK (\d+)/;
+ $message_count ||= 'N/A';
logit(
"[$ip] "
. $res->status_line
- . " took "
+ . " sent messages: $message_count and took "
. ( gettimeofday() - $begin )
. " seconds"
);