diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/README | 47 | ||||
-rwxr-xr-x | examples/dbload | 15 | ||||
-rwxr-xr-x | examples/inspect | 15 |
3 files changed, 77 insertions, 0 deletions
diff --git a/examples/README b/examples/README new file mode 100644 index 0000000..f5a1c50 --- /dev/null +++ b/examples/README @@ -0,0 +1,47 @@ +* Overview + +This directory contains example Perl scripts that access ping903 +facilities via REST API. You can use them as templates for writing +your own configuration system, or just run them as they are, if you +prefer. + +* Programs + + - inspect + Queries the daemon for its configuration settings and displays + them on stdout in the format of ping903 configuration file. + + - ipadd + Adds IP address to the list of addresses monitored by ping903. + + - ipdel + Removes IP address from the list of monitored addresses. + + - dbload + Populates the list of monitored addresses from a SQL database. + +All these programs use the LWP::Ping903 module, which provides support +for parsing the ".ping903.cred" file. The source file for the module is +lib/LWP/Ping903.pm. To run the programs from the examples directory, +define the following environment variable: + + export PERL5LIB=lib + +If you don't plan to use basic authorization, you can get rid of this +dependency using the following command: + + sed -i 's/LWP::Ping903/LWP::UserAgent/' inspect ipadd ipdel dbload + +* Documentation + +Each example is self-documented. To access the description, run the +script with the --help option, or do "perldoc PROG". + + +Local Variables: +mode: outline +paragraph-separate: "[ ]*$" +version-control: never +End: + + diff --git a/examples/dbload b/examples/dbload index f3e9ec2..245ace2 100755 --- a/examples/dbload +++ b/examples/dbload @@ -2,6 +2,21 @@ #! -*-perl-*- eval 'exec perl -x -S $0 ${1+"$@"}' if 0; +# This file is part of Ping903 +# Copyright (C) 2020 Sergey Poznyakoff +# +# Ping903 is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# Ping903 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ping903. If not, see <http://www.gnu.org/licenses/>. =head1 NAME diff --git a/examples/inspect b/examples/inspect index 6aacad4..8af9b25 100755 --- a/examples/inspect +++ b/examples/inspect @@ -2,6 +2,21 @@ #! -*-perl-*- eval 'exec perl -x -S $0 ${1+"$@"}' if 0; +# This file is part of Ping903 +# Copyright (C) 2020 Sergey Poznyakoff +# +# Ping903 is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# Ping903 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ping903. If not, see <http://www.gnu.org/licenses/>. =head1 NAME |