Ad Widget

Collapse

Couple Of UserParameter checks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • James Wells
    Senior Member
    • Jun 2005
    • 664

    #16
    Originally posted by elkor
    I'd definately be interested in seeing what you have even if it was just a tarball of the existing files from the alpha build, I have the originals so I could run the diffs here. that could really open up some new functionality for me.
    Will get them to you as soon as I get my development machine back. Sadly, that is the only place I have them at present.
    Unofficial Zabbix Developer

    Comment

    • elkor
      Senior Member
      • Jul 2005
      • 299

      #17
      Originally posted by Alexei
      FYI I plan to enhance functionality of host profiles to allow usage of macros. So, most of information displayed in host profiles will be collected by ZABBIX (SNMP, whatever) agents.
      Excellent Alexei, I'll hold off on doing anything manually then. any idea about a timeframe? I know you get asked that a lot, just curious.

      Comment

      • elkor
        Senior Member
        • Jul 2005
        • 299

        #18
        Originally posted by James Wells
        Will get them to you as soon as I get my development machine back. Sadly, that is the only place I have them at present.
        many thanks, I look forward to seeing it!

        Comment

        • Nate Bell
          Senior Member
          • Feb 2005
          • 141

          #19
          Originally posted by morgolis
          Wasn't this implemented as a core function in zabbix_agentd? I read through the online manual / documentation for zabbix alpha 1.1 where it shows that you can get this information with the call function: system.cpu.idle1, system.cpu.system1, etc
          I've had some problems getting this one to work properly. It's reporting a value for each CPU time I check, but the value never changes. Could someone who got this working tell me what settings they used?
          Thanks,
          Nate

          Comment

          • sysigs
            Junior Member
            • Aug 2005
            • 27

            #20
            Hello,
            I made an evolution of oracle script and using it from Windows
            UserParameter=oralog[O8IF],C:\zabbix_agent\External\oracle.cmd login O8IF
            UserParameter=orats3[ANNUAIRE],C:\zabbix\External\oracle.cmd ts3 O8IF dummy user ANNUAIRE
            UserParameter=oratsc[O8IF],C:\zabbix\External\oracle.cmd tscount O8IF dummy user

            -> oracle.cmd
            @echo Off
            set Header="oracle.cmd 1.0 2006/03/07 12:12:00"
            rem +================================================= ==========================+
            rem | Copyright (c) 2004 THALES Information Systems Site de Sophia, FRANCE |
            rem | All rights reserved |
            rem | Applications Division |
            rem +================================================= ==========================+
            rem |
            rem | FILENAME
            rem | oracle.cmd
            rem |
            rem | DESCRIPTION
            rem | Procedure de test base oracle pour ZABBIX
            rem |
            rem | USAGE
            rem | oracle.cmd [login|tsx|tscount|help|version]
            rem | login <ORACLE_SID>
            rem | tscount <ORACLE_SID> <USER> <PASS>
            rem | ts1 <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>
            rem | ts2 <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>
            rem | ts3 <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>
            rem | help
            rem | version
            rem |
            rem | EXEMPLE
            rem | oracle.cmd version
            rem |
            rem | PLATFORM
            rem | WinNt
            rem |
            rem | NOTES
            rem |
            rem | HISTORY
            rem |
            rem +================================================= ==========================+

            set PROGNAME=oracle.cmd
            set PROGPATH=c:\zabbix\external
            set REVISION=1.0
            call %PROGPATH%\_Init.cmd
            @echo OFF

            IF "V%1"=="V" call :usage
            cd %PROGTEMP%
            IF "%1"=="help" call :help
            IF "%1"=="HELP" call :help

            IF "%1"=="login" call :login %2
            IF "%1"=="LOGIN" call :login %2

            IF "%1"=="tscount" call :tscount %2 %3 %4
            IF "%1"=="TSCOUNT" call :tscount %2 %3 %4

            IF "%1"=="TS1" call :ts1 %2 %3 %4 %5
            IF "%1"=="ts1" call :ts1 %2 %3 %4 %5

            IF "%1"=="TS2" call :ts2 %2 %3 %4 %5
            IF "%1"=="ts2" call :ts2 %2 %3 %4 %5

            IF "%1"=="TS3" call :ts3 %2 %3 %4 %5
            IF "%1"=="ts3" call :ts3 %2 %3 %4 %5

            IF "%1"=="version" call :version
            IF "%1"=="VERSION" call :version
            goto fin

            :usage
            echo "Usage:"
            echo " %PROGNAME% login <ORACLE_SID>"
            echo " %PROGNAME% ts1 <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>"
            echo " %PROGNAME% ts2 <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>"
            echo " %PROGNAME% ts3 <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING"
            echo " %PROGNAME% tscount <ORACLE_SID> <USER> <PASS>"
            echo " %PROGNAME% help"
            echo " %PROGNAME% version"
            goto :EOF

            :help
            echo %PROGNAME% %REVISION%
            echo ""
            call :usage
            echo ""
            echo " Test Oracle status"
            echo ""
            echo "tns SID/IP Address"
            echo " Check remote TNS server"
            echo ""
            echo "login SID"
            echo " Tente une connection dummy login et previent si pas 'ORA-01017: invalid username/password'"
            echo ""
            echo "ts1 ts2 ou ts3"
            echo " Test database locale pour la taille du tablespace dans ORACLE_SID"
            echo " ---> Requier Oracle user/password specifique."
            echo " ---> Requier 'select' sur 'dba_data_files' et 'dba_free_space'"
            echo " ---> ts1 recupere la place restante"
            echo " ---> ts2 recupere la taille totale"
            echo " ---> ts3 recupere le pourcentage d'occupation"
            echo ""
            echo "tscount"
            echo " Evalue dans une database locale pour le nombre de tablespace dans ORACLE_SID"
            echo " ---> Requier Oracle user/password specifique."
            echo " ---> Requier 'select' sur 'dba_object'"
            echo ""
            echo "help"
            echo " Affiche cet ecran de Help"
            echo ""
            echo "version"
            echo " Affiche la version et la license"
            echo ""
            echo "Attention l'ORACLE_SID est 'case sensitive'."
            echo ""
            echo ""
            goto :EOF


            :version
            echo %PLUGIN% %REVISION%
            goto :EOF


            :login
            set BASEORACLE=%1
            %ORACLE_HOME%\bin\sqlplus /nolog @%PROGSQL%\exit.sql %BASEORACLE% > %PROGTEMP%\Login_%BASEORACLE%.log
            set retour=%ERRORLEVEL%
            %PROGPATH%\printf %retour%
            goto :EOF

            :ts1
            call :ts %1 %2 %3 %4
            for /F "tokens=1 delims=. " %%a in ('echo %ts_free%') do set ts_free=%%a
            %PROGPATH%\printf %ts_free%
            goto :EOF
            :ts2
            call :ts %1 %2 %3 %4
            for /F "tokens=1 delims=. " %%a in ('echo %ts_total%') do set ts_total=%%a
            %PROGPATH%\printf %ts_total%
            goto :EOF
            :ts3
            call :ts %1 %2 %3 %4
            for /F "tokens=1 delims=. " %%a in ('echo %ts_pct%') do set ts_pct=%%a
            %PROGPATH%\printf %ts_pct%
            goto :EOF

            :ts
            set ts_free=0
            set ts_total=0
            set ts_pct=0
            set BASEORACLE=%1
            set tbsp=%4

            set file=%PROGTEMP%\tablespace_%BASEORACLE%_%tbsp%.lis
            %ORACLE_HOME%\bin\sqlplus -s %2/%3@%BASEORACLE% @%PROGSQL%\tablespace.sql %tbsp% > %file%
            set retour=%ERRORLEVEL%
            for /F "tokens=1,2,3" %%a in (%file%) do call :extract_ts %%a %%b %%c

            del %file% > nul
            goto :EOF

            :extract_ts
            if "%ts_free%"=="0" set ts_free=%1
            if "%ts_total%"=="0" set ts_total=%2
            if "%ts_pct%"=="0" set ts_pct=%3
            goto :EOF

            :tscount
            set ts_count=0
            set BASEORACLE=%1
            set file=%PROGTEMP%\tablespace_%BASEORACLE%.lis

            %ORACLE_HOME%\bin\sqlplus -s %2/%3@%BASEORACLE% @%PROGSQL%\tscount.sql > %file%
            set retour=%ERRORLEVEL%
            for /F "tokens=1 " %%a in (%file%) do call :ext_tsc %%a
            %PROGPATH%\printf %ts_count%
            del %file% > nul

            goto :EOF

            :ext_tsc
            if "%ts_count%"=="0" set ts_count=%1
            goto :EOF

            :fin

            -> _init.cmd
            @echo Off
            set PROGTEMP=C:\temp
            set PROGSQL=%PROGPATH%\sql
            set ORACLE_HOME=D:\oracle\ora81

            -> exit.sql
            WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
            SET VERIFY OFF
            WHENEVER OSERROR EXIT FAILURE ROLLBACK;
            connect dummy/user@&1
            exit

            -> tablespace.sql
            WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
            SET VERIFY OFF
            WHENEVER OSERROR EXIT FAILURE ROLLBACK;
            set pagesize 0
            set numf '9999999.99'
            select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc
            from
            (select tablespace_name,sum(bytes)/1024/1024 total
            from dba_data_files group by tablespace_name) A,
            ( select tablespace_name,sum(bytes)/1024/1024 free
            from dba_free_space group by tablespace_name) B
            where a.tablespace_name=b.tablespace_name and a.tablespace_name='&1';
            exit

            -> TsCount.sql
            WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
            SET VERIFY OFF
            WHENEVER OSERROR EXIT FAILURE ROLLBACK;
            set pagesize 0
            set numf '9999999'
            select count(*)
            from dba_tablespaces;
            exit

            Originally posted by primos
            Nagios check_oracle with Zabbix flavour! copy utils.sh that comes with the official nagios plugins in the same dir as the check! Advise : Make zabbix in the group as oracle (oinstall,dba) client installation(sqlplus):

            need: sqlplus,tnsping (make shure zabbix can execute them)
            I'm sure this can be improved but a good place to start!

            UserParameter=oracletns[db_name],/opt/zabbix/libexec/check_oracle --tns
            UserParameter=oracledb[db_name],/opt/zabbix/libexec/check_oracle --db
            UserParameter=oraclelogin[db_name],/opt/zabbix/libexec/check_oracle --login
            UserParameter=oracletablespace[tablespace_name],/opt/zabbix/libexec/check_oracle --tablespace db_name user user_passwd

            .../...

            esac
            Last edited by sysigs; 04-10-2006, 09:52.

            Comment

            • colin7151
              Junior Member
              • Oct 2006
              • 9

              #21
              Originally posted by elkor
              Excellent Alexei, I'll hold off on doing anything manually then. any idea about a timeframe? I know you get asked that a lot, just curious.
              I agree this sounds wonderful, I can not wait for this to appear, as it could greatly enhance the usefulness of zabbix for my company.

              I am currently trying to fend off a push from our helpdesk to put there goofy inventory software on our servers, this feature could put an end to there requests promptly.

              Any indication as to when this might appear ?

              Comment

              • richlv
                Senior Member
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Oct 2005
                • 3112

                #22
                Originally posted by Alexei
                Please be aware that if you use 1.1 alpha versions you may take advantage of flexible user parameters. It means that instead of:

                custom[macaddr0]

                you may define

                UserParameter=custom[*], script.sh

                and then use custom[eth0], custom[eth1], custom[whatever]

                The parameter will be passed as command line parameter to the script.
                well, in case anybody else stumbles upon this
                syntax has changed (http://www.zabbix.com/forum/showthread.php?t=1755), so you have to note parameters like this :
                UserParameter=hpasm[*],/home/zabbix/bin/hpasmwrapper $1 $2 $3

                if you have differing parameter count, just pass as many parameters as the largest command (for example, the script works with one or two parameters).
                the key would be
                hpasm[temperature cpu 1]
                or
                hpasm[temperature,io]
                - both spaces and commas work for parameter separation (though i haven't tested whether this would work with reverse order or additional characters - commas probably would be safer).

                if you want to pass parameters in different order or with additional control characters/options, do as in the linked example -
                UserParameter=whatever[*],/usr/local/bin/command $3 --$2 -o $1
                Zabbix 3.0 Network Monitoring book

                Comment

                Working...