zabbix 的啥基础知识啥的,请看由本站大牛凉白开先生写的zabbix教程。这里说说如何监控ssdb。SSDB 是一个 C/C++ 语言开发的高性能 NoSQL 数据库, 支持 KV, list, map(hash), zset(sorted set) 等数据结构, 用来替代或者与 Redis 配合存储十亿级别列表的数据。

百牛信息技术bainiu.ltd整理发布到博客园

  1. 导入ssdb模板
    这个是我自己创建的。不合适的地方自行修改。

     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    <?xml version="1.0" encoding="UTF-8"?>
    <zabbix_export>
        <version>3.2</version>
        <date>2017-07-05T06:50:33Z</date>
        <groups>
            <group>
                <name>Templates</name>
            </group>
        </groups>
        <templates>
            <template>
                <template>Template App SSDB</template>
                <name>Template App SSDB</name>
                <description>ssdb</description>
                <groups>
                    <group>
                        <name>Templates</name>
                    </group>
                </groups>
                <applications>
                    <application>
                        <name>ssdb</name>
                    </application>
                </applications>
                <items>
                    <item>
                        <name>ssdb server is running</name>
                        <type>0</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>net.tcp.listen[{$SSDB.PORT}]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>ssdb</name>
                            </application>
                        </applications>
                        <valuemap>
                            <name>Service state</name>
                        </valuemap>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>ssdb $1</name>
                        <type>0</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>ssdb[available]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>ssdb</name>
                            </application>
                        </applications>
                        <valuemap>
                            <name>Service state</name>
                        </valuemap>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>ssdb $1 max_seq</name>
                        <type>0</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>ssdb[binlogs]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description>The maximum binlog number in the current queue</description>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>ssdb</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>ssdb $1</name>
                        <type>0</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>ssdb[dbsize]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>ssdb</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>ssdb links</name>
                        <type>0</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>ssdb[links]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>ssdb</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>ssdb $1 $2</name>
                        <type>0</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>ssdb[replication.client,last_seq]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>ssdb</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>ssdb $1 $2</name>
                        <type>0</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>ssdb[replication.client,status]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>0</trends>
                        <status>0</status>
                        <value_type>4</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>ssdb</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>ssdb $1</name>
                        <type>0</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>ssdb[total_calls]</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>ssdb</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                </items>
                <discovery_rules>
                    <discovery_rule>
                        <name>SSDB cmd discovery</name>
                        <type>0</type>
                        <snmp_community/>
                        <snmp_oid/>
                        <key>ssdb.cmd.discovery</key>
                        <delay>30</delay>
                        <status>0</status>
                        <allowed_hosts/>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <filter>
                            <evaltype>0</evaltype>
                            <formula/>
                            <conditions/>
                        </filter>
                        <lifetime>30</lifetime>
                        <description/>
                        <item_prototypes>
                            <item_prototype>
                                <name>ssdb cmd $1 $2</name>
                                <type>0</type>
                                <snmp_community/>
                                <multiplier>0</multiplier>
                                <snmp_oid/>
                                <key>ssdb[{#SSDBCMD},calls]</key>
                                <delay>30</delay>
                                <history>90</history>
                                <trends>365</trends>
                                <status>0</status>
                                <value_type>3</value_type>
                                <allowed_hosts/>
                                <units/>
                                <delta>0</delta>
                                <snmpv3_contextname/>
                                <snmpv3_securityname/>
                                <snmpv3_securitylevel>0</snmpv3_securitylevel>
                                <snmpv3_authprotocol>0</snmpv3_authprotocol>
                                <snmpv3_authpassphrase/>
                                <snmpv3_privprotocol>0</snmpv3_privprotocol>
                                <snmpv3_privpassphrase/>
                                <formula>1</formula>
                                <delay_flex/>
                                <params/>
                                <ipmi_sensor/>
                                <data_type>0</data_type>
                                <authtype>0</authtype>
                                <username/>
                                <password/>
                                <publickey/>
                                <privatekey/>
                                <port/>
                                <description/>
                                <inventory_link>0</inventory_link>
                                <applications>
                                    <application>
                                        <name>ssdb</name>
                                    </application>
                                </applications>
                                <valuemap/>
                                <logtimefmt/>
                                <application_prototypes>
                                    <application_prototype>
                                        <name>ssdb cmd discovery</name>
                                    </application_prototype>
                                </application_prototypes>
                            </item_prototype>
                            <item_prototype>
                                <name>ssdb cmd $1 $2</name>
                                <type>0</type>
                                <snmp_community/>
                                <multiplier>0</multiplier>
                                <snmp_oid/>
                                <key>ssdb[{#SSDBCMD},time_proc]</key>
                                <delay>30</delay>
                                <history>90</history>
                                <trends>365</trends>
                                <status>0</status>
                                <value_type>3</value_type>
                                <allowed_hosts/>
                                <units/>
                                <delta>0</delta>
                                <snmpv3_contextname/>
                                <snmpv3_securityname/>
                                <snmpv3_securitylevel>0</snmpv3_securitylevel>
                                <snmpv3_authprotocol>0</snmpv3_authprotocol>
                                <snmpv3_authpassphrase/>
                                <snmpv3_privprotocol>0</snmpv3_privprotocol>
                                <snmpv3_privpassphrase/>
                                <formula>1</formula>
                                <delay_flex/>
                                <params/>
                                <ipmi_sensor/>
                                <data_type>0</data_type>
                                <authtype>0</authtype>
                                <username/>
                                <password/>
                                <publickey/>
                                <privatekey/>
                                <port/>
                                <description/>
                                <inventory_link>0</inventory_link>
                                <applications>
                                    <application>
                                        <name>ssdb</name>
                                    </application>
                                </applications>
                                <valuemap/>
                                <logtimefmt/>
                                <application_prototypes>
                                    <application_prototype>
                                        <name>ssdb cmd discovery</name>
                                    </application_prototype>
                                </application_prototypes>
                            </item_prototype>
                            <item_prototype>
                                <name>ssdb cmd $1 $2</name>
                                <type>0</type>
                                <snmp_community/>
                                <multiplier>0</multiplier>
                                <snmp_oid/>
                                <key>ssdb[{#SSDBCMD},time_wait]</key>
                                <delay>30</delay>
                                <history>90</history>
                                <trends>365</trends>
                                <status>0</status>
                                <value_type>3</value_type>
                                <allowed_hosts/>
                                <units/>
                                <delta>0</delta>
                                <snmpv3_contextname/>
                                <snmpv3_securityname/>
                                <snmpv3_securitylevel>0</snmpv3_securitylevel>
                                <snmpv3_authprotocol>0</snmpv3_authprotocol>
                                <snmpv3_authpassphrase/>
                                <snmpv3_privprotocol>0</snmpv3_privprotocol>
                                <snmpv3_privpassphrase/>
                                <formula>1</formula>
                                <delay_flex/>
                                <params/>
                                <ipmi_sensor/>
                                <data_type>0</data_type>
                                <authtype>0</authtype>
                                <username/>
                                <password/>
                                <publickey/>
                                <privatekey/>
                                <port/>
                                <description/>
                                <inventory_link>0</inventory_link>
                                <applications>
                                    <application>
                                        <name>ssdb</name>
                                    </application>
                                </applications>
                                <valuemap/>
                                <logtimefmt/>
                                <application_prototypes>
                                    <application_prototype>
                                        <name>ssdb cmd discovery</name>
                                    </application_prototype>
                                </application_prototypes>
                            </item_prototype>
                        </item_prototypes>
                        <trigger_prototypes/>
                        <graph_prototypes>
                            <graph_prototype>
                                <name>ssdb {#SSDBCMD}</name>
                                <width>900</width>
                                <height>200</height>
                                <yaxismin>0.0000</yaxismin>
                                <yaxismax>100.0000</yaxismax>
                                <show_work_period>1</show_work_period>
                                <show_triggers>1</show_triggers>
                                <type>0</type>
                                <show_legend>1</show_legend>
                                <show_3d>0</show_3d>
                                <percent_left>0.0000</percent_left>
                                <percent_right>0.0000</percent_right>
                                <ymin_type_1>0</ymin_type_1>
                                <ymax_type_1>0</ymax_type_1>
                                <ymin_item_1>0</ymin_item_1>
                                <ymax_item_1>0</ymax_item_1>
                                <graph_items>
                                    <graph_item>
                                        <sortorder>0</sortorder>
                                        <drawtype>0</drawtype>
                                        <color>1A7C11</color>
                                        <yaxisside>0</yaxisside>
                                        <calc_fnc>2</calc_fnc>
                                        <type>0</type>
                                        <item>
                                            <host>Template App SSDB</host>
                                            <key>ssdb[{#SSDBCMD},calls]</key>
                                        </item>
                                    </graph_item>
                                    <graph_item>
                                        <sortorder>1</sortorder>
                                        <drawtype>0</drawtype>
                                        <color>F63100</color>
                                        <yaxisside>0</yaxisside>
                                        <calc_fnc>2</calc_fnc>
                                        <type>0</type>
                                        <item>
                                            <host>Template App SSDB</host>
                                            <key>ssdb[{#SSDBCMD},time_proc]</key>
                                        </item>
                                    </graph_item>
                                    <graph_item>
                                        <sortorder>2</sortorder>
                                        <drawtype>0</drawtype>
                                        <color>2774A4</color>
                                        <yaxisside>0</yaxisside>
                                        <calc_fnc>2</calc_fnc>
                                        <type>0</type>
                                        <item>
                                            <host>Template App SSDB</host>
                                            <key>ssdb[{#SSDBCMD},time_wait]</key>
                                        </item>
                                    </graph_item>
                                </graph_items>
                            </graph_prototype>
                        </graph_prototypes>
                        <host_prototypes/>
                    </discovery_rule>
                </discovery_rules>
                <httptests/>
                <macros>
                    <macro>
                        <macro>{$SSDB.PORT}</macro>
                        <value>8888</value>
                    </macro>
                </macros>
                <templates/>
                <screens/>
            </template>
        </templates>
        <triggers>
            <trigger>
                <expression>{Template App SSDB:net.tcp.listen[{$SSDB.PORT}].last()}=0</expression>
                <recovery_mode>1</recovery_mode>
                <recovery_expression>{Template App SSDB:net.tcp.listen[{$SSDB.PORT}].last()}=1</recovery_expression>
                <name>ssdb is down on {HOST.NAME}</name>
                <correlation_mode>0</correlation_mode>
                <correlation_tag/>
                <url/>
                <status>0</status>
                <priority>4</priority>
                <description/>
                <type>0</type>
                <manual_close>0</manual_close>
                <dependencies/>
                <tags/>
            </trigger>
            <trigger>
                <expression>{Template App SSDB:ssdb[binlogs].last()} - {Template App SSDB:ssdb[replication.client,last_seq].last()} &gt; 3600</expression>
                <recovery_mode>0</recovery_mode>
                <recovery_expression/>
                <name>ssdb replacation is behind on {HOST.NAME}</name>
                <correlation_mode>0</correlation_mode>
                <correlation_tag/>
                <url/>
                <status>0</status>
                <priority>2</priority>
                <description/>
                <type>0</type>
                <manual_close>0</manual_close>
                <dependencies>
                    <dependency>
                        <name>ssdb replacation is failed on {HOST.NAME}</name>
                        <expression>{es1:ssdb[replication.client,status].str(SYNC)}&lt;&gt;1</expression>
                        <recovery_expression/>
                    </dependency>
                </dependencies>
                <tags/>
            </trigger>
            <trigger>
                <expression>{Template App SSDB:ssdb[replication.client,status].str(SYNC)}&lt;&gt;1</expression>
                <recovery_mode>0</recovery_mode>
                <recovery_expression/>
                <name>ssdb replacation is failed on {HOST.NAME}</name>
                <correlation_mode>0</correlation_mode>
                <correlation_tag/>
                <url/>
                <status>0</status>
                <priority>2</priority>
                <description/>
                <type>0</type>
                <manual_close>0</manual_close>
                <dependencies>
                    <dependency>
                        <name>ssdb is down on {HOST.NAME}</name>
                        <expression>{es1:net.tcp.listen[{$SSDB.PORT}].last()}=0</expression>
                        <recovery_expression>{es1:net.tcp.listen[{$SSDB.PORT}].last()}=1</recovery_expression>
                    </dependency>
                </dependencies>
                <tags/>
            </trigger>
            <trigger>
                <expression>{Template App SSDB:ssdb[available].last()}&lt;&gt;1</expression>
                <recovery_mode>0</recovery_mode>
                <recovery_expression/>
                <name>ssdb  service availability on {HOST.NAME}</name>
                <correlation_mode>0</correlation_mode>
                <correlation_tag/>
                <url/>
                <status>0</status>
                <priority>2</priority>
                <description/>
                <type>0</type>
                <manual_close>0</manual_close>
                <dependencies>
                    <dependency>
                        <name>ssdb is down on {HOST.NAME}</name>
                        <expression>{Template App SSDB:net.tcp.listen[{$SSDB.PORT}].last()}=0</expression>
                        <recovery_expression>{Template App SSDB:net.tcp.listen[{$SSDB.PORT}].last()}=1</recovery_expression>
                    </dependency>
                </dependencies>
                <tags/>
            </trigger>
        </triggers>
        <graphs>
            <graph>
                <name>ssdb current connections</name>
                <width>900</width>
                <height>200</height>
                <yaxismin>0.0000</yaxismin>
                <yaxismax>100.0000</yaxismax>
                <show_work_period>1</show_work_period>
                <show_triggers>1</show_triggers>
                <type>0</type>
                <show_legend>1</show_legend>
                <show_3d>0</show_3d>
                <percent_left>0.0000</percent_left>
                <percent_right>0.0000</percent_right>
                <ymin_type_1>0</ymin_type_1>
                <ymax_type_1>0</ymax_type_1>
                <ymin_item_1>0</ymin_item_1>
                <ymax_item_1>0</ymax_item_1>
                <graph_items>
                    <graph_item>
                        <sortorder>0</sortorder>
                        <drawtype>0</drawtype>
                        <color>1A7C11</color>
                        <yaxisside>0</yaxisside>
                        <calc_fnc>2</calc_fnc>
                        <type>0</type>
                        <item>
                            <host>Template App SSDB</host>
                            <key>ssdb[links]</key>
                        </item>
                    </graph_item>
                </graph_items>
            </graph>
            <graph>
                <name>ssdb database size estimate</name>
                <width>900</width>
                <height>200</height>
                <yaxismin>0.0000</yaxismin>
                <yaxismax>100.0000</yaxismax>
                <show_work_period>1</show_work_period>
                <show_triggers>1</show_triggers>
                <type>0</type>
                <show_legend>1</show_legend>
                <show_3d>0</show_3d>
                <percent_left>0.0000</percent_left>
                <percent_right>0.0000</percent_right>
                <ymin_type_1>0</ymin_type_1>
                <ymax_type_1>0</ymax_type_1>
                <ymin_item_1>0</ymin_item_1>
                <ymax_item_1>0</ymax_item_1>
                <graph_items>
                    <graph_item>
                        <sortorder>0</sortorder>
                        <drawtype>0</drawtype>
                        <color>1A7C11</color>
                        <yaxisside>0</yaxisside>
                        <calc_fnc>2</calc_fnc>
                        <type>0</type>
                        <item>
                            <host>Template App SSDB</host>
                            <key>ssdb[dbsize]</key>
                        </item>
                    </graph_item>
                </graph_items>
            </graph>
        </graphs>
        <value_maps>
            <value_map>
                <name>Service state</name>
                <mappings>
                    <mapping>
                        <value>0</value>
                        <newvalue>Down</newvalue>
                    </mapping>
                    <mapping>
                        <value>1</value>
                        <newvalue>Up</newvalue>
                    </mapping>
                </mappings>
            </value_map>
        </value_maps>
    </zabbix_export>

    文件下载:zbx_ssdb_templates.xml

  2. 脚本
     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    $ cat /etc/zabbix/libexec/ssdb.py
    #!/bin/env python
     
    import sys,json,socket,re
    from SSDB import SSDB
     
    def get_stats(ip,port):
      ssdb = SSDB(ip, port)
      info = ssdb.request('info',['cmd'])
      result= info.data[1:]
      return result
     
    def discovery_cmd(info):
      d={'data':[]}
      for i in range(0,len(info),2):
        if info[i].find('cmd') != -1:
          d['data'].append({'{#SSDBCMD}':info[i]})
     
      return json.dumps(d)
     
    def check(ip,port):
      ssdb = SSDB(ip, port)
      try:
        ssdb.request('set', ['zabbix', '123'])
        ssdb.request('get', ['zabbix'])
        return 1
      except:
        return 0
     
    if __name__ == '__main__':
      ip = socket.gethostbyname(socket.getfqdn(socket.gethostname()))
      port = 8888
      stats = get_stats(ip,port)
      res = {}
      for i in range(0,len(stats),2):
        if stats[i] == 'replication':
          stats[i] = stats[i]+'.'+stats[i+1].split()[0]
        res[stats[i]] = stats[i+1]
      
      cmd = sys.argv[1]
      filter = sys.argv[2] if len(sys.argv) > 2 else ''
     
      if cmd  == 'discover':
        print discovery_cmd(stats)
      elif cmd.find('cmd') != -1:
        p = re.compile('(\w+):\s+(\d+)\s+(\w+):\s+(\d+)\s+(\w+):\s+(\d+)')
        m = p.match(res[cmd])
        d=dict(zip(m.group(1,3,5),m.group(2,4,6)))
        #print d[filter]
        print d.get(filter,'not support')
      elif cmd == 'replication.client':
        for i in res['replication.client'].split('\n'):
          if i.split(':')[0].strip() == filter:
            print i.split(':')[1].strip()
      elif cmd == 'binlogs':
        print res['binlogs'].split('\n')[-1].split(':')[-1].strip()
      elif cmd == 'available':
        print check(ip,port)
      else:
        print res.get(cmd,'not support')
  3. userparameter配置
     
    1
    2
    3
    $ cat /etc/zabbix/zabbix_agentd.d/userparameter_ssdb.conf
    UserParameter=ssdb.cmd.discovery,/etc/zabbix/libexec/ssdb.py discover
    UserParameter=ssdb[*],/etc/zabbix/libexec/ssdb.py $1 $2

需要使用到ssdb的python客户端,我这里是使用ssdb源码自带的python客户端。

item的定义:

triggers定义:

注意:适用于ssdb 主主复制。单实例、主从、多主并未测试过。

zabbix 监控ssdb的更多相关文章

  1. 使用Zabbix监控Oracle数据库

    Orabbix介绍 监控Oracle数据库我们需要安装第三方提供的Zabbix插件,我们先测试比较有名的Orabbix,http://www.smartmarmot.com/product/orabb ...

  2. Zabbix监控nginx-rtmp status(json版)

    与前面的文章 zabbix监控nginx-rtmp status(html版)区别只在于取值的页面不一样 http://127.0.0.1:81/control/get/all_streams sta ...

  3. Zabbix监控mysql performance

    介绍 zabbix监控mysql性能,使用zabbix自带的mysql监控模板,可以监控以下内容OPS(增删改查).mysql慢查询数量.mysql请求\响应流量带宽 配置 新建mysql监控用户 G ...

  4. zabbix监控Java 8080端口

    linux下端口和服务是对应的,Java进程启动时默认监听8080端口,如果服务挂掉则8080端口就没有了. lsof -i:8080 端口,如果没有任何的输出,说明该端口不在工作. 想在zabbix ...

  5. zabbix监控报错zabbix server is not running解决方法

    问题描述: 布置好zabbix监控,正常运行.但是重启了虚拟机服务器之后,页面出现如下的报错,而且设置的报信息也是失效的:

  6. Zabbix监控Tengine

    title: Zabbix监控Tengine tags: zabbix,nginx,tengine author: Chinge Yang date: 2016-12-29 --- Zabbix监控T ...

  7. zabbix 监控web网站性能

    一直在纠结用什么实例来给大家演示呢?想来想去还是官方的好,那我们怎么用zabbix监控web性能和可用性呢?我们这边分为几个步骤:打开网站.登陆.登陆验证.退出,一共4个小step,看实例. 检测流程 ...

  8. Zabbix监控disk performance

    概述 zabbix获取/sys里面的磁盘信息并分析来监控disk performance sysfs是Linux内核中设计较新的一种虚拟的基于内存的文件系统,它的作用与 proc 有些类似(默认挂载在 ...

  9. Zabbix监控mysql主从复制状态

    原理 mysql slave show slave status\G 在输出信息中查看I/O线程和SQL线程的状态值(YES为正常,NO为错误) Slave_IO_Running: Yes Slave ...

随机推荐

  1. POJ 1273 Drainage Ditches【图论,网络流】

    就是普通的网络流问题,想试试新学的dinic算法,这个算法暑假就开始看国家集训队论文了,之前一直都只用没效率的EK算法,真正学会这个算法还是开学后白书上的描述:dinic算法就是不断用BFS构建层次图 ...

  2. 爱在心中(codevs 2822)

    题目描述 Description “每个人都拥有一个梦,即使彼此不相同,能够与你分享,无论失败成功都会感动.爱因为在心中,平凡而不平庸,世界就像迷宫,却又让我们此刻相逢Our Home.” 在爱的国度 ...

  3. 没有上司的舞会(hdu 1520)

    题目描述 Description Ural大学有N个职员,编号为1~N.他们有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司.每个职员有一个快乐指数.现在有个周年庆宴会 ...

  4. jquery 关于ajax 及其son

    <%@ page language="java" pageEncoding="UTF-8"%><%@include file="/c ...

  5. Ubuntu 16.04安装QQ(不一定成功)

    注意1:如果是刚新装的系统,可以正常安装,但是,如果你已经装了很多软件,千万不要安装,因为会把系统上一般的依赖包和你之前装的软件全部卸载掉!甚至将桌面Dock都会卸载!最终只能重装Ubuntu解决. ...

  6. dtrace

    http://blog.csdn.net/lw1a2/article/details/7389323

  7. java去空格

    1.trim()是去掉首尾空格    2.str.replace(" ", ""); 去掉所有空格,包括首尾.中间    3.或者replaceAll(&quo ...

  8. java的计时:毫秒、纳秒

    System.currentTimeMillis()获取毫秒值,但是其精度依赖操作系统 想实现较为精确的毫秒,可以采用 System.nanoTime()/1000000L System.nanoTi ...

  9. Jmeter的几个关键配置文件

    1.配置文件位于bin目录下: 2.配置文件可能存在优先级关系,好像user.properties会覆盖jmeter.properties,一般修改配置都是修改或者添加user.properties, ...

  10. jmeter的jmx脚本结构解析

    jmeter的jmx脚本是xml文档,简单分析下其结构 xml是树形结构:jmeter界面的树形结构就是xml的结构 一级目录: 二级目录:在一级目录右键后可以看到的,都可以做为二级目录 三级目录.n ...