1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-11-23 09:12:14 +01:00

Merge pull request #650 from dmayan/patch-1

Added logging to router syslog
This commit is contained in:
Pavel Odintsov 2017-04-13 21:42:58 +04:00 committed by GitHub
commit 1d11ae6303

@ -71,6 +71,9 @@ if ( $API->connect( $cfg[ ip_mikrotik ], $cfg[ api_user ], $cfg[ api_pass ] ) )
$API->write( '=type=blackhole', false );
$API->write( '=bgp-communities=65535:666', false );
$API->write( '=comment=' . $comment_rule );
// Log to router syslog. Useful for alerting and Graylog reporting
$API->write( '/log/info', false );
$API->write( '=message=' . $comment_rule );
$ret = $API->read();
}
@ -82,6 +85,9 @@ if ( $API->connect( $cfg[ ip_mikrotik ], $cfg[ api_user ], $cfg[ api_pass ] ) )
$ID_ARRAY = $API->read();
$API->write( '/ip/route/remove', false );
$API->write( '=.id=' . $ID_ARRAY[ 0 ][ '.id' ] );
// Log to router syslog. Useful for alerting and Graylog reporting
$API->write( '/log/info', false );
$API->write( '=message=' . $comment_rule );
$ret = $API->read();
}
if ($ret) _log( $comment_rule );
@ -102,4 +108,4 @@ function _log( $msg ) {
else exec( "echo `date` \"- [FASTNETMON] - " . $msg . " \" >> " . $FILE_LOG_TMP );
}
?>
?>